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.

IWR6843AOP: Uart with DMA on mss can only send out data, but can not receive

Part Number: IWR6843AOP

My code could work with no dma mode, but lost one byte some time. So I want to use dma mode to avoid the lost of data.

The new code refer to the example "C:\ti\mmwave_sdk_03_06_00_00-LTS\packages\ti\drivers\uart\test\xwr68xx".

The init code:

    // let uart b work with tx/rx
    extern UART_Config UART_config[];
    UartSci_HwCfg* hwcfg = (UartSci_HwCfg*) UART_config[1].hwAttrs;
    hwcfg->duplexity = UartSci_Duplexity_FULL;
    
#if UART_WIFI_USE_DMA
    DMA_init ();
#endif
    UART_init();
    
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.clockFrequency = gFdMCB.cfg.platformCfg.sysClockFrequency;
    uartParams.baudRate       = gFdMCB.cfg.platformCfg.commandBaudRate;
    uartParams.isPinMuxDone   = 1U;
    uartParams.readTimeout = 50;

#if UART_WIFI_USE_DMA
    DMA_Params      dmaParams;
    DMA_Params_init(&dmaParams);
    DMA_Handle   DMAHandle;
    DMAHandle = DMA_open(1, &dmaParams, &errCode);
    if (DMAHandle == NULL)
    {
        printf ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode);
        log_write_fmt ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode);
        return;
    }

    uartParams.dmaHandle = DMAHandle;
    uartParams.txDMAChannel = 1;
    uartParams.rxDMAChannel = 2;

#endif

    /* Open the wifi UART Instance: */
    UART_Handle uartHandle = UART_open(1, &uartParams);
    if (uartHandle == NULL)
    {
        //System_printf("Error: Unable to open the Wifi UART Instance\n");
        log_write("Error: Unable to open the Wifi UART Instance\n");
        tvt_debugAssert (0);
        return;
    }

I use UART_write and UART_read to tx/rx, and Uart A to write log. So I could see that UART_read always return 0, while my PC could receive data from the 6843.

When disable dma by   

#define UART_WIFI_USE_DMA 0

the code would work fine.

  • Hi,

    Can you please provide a little more context about what you are trying to read in? What is your application? What is your hardware configuration? Have you executed the test code or fully looked through it? I believe there are examples of DMA enabled UART reading and writing. So, the problem is most likely an incorrect hardware configuration or an improper usage of the UART driver within your specific implementation. 

    For another successful example outside of the driver test code, we use two UART handles in our demo applications in the radar toolbox (Out Of Box Demo User Guide). Please reference main.c in the out of the box demo source code.

    Regards,
    Luke