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.

Stellaris LM4F232: mapping uDMA to UART does not work?

Hi

Modify udma_demo to the following: UART6 as TX and UART7 as RX. Map uDMA channel 11 for Tx, and channel 20 for Rx. But nothing happens. What's wrong?

Below is the Tx portion:

    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART7);
    ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART7);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
    GPIOPinConfigure(GPIO_PK4_U7RX);
    GPIOPinConfigure(GPIO_PK5_U7TX);
    GPIOPinTypeUART(GPIO_PORTK_BASE, GPIO_PIN_4 | GPIO_PIN_5);

    ROM_UARTConfigSetExpClk(UART7_BASE, ROM_SysCtlClockGet(), UART_TEST_RATE,    //115200,
                            UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                            UART_CONFIG_PAR_NONE);

    ROM_UARTFIFOLevelSet(UART7_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8);

    ROM_UARTEnable(UART7_BASE);
    ROM_uDMAChannelAssign(UDMA_CH20_UART7RX);
    ROM_UARTDMAEnable(UART7_BASE, UART_DMA_RX);

    ROM_IntEnable(INT_UART7);

    ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_TMR1A,    //_UART0RX,
                                    UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST |
                                    UDMA_ATTR_HIGH_PRIORITY |
                                    UDMA_ATTR_REQMASK);

    ROM_uDMAChannelControlSet(UDMA_CHANNEL_TMR1A | UDMA_PRI_SELECT,
                              UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 |
                              UDMA_ARB_4);

    ROM_uDMAChannelControlSet(UDMA_CHANNEL_TMR1A | UDMA_ALT_SELECT,
                              UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 |
                              UDMA_ARB_4);

    ROM_uDMAChannelTransferSet(UDMA_CHANNEL_TMR1A | UDMA_PRI_SELECT,
                               UDMA_MODE_PINGPONG,
                               (void *)(UART7_BASE + UART_O_DR),
                               g_ucRxBufA, sizeof(g_ucRxBufA));

    ROM_uDMAChannelTransferSet(UDMA_CHANNEL_TMR1A | UDMA_ALT_SELECT,
                               UDMA_MODE_PINGPONG,
                               (void *)(UART7_BASE + UART_O_DR),
                               g_ucRxBufB, sizeof(g_ucRxBufB));

Thanks!

  • Hailin,

    I've looked over your code and I have a few questions.  You mentioned in your question that you wish to use UART6 for TX, but I do not see any mention of UART6 in your code.  Is this correct?  I also see that in the uDMAChannel functions, you are operating on the Timer1A channel.  Should be UDMA_CHANNEL_UART7TX?

    Thanks,

    Sean

  • Yes. I did the similar modification to the UART6 code. Also created both UART6 and UART7 interrupt handlers.

    There is no UDMA_CHANNEL_UART7TX. I believe that TMR1A is the same uDMA channel number as UART7TX.

    -Hailin

  • Hailin,

    You are correct -- they use the same channel.  I have talked with the employee that wrote the API and he said that you should use UDMA_CH20_UART7RX in place of UDMA_CHANNEL_UART0RX in all uDMA functions.  Likewise with UDMA_CH11_UART6TX for UDMA_CHANNEL_UART0TX.  So, after everything is configured, you should add this (if you have not already):

    ROM_uDMAChannelEnable(UDMA_CH20_UART7RX);
    ROM_uDMAChannelEnable(UDMA_CH11_UART6TX);

    We have filed an issue to get this clarified in the documentation.  If adding that code does not work, please send the entire block of UART6 and UART7 code.  The next step is to enable interrupts and make sure that they are getting triggered correctly.

    Thanks,

    Sean

  • Hi

    UDMA_CH20_UART7RX and UDMA_CH20_UART6TX are bit special and meant for uDMAChannelAssign(). They are not supposed to be used in function uDMAChannelEnable(). Here is the channel enable function and it takes the channel number as input. My driver version is 8555.

    void
    uDMAChannelEnable(unsigned long ulChannelNum)
    {
        //
        // Check the arguments.
        //
        ASSERT((ulChannelNum & 0xffff) < 32);

        //
        // Set the bit for this channel in the enable set register.
        //
        HWREG(UDMA_ENASET) = 1 << (ulChannelNum & 0x1f);
    }

    I have managed to get the UART6 as loopback and UART7 as receiver working. Will try UART6 TX alone with UART7 RX to see where the issue is.

        ROM_uDMAChannelEnable(UDMA_CHANNEL_TMR1A);    // UART7 RX

        ROM_uDMAChannelEnable(UDMA_CHANNEL_SSI0RX);    // UART6 RX
        ROM_uDMAChannelEnable(UDMA_CHANNEL_SSI0TX);    // UART6 TX

    Thank you for your reply.

  • Hailin,

    The author of the API said that UDMA_CH20_UART7RX and UDMA_CH20_UART6TX should work with all functions, even uDMAChannelEnable.  The value of UDMA_CH20_UART7RX is set to 0x00020014.  It is safe to use with the uDMAChannelEnable function because the upper bits are masked.

    Sean

  • You are correct, as to UDMA_CH20_UART7RX. Thanks.

  • hi

    cant we use uart 7 rx pin... with out using UDMA_CH20_UART7RX

  • Yes. You can use it as UART RX pin, associating it with DMA or not. You can also use it as a GPIO pin.