XMC4700 UART - Safe way to change FIFO trigger limits

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User11773
Level 4
Level 4
First like received First solution authored
The serial protocol we're using has a variable packet size. I don't know how many bytes to receive. So DAVE UART App is not too useful.
So I setup DAVE UART App to be set to direct, then setup interrupts manually.
If I setup FIFO trigger level to be 0 & don't change, it interrupts after each byte received and reception works fine.

My minimum packet size is 6 bytes. Max can be as high as 25.
I tried to set the trigger level to trigger at 6, then examine a byte in packet to determine how many more bytes are coming.
This didn't work so well, random read values.
So, it appears changing the trigger level via XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit() inside an ISR is a problem.

Is there a way to safely change the trigger limit?
0 Likes
2 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Could you try with the following function?

__STATIC_INLINE void XMC_USIC_CH_RXFIFO_SetTriggerLimit(XMC_USIC_CH_t *const channel,
const uint32_t limit)
{
channel->RBCTR = (channel->RBCTR & (uint32_t)~USIC_CH_RBCTR_LIMIT_Msk) | ((limit << USIC_CH_RBCTR_LIMIT_Pos) & USIC_CH_RBCTR_LIMIT_Msk);
}


Regards,
Jesus
0 Likes
User11773
Level 4
Level 4
First like received First solution authored
I'll give that a try when I can.
What I was seeing was a string of serial bytes on the scope And the ISR read all the bytes,but one of the bytes was not what was in the serial stream.
Almost like if a byte was coming in & at that instance the trigger limit was changed, data byte was corrupted.
0 Likes