SDK 2.1 UART Rx Overflow handling bug

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SDK 2.1 UART Rx Overflow handling bug

2,820件の閲覧回数
paulsandys
Contributor II

I think there's a logical bug in fsl_uart.c

 

/* If RX overrun. */

if (UART_S1_OR_MASK & base->S1) {
/* Read base->D to clear overrun flag, otherwise the RX does not work. */
 while (base->S1 & UART_S1_RDRF_MASK) {
      (void) base->D;
 }

 

 

The "while (base->S1 & UART_S1_RDRF_MASK)" creates a problem when the routine gets preempted by another interrupt. The RDRF can be set again, causing the routine to eat up extra bytes and/or generate additional Rx OR interrupts. After removing the while loop and reading "(void) base->D;" exactly once, the problems go away.

ラベル(1)
6 返答(返信)

2,313件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Paul,

Which chip do you used?

I randomly check one SDK package (FRDM-K22),

it just read D once :

pastedImage_1.png

BR

Alice

0 件の賞賛
返信

2,313件の閲覧回数
biafra
Senior Contributor I

Hi Alice_Yang‌,

It's the same in the latest SDK for TWR-K65F180M (2.4.1 2018-09-14).

Many thanks

Biafra

2,313件の閲覧回数
NicolasP
Contributor IV

Hi,

Same problem with SDK 2.4.1 and K22FN51212

Best regards,

Nicolas

0 件の賞賛
返信

2,313件の閲覧回数
paulsandys
Contributor II

FRDM-KL25Z

0 件の賞賛
返信

2,313件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

Thanks for your sharing , I will report it to the SDK team.

And I recommend you can use the UART driver file of FRDM-KL26.

I also attached it for you.

Hope it helps

Alice

0 件の賞賛
返信

2,313件の閲覧回数
paulsandys
Contributor II

I've wrote my own IRQ handler.

It would be very useful if the UART async driver could callback after receiving "special" character specified in the xfer structure, similar to SPI. (I.E.  NewLine, CarriageReturn, NULL or whatever)

0 件の賞賛
返信