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.

AM2634: UART DMA Receive Callback Reinitialization.

Part Number: AM2634


Tool/software:

Dear Team,

              we have to use UART DMA callback for our application, now we are getting DMA callback interrupt first time only but it is not able to receive the interrupt next time and so on.

we are using uart_echo_dma() example as a reference.

 

After getting callback we have to reinitialize the DMA callback for next msg or Data. but after reinitializing also i'm not getting the DMA callback interrupt  next time, please any one help me to resolve this issue.

DMA receive callback function.

void RxCallback(UART_Handle handle, UART_Transaction *trans)
{
 
            /* Read 8 chars */
        gNumBytesRead = 0U;
        trans->buf   = &gUartReceiveBuffer[0U];
        trans->count = APP_UART_RECEIVE_BUFSIZE;
        UART_Transaction_init(trans);
        CacheP_wbInv((void *)&gUartReceiveBuffer[0U], APP_UART_RECEIVE_BUFSIZE, CacheP_TYPE_ALL);
        transferOKrx = UART_read(gUartHandle[CONFIG_UART_CONSOLE], trans);
        APP_UART_ASSERT_ON_FAILURE(transferOKrx, trans);
}
  

please let me know what is the best way to receive the data for the next time and forever. 

  • Hi Sahil, Apologies for delayed response.

    After getting callback we have to reinitialize the DMA callback for next msg or Data. but after reinitializing also i'm not getting the DMA callback interrupt  next time, please any one help me to resolve this issue.

    Why do you need to reinitialize the DMA again, and also what exactly do you mean by reinitialize?

    Also for callback reference, please look at uart_callback example here: examples\drivers\uart\uart_echo_callback\uart_echo_callback.c

  • Also please refer to syscfg on different modes that are supported:

  • Hi.

    We're using the uart_echo_dma() example as a reference, but it only works once. After reading data one time, it doesn't read the next data. How can we implement it to work continuously in an infinite loop for both TX and RX in DMA mode?

    Additionally, we need to receive variable-length data on UART. Could you guide us on how to implement this, or share any source code if available?

    Is it possible to connect on Teams so I can better explain our requirements for DMA mode?

  • Hi Sahil,

    1. I imported the uart_echo_dma application in CCS.

    2. In the uart_echo_dma.c file, I added a while(1) loop after UART_Transaction_init();

    3. I recompiled the application to make sure the UART module is ready to read data after echoing back the characted. I did not modify any callback related functions or DMA related configs.

    On running the above application I am able to enter 8 character and get back the same on the CCS terminal.

    I have also attached my binary for AM263x-CC and AM263x-LP board. You can try the same.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/908/uart_5F00_echo_5F00_dma_5F00_am263xlp.release.outhttps://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/908/uart_5F00_echo_5F00_dma_5F00_am263xcc.release.out

    Regards,
    Shaunak

  • this is blocking process, it block our rest of the project, we can't wait for UART receive and we have to serve other functionality also, that's way non blocking method is required,

    please let me know which is the first interrupt function executed when UART receive first byte in low level. 

      

  • Hi Rohal,

    this is blocking process, it block our rest of the project, we can't wait for UART receive and we have to serve other functionality also, that's way non blocking method is required,

    Apologies, the original question or replies did not mention the requirement of non-blocking APIs. UART read is supported via Polling (Blocking mode) and Interrupt mode. Interrupt mode further has 2 options: Blocking or Callback. For non-blocking UART transmission/reception, use the Callback Interrupt APIs.

    This documentation contains snippets for Non Blocking UART read and writes: https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/DRIVERS_UART_LLD_PAGE.html

    please let me know which is the first interrupt function executed when UART receive first byte in low level. 

    Interrupt will be triggered based on the Threshold value that is set. For e.g., if I set the Rx Threshold to 4B, then interrupt will be triggered after my FIFO has 4B. Once the transfer is complete, the UART_CallbackFxn that is registered will be called. These are mentioned in the syscfg. If you want the interrupt to be triggered for every byte of the data, set the threshold to 1B.

    Regards,
    Shaunak