USIC/ASC - RXFIFO interrupt triggering

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

cross mob
Not applicable
Hi all,

I want to configure the USIC module (ASC in particular) to produce an interrupt request when new data is available. Right now, my buffer is defined to trigger on a Standard Receive Event when RBFLVL goes above the LIMIT (i.e. LOF == 1). The LIMIT is set to 0 during the configuration. The Handler is set up to read the data using XMC_USIC_CH_RXFIFO_GetData() and immediately echo it back. However, there is a latency that I can't explain right now - the data that is retrieved from the FIFO and is printed is the data that arrived during the last interrupt, i.e. if I want to type "Hello World" in my hyperterminal, an interrupt would trigger when I enter the 'H' key, but nothing would echo back. When I enter the 'e' key, 'H' gets echoed back. What am I doing wrong?

Thank you all in advance.

Edit: Here is the interrupt handler code.

void USIC0_0_IRQHandler(void){
uint16_t inputData = 0;
inputData = XMC_USIC_CH_RXFIFO_GetData(XMC_UART0_CH0);
XMC_UART_CH_Transmit(XMC_UART0_CH0, inputData);
XMC_USIC_CH_RXFIFO_ClearEvent(XMC_UART0_CH0, XMC_USIC_CH_RXFIFO_GetEvent(XMC_UART0_CH0));
}


Regards,
Andrey
0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
chismo
Employee
Employee
First like received
Hello Andrey,

I have tried to create a similar example based on LLDs.
Can you try if this works?



Regards,
Min Wei
0 Likes
Not applicable
Hello Min Wei,

This works as it should, thank you! The only part that was different in my code is the following

XMC_USIC_CH_EnableEvent(XMC_UART0_CH0, XMC_USIC_CH_EVENT_RECEIVE_START);

/* Instead of... */

XMC_USIC_CH_RXFIFO_EnableEvent(XMC_UART0_CH0, XMC_USIC_CH_RXFIFO_EVENT_CONF_STANDARD);


Could you please point out my mistake? I am guessing that the "Receive start" event occurs earlier, and hence data is not available in the buffer yet. Indeed, adding a while-loop to the interrupt handler that stalls the code until data is available in the FIFO has fixed the problem in my code. Is this accurate?

One more question that I have regarding your code - it works even though you haven't configured the Node Pointer. Is it because it defaults to 0? But I thought that you had to call the function in order to make a "connection", otherwise the SR lines would be tristated in a sense.

Thank you in advance!

Best regards,
Andrey
0 Likes
chismo
Employee
Employee
First like received
Hello Andrey,

Yes, the receive start event occurs after the first data bit of the word is sampled so data is not yet available in the buffer.
Adding a while loop should work but this is obviously not so optimal, compared to using an event that indicates already the availability of a data in the buffer.

The set interrupt node pointer function effectively configures the control register, specifically RBCTR for the RxFIFO interrupt.
If the function is not explicitly called, the default reset value of RBCTR will be used.
In this case, the default is 0, thus selecting SR0.

Regards,
Min Wei
0 Likes
Not applicable
Hello Min Wei,

Thank you for helping me out on this issue. Everything seems to make sense now!

Best regards,
Andrey
0 Likes