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.

The uDMA (with UART TX) does not trigger interrupt when completing

Hello,

Using TI-RTOS, I configure the UART0 of the TIVA TM4C123G LaunchPad to send and receive characters to and from the computer hyper-terminal. I also configure the uDMA (with TivaWare) to feed the UART TX register. The mechanism properly works, but the uDMA does not trigger an interrupt on completion. This mechanism is worthless to my application without the interrupt. Does someone can help me to figure this out?

I read that the uDMA interrupt must be configured through the associated peripheral. See my configuration below. Note that TI-RTOS enables the peripherals and allocates the uDMA control table.

    #define COMPUTER_DMA_CHANNEL    UDMA_CH9_UART0TX
    #define COMPUTER_UART_REGISTER  UART0_DR_R

    //Configure DMA
    uDMAChannelAttributeDisable(COMPUTER_DMA_CHANNEL, UDMA_ATTR_ALL);
    uDMAChannelControlSet(COMPUTER_DMA_CHANNEL | UDMA_PRI_SELECT,
                          UDMA_SIZE_8 |
                          UDMA_SRC_INC_8 |
                          UDMA_DST_INC_NONE |
                          UDMA_ARB_1);
    uDMAChannelAssign(COMPUTER_DMA_CHANNEL);

    //Configure UART
    UART_Params_init(&uartParams);
    uartParams.writeMode = UART_MODE_CALLBACK;
    uartParams.readMode = UART_MODE_CALLBACK;
    uartParams.writeDataMode = UART_DATA_TEXT;
    uartParams.readDataMode = UART_DATA_TEXT;
    uartParams.writeCallback = uart_tx_computer_cb;
    uartParams.readCallback = uart_rx_computer_cb;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_ON;
    obj.computer.uart_h = UART_open(Board_UART, &uartParams);
    UARTDMAEnable(UART0_BASE, UART_DMA_TX);
    UART_read(obj.computer.uart_h, &uart_input, 1);

    //Trigger the uDMA transfer
    uDMAChannelTransferSet(COMPUTER_DMA_CHANNEL | UDMA_PRI_SELECT,
                               UDMA_MODE_BASIC,
                               string,
                               (void*)&COMPUTER_UART_REGISTER,
                               size);
    uDMAChannelEnable(COMPUTER_DMA_CHANNEL);

I would greatly appreciate if someone can help me.

Regards,

  • Simon,

    The uDMA controller generates an interrupt on the UART's interrupt vector. This means that the UART's ISR (e.g. Hwi) needs to know how to handle the DMA generated interrupts. When  you call UART_open(), it installs a Hwi (ISR) at the UART's interrupt vector for you, which, at this time, which doesn't support DMA transfers.

    If you need to use a DMA-based transfer, you should probably refer to some TivaWare UART DMA reference examples. Afterwards, you can cross-reference the SPITivaDMA driver implementation with the UARTTiva driver implementation to see what changes would be needed to get DMA supported for the UART driver. (The SPITivaDMA driver is in TI-RTOS 1.10.00.23)

    We've seen several other people asking for DMA based UART driver, but these requests need to go through the proper channels (no pun intended :P ). I'd suggest for you to contact your FAE to have him/her request to get this feature added to TI-RTOS.

  • Hi Tom,

    As the UART driver does not support the DMA transfers, I'm going to drop the DMA mechanism and use the UART driver in callback mode or to use the TivaWare UART driver instead (if possible).

    I want to use TI-RTOS for its USB, FILE SYSTEM and SDSPI drivers. Even if TI-RTOS provides a UART driver, can I disable it and use the TivaWare UART driver instead?

    Thank you for your support.

  • Simon Boucher said:

    Even if TI-RTOS provides a UART driver, can I disable it and use the TivaWare UART driver instead?

    Yes. It uses exactly those APIs. We try to make TI-RTOS drivers easier to use and thread-safe for RTOS environments, but we can't cover all use cases.

    If you plan use a UART controller in just one context (e.g. one task), then you shouldn't have any problems in accessing the UART registers. When it comes to the uDMA however; we also consider it to be a shared peripheral. This means that we assume that other Tasks/Swis/Hwis may want to use other remaining uDMA channels. If that's that case in your system, you will need to add some protection around the uDMA APIs.

    We will add DMA support for the UART driver when we get a high demand for it (hence the suggestion to contact your FAE).

  • Thanks again. Unfortunately, we do not have a dedicated FAE to make this kind of request...