XMC1000/4000 TIP of the day: Filling up USIC TXFIFO based on Standard Transmit Buffer

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

cross mob
chismo
Employee
Employee
First like received
Each USIC module provides a 64-dataword FIFO buffer, that can be allocated to the channels of the same USIC module.
If the data set to be transmitted is more than the available transmit FIFO (TXFIFO), the Standard Transmit Buffer Interrupt (STBI) event can be used to facilitate the filling up of the FIFO.
STBI is triggered when the fill level of the TXFIFO falls below a programmed limit.

Take for example, the following use case:
- Allocated TXFIFO = 32 words
- Data set to be transmitted = 128 words
In this case, the TXFIFO can be filled 4 times with the STBI service routine, each time with 32 words.
In between interrupts, the CPU is free to perform other functions.

The TXFIFO and STBI can be initialized as follows using DAVE4's XMC Lib:

/* Initialize TXFIFO: */
/* - Channel = XMC_SPI0_CH1 */
/* - Data pointer = Word 0 */
/* - TXFIFO size = 32 words */
/* - Limit = 1 */
XMC_USIC_CH_TXFIFO_Configure(XMC_SPI0_CH1, 0, XMC_USIC_CH_FIFO_SIZE_32WORDS, 1);
/* Enable standard transmit buffer event for interrupt generation. */
XMC_USIC_CH_TXFIFO_EnableEvent(XMC_SPI0_CH1, XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD);


The application flow will be:
1) Trigger manually the first STBI interrupt.
2) In the STBI service routine, fill the TXFIFO with the first 32 words before exiting the routine.
3) After the last word has been loaded from TXFIFO to TBUF, i.e. fill level transmit away from 1 to 0, the STBI will be triggered.
4) Similarly, fill the TXFIO with the next 32 words in the service routine.
5) After the last 32 words are written on the 4th interrupt entry, the interrupt generation can be disabled.
0 Likes
0 Replies