Helpful ReplyUART drops characters if I rely on UTXBF flag

Post
vsimkus
Starting Member
2011/12/22 22:33:48
Hello

Having a weird issue.  UART code that works perfectly on a dsPIC30F4011 doesn't want to work on a PIC24FV16KA301. On the PIC24 the UART starts to drop characters after the first four.  If I send '1234ABCD' I get '1234ABD' on the other end.

Same problem at all baud rates down to 9600.  Loop-back mode - same behavior.  Oddly enough, in MPLAB SIM it works fine.

Function is super simple - check for the buffer full flag, cram data if it's not full, spin otherwise.  If I rely on the UTXBF flag to check for a full buffer, I start loosing characters.  If I rely on the TRMT flag, everything works fine - all the way up to 115kb/sec.

Checking the UTXBF flag works fine on the dsPIC30.

Weirdness.   Anyone else experience a similar issue?


void flush_buffer(void)
{
tx_c = 0;
while(tx_c < ob_idx)
{
//if(U1STAbits.TRMT == 1)
if(U1STAbits.UTXBF == 0)
{
U1TXREG = output_buffer[tx_c];
tx_c = tx_c + 1;
}
}
ob_idx = 0;
return;
}


flubydust
Super Member
☄ Helpful
Re:UART drops characters if I rely on UTXBF flag 2011/12/22 22:58:35
Read the device errata.
vsimkus
Starting Member
Re:UART drops characters if I rely on UTXBF flag 2011/12/22 23:14:47

flubydust 
Read the device errata.
 

Thanks!  Didn't even think to look.  This exact problem is right there...  Another lesson learned Smile


User.06
Super Member
Re:UART drops characters if I rely on UTXBF flag 2011/12/24 14:20:05
Document number ?

Section / Chapter / page number in that document ?

Is this involved in all PIC24 devices ?

Thank you; this topic is relevant to my interests.
Antipodean
Super Member
Re:UART drops characters if I rely on UTXBF flag 2011/12/24 14:23:45
Each chip family has its own errata sheet.

Look at the 'home page' for you chip to download the relevant errata for it.

vsimkus
Starting Member
Re:UART drops characters if I rely on UTXBF flag 2011/12/24 14:42:34
All documentation for this particular chip http://www.microchip.com/...aspx?dDocName=en552775 Document in question http://ww1.microchip.com/...n/DeviceDoc/80522c.pdf
matzlat
New Member
Re:UART drops characters if I rely on UTXBF flag 2017/04/22 07:34:41
The bad thing is that the errata says this problem is only for revision 4 devices but it applies for revision 7 as well.