Why are the last few bytes in UART0's TX buffer delayed?

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

Why are the last few bytes in UART0's TX buffer delayed?

ソリューションへジャンプ
1,064件の閲覧回数
asfarley
Contributor IV

I'm printing out some strings over UART0 (the LPUART, I believe) on a K22F. 

Sometimes it works just fine; the entire string is printed out on the serial port. 

Other times, I see a strange behavior: most of the string is printed, except for the last few bytes. The next time a string is printed, the missing bytes appear, but the end of the next string is missing. 

For example, I print "Hello World!" and see:
"Hello Wor"

then, I trigger the next string ("another string") to be printed in my code, and I see:

ld!

another str

So it's like the UART is "falling a few bytes behind" and not catching up, even though the bytes are still in the TX buffer. 

I'm using the PE asynchronous serial component as a driver. Any ideas about why this is happening?

ラベル(1)
0 件の賞賛
返信
1 解決策
949件の閲覧回数
mjbcswitzerland
Specialist V

Hi Alexander

You will have a problem with the buffer driver and not the (LP)UART. It will stop supplying the UART interrupt with the next byte to send at some point when it shouldn't and then the last bytes from the buffer - plus the next string - are sent the next time it is started.

Try the uTasker project (it is free on Git Hub and has a fool proof (LP)UART implementation in interrupt and DMA driven modes, including complete UART simulation). You can also use it as reference to solve the problem that you have.

Regards

Mark


Complete Kinetis solutions, training and support:http://www.utasker.com/kinetis.html
Kinetis K22:
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/tinyK22.html

UART:
VLPS with continuous UART operation: https://community.nxp.com/message/421247#421247
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

Modbus ASCII/RTU: http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

元の投稿で解決策を見る

2 返答(返信)
950件の閲覧回数
mjbcswitzerland
Specialist V

Hi Alexander

You will have a problem with the buffer driver and not the (LP)UART. It will stop supplying the UART interrupt with the next byte to send at some point when it shouldn't and then the last bytes from the buffer - plus the next string - are sent the next time it is started.

Try the uTasker project (it is free on Git Hub and has a fool proof (LP)UART implementation in interrupt and DMA driven modes, including complete UART simulation). You can also use it as reference to solve the problem that you have.

Regards

Mark


Complete Kinetis solutions, training and support:http://www.utasker.com/kinetis.html
Kinetis K22:
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/tinyK22.html

UART:
VLPS with continuous UART operation: https://community.nxp.com/message/421247#421247
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

Modbus ASCII/RTU: http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

949件の閲覧回数
asfarley
Contributor IV

Thank you very much.

0 件の賞賛
返信