SPRUJD3A July 2025 – October 2025 F28E120SB , F28E120SC
FILE: uart_ex4_loopback_dma.c
This program uses the internal loopback test mode of the UART module. Two DMA interrupts and both of the UART FIFOs are used. Both DMA channels are configured to transfer BUFFER_SIZE words with each burst being UART_BUFFER_SIZE words. The configurations for the UART module and both DMA modules are done in the Sysconfig file.
Note: Only the lower 8 bits of each word will be transmitted and received by the UART since the UART data register only has an 8 bit data field.
When the UART transmit FIFO has enough space (UART_BUFFER_SIZE bytes empty), the TX DMA will transfer data from the txData buffer in GSRAM memory into the transmit FIFO by writing to the UART data register. The data in the transmit FIFO will then be transmitted to the receive FIFO via the internal loopback.
When enough data has been placed in the receive FIFO (UART_BUFFER_SIZE data bytes full), the RX DMA will transfer the data from the receive FIFO into the rxData buffer in GSRAM memory by reading the UART data register.
When BUFFER_SIZE words have been placed into rxData, a check of the validity of the data will be performed and the errCount variable will indicate the amount of data mismatches between txData and rxData.
Running the Application
Set BUFFER_SIZE to desired words of data to transfer. This value must be even numbered. Set UART_BUFFER_SIZE to 2, 4, 8, 12 or 14. This value must divide evenly into the chosen BUFFER_SIZE. Change "Burst Size" and "Transfer Size" settings in Sysconfig (for both myDMA0 and myDMA1) to reflect these values. Burst Size = UART_BUFFER_SIZE Transfer Size = BUFFER_SIZE / UART_BUFFER_SIZE
To use 32-bit words instead of 16-bit words, change:
NOTE: This example implements the UART FIFO Buffers in NON fine-grained mode
External Connections (Optional)
Watch Variables