Post Go back to editing

Do I need to call adi_uart_DMARead() for every new frame in UART DMA MODE?

Category: Software
Product Number: ADSP-SC594
Software Version: CrossCore Embedded Studio 2.10.1/EV-SC59x_EZ-KIT-Rel1.0.0

In my application, I am using a UART port accessible through a USB port (P3 connector, on EV-SC594-SOM rev.C) to communicate with a PC. I am trying to use DMA mode.
My application is running on the Cortex-A5 core.
I used the example of UARTDMAMode. The PC sends 4 characters in one frame. The first frame is received correctly. However, each subsequent frame is
is not received. This is despite the fact that the DMACallback function reports each frame received. Interestingly, when I call the adi_uart_DMARead()
from the DMACallback function, the data is correctly received. (Normally the adi_uart_DMARead function is called only once to initiate a DMA transfer,
which should operate continuously from now on)


The same solution on the SHARC0 core works fine though.

It looks like the problem lies somewhere in the DMA UART driver.

Initialization code:

    ADI_PDMA_MODE  ePDMAMode = ADI_PDMA_DESCRIPTOR_LIST;
    ADI_UART_RESULT DMA_res;

    bool Edb0 = 1u;
    uint32_t Divisor = 1085;

    if(adi_uart_Open(    UART_DEVICE_NUM,
                        ADI_UART_DIR_BIDIRECTION,
                        gUARTMemory,
                        ADI_UART_BIDIR_MEMORY_SIZE,
                        &ghUART))
    {
        REPORT_ERROR("Could not open UART Device \n");
    }

    if(adi_uart_ConfigBaudRate(ghUART, Edb0, Divisor))
    {
        REPORT_ERROR("Could not open UART Device Baud rate \n");
    }

    if(adi_uart_RegisterCallback(ghUART, UART_Callback, NULL))
    {
        REPORT_ERROR("Could not register UART Callback \n");
    }

    /* Buffer Start Address */
    iDESC_LIST_1_UART0.pStartAddr = &uartRxBuffer[0];
    iDESC_LIST_1_UART0.Config     = ENUM_DMA_CFG_XCNT_INT;
    iDESC_LIST_1_UART0.XCount     = UART_RX_BUFFER_SIZE;
    iDESC_LIST_1_UART0.XModify    = 1;
    iDESC_LIST_1_UART0.YCount      = 0;
    iDESC_LIST_1_UART0.YModify      = 0;
    iDESC_LIST_1_UART0.pNxtDscp   = NULL;

    DMA_res = adi_uart_DMARead(ghUART, &iDESC_LIST_1_UART0, 1, ePDMAMode);
    if (DMA_res != ADI_UART_SUCCESS)
    {
        printf("init:err!!!\n\r");
    }

Callback function:

static void UART_Callback(void *pCBParam, uint32_t nEvent, void *pArg)
{
    ADI_PDMA_MODE  ePDMAMode = ADI_PDMA_DESCRIPTOR_LIST;
    ADI_UART_RESULT DMA_res;

    /* CASEOF (event type) */
    switch (nEvent)
    {
        /* CASE (buffer processed) */
        case ADI_UART_EVENT_RX_PROCESSED:

            DMA_res = adi_uart_DMARead(ghUART, &iDESC_LIST_1_UART0, 1, ePDMAMode);
            break;

        case ADI_UART_EVENT_TX_PROCESSED:
            tx_transfered_bit = true;
            break;
    }
}