UART interrupts: First character and Timeout at the same time doesn't work

MikeMyhre
Posts: 54
Joined: Sat Nov 05, 2022 3:32 am

UART interrupts: First character and Timeout at the same time doesn't work

Postby MikeMyhre » Tue Jan 03, 2023 6:58 pm

I can get an interrupt on every character by setting the rxfifo_full_thresh value to 1.
If I leave the rxfifo_full_thresh value high (100), I can also get a rx_timeout_thresh = 1 to interrupt (as soon as the rx character stream stops).
I can't get both to occur with any configuration. It seems like as soon as I get the rxfifo_full interrupt, it disables the timeout interrupt feature. Interrupt mask is definitely still set after my rxfifo_full interrupt happens.
I really need to send my reply packet as soon as I get the first character (context in the protocol is important).
The timeout function is very useful to indicate the end of the packet so I can process it before another one is started.
Any hints on how I can get both interrupts to work?
Thanks!

MikeMyhre
Posts: 54
Joined: Sat Nov 05, 2022 3:32 am

Re: UART interrupts: First character and Timeout at the same time doesn't work

Postby MikeMyhre » Fri Jan 06, 2023 5:34 pm

I found a way to make this work.
Initially set up the interrupt for RXFIFO_FULL_THRESH = 1 and RXFIFO_TOUT_THRESH = 1.
I then get an interrupt on the first character where I change the RXFIFO_FULL_THRESH = 128 so the Timeout interrupt can happen.
I read characters into my buffer on both interrupts and do a flush() on the timeout interrupt after reading my characters.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], MicroController and 120 guests