This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G1507: UART TX and RX with DMA

Part Number: MSPM0G1507
Other Parts Discussed in Thread: MSPM0G3507, MSPM0G3519

Hi TI Team,

I try to understand the way how it works to send and read from UART with DMA. Also I think FIFO makes sense. My target is to send an array of thousands of measurements (q15 values). The TX buffer works with 8bit, so I have to send every first byte and second byte ( >>8) value of the array. Maybe there is suitable function for this purpose?

  • For a single 8bit transmit I tested the DL_UART_Main_transmitData() which works fine.
  • With FIFO: I tested the DL_UART_Main_fillTXFIFO() which also works if I use a for loop for every 4x8bit packets and suitable delay between the single transmits. Is there a transmit finished flag to read out?
  • With DMA: I couldn't find any function to send it with DMA. Are there any examples to understand the approach?

Regards

  • Check below demo in MSPM0 SDK:

    C:\ti\mspm0_sdk_2_10_00_04\examples\nortos\LP_MSPM0G3507\driverlib\uart_rw_multibyte_fi

    C:\ti\mspm0_sdk_2_10_00_04\examples\nortos\LP_MSPM0G3507\driverlib\uart_rx_multibyte_fifo_dma_interrupts

    C:\ti\mspm0_sdk_2_10_00_04\examples\nortos\LP_MSPM0G3507\driverlib\uart_tx_multibyte_fifo_dma_interrupts

    --------------------

    C:\ti\mspm0_sdk_2_10_00_04\examples\nortos\LP_MSPM0G3519\demos\bq7870x_TIDA010279

    Here is a demo that helps your better understanding the UART Tx/Rx. It's in mspm0_uart.x file

  • Thanks for the information. I have a question about the example "uart_tx_multibyte_fifo_dma_interrupts".

    The DL_UART_MAIN_IIDX_DMA_DONE_TX and the DL_UART_MAIN_IIDX_EOT_DONE should occur to start a new tranfer. What is the difference between these two IRQ? Because if DMA sends the done tx IRQ, the transmission is done...

    And, how can I implement a callback function to the DL_UART_MAIN_IIDX_EOT_DONE IRQ?

  • DL_UART_MAIN_IIDX_DMA_DONE_TX

    DMA transfer done (between DMA/RAM and UART), but UART is still sending the last byte or bytes in FIFO.

    DL_UART_MAIN_IIDX_EOT_DONE

    UART finished sending.

    And, how can I implement a callback function to the DL_UART_MAIN_IIDX_EOT_DONE IRQ?

    Just add your call back function in this case in interrupt is OK....

  • But if I add the callback function in the interrupt, then I have to use only the DL_UART_MAIN_IIDX_EOT_DONE case. Is this OK or is there a reason to check the interrupt DL_UART_MAIN_IIDX_DMA_DONE_TX too?

    Is it still possible to mall a callback function to the interrupt DL_UART_MAIN_IIDX_EOT_DONE ?

  • DL_UART_MAIN_IIDX_EOT_DONE
    DL_UART_MAIN_IIDX_DMA_DONE_TX

    Double check is better, but only check EOT is enough.

    Is it still possible to mall a callback function to the interrupt DL_UART_MAIN_IIDX_EOT_DONE ?

    Yes, you can.

    For example, if you enable UART's 4 bytes FIFO, DMA done will early than EOT for about 4 bytes of transmission time, this is also related to what's the trigger level you set of UART FIFO (will trigger DMA transfer.)

    If you want to test these timing, you can add two IO, toggle IO in UART interrupt to better monitor the timing of these interrupt, also better to capture the UART Tx line, to compare.

**Attention** This is a public forum