AM2434: DMA Custom Driver - Descriptor Creation Guide

Part Number: AM2434

Tool/software:

Hello,

I was trying to make my own driver for the DMA to be as generic as possible as I found the one found in the SDK too abstract for me.
I followed the steps I found in the SDK documentation. And now I'm stuck at the point where I should make the descriptor. There's no steps or any guidance regarding making the descriptor before using the Udma_ringQueueRaw to push it to the ring buffer. I'm using SDK with the version 10.01.00.32. 

I also found that internal API: (inside uart_dma_udma.c)

static void UART_udmaHpdInit(Udma_ChHandle chHandle, uint8_t *pHpdMem, const void *destBuf, uint32_t length)


I'm not really sure if I should make it global and use it in my code right away.
So, I need a step-by-step guidance of what to do after initializing and enabling the DMA channel.
Thank you in advance.
Best Regards.
  • Hello Hatem,

    May I know why you are going with customer DMA driver implementation ?

    In the attached e2e, I have already provided to poll whether the DMA transaction is completed or not.

    Is this not working ?

    Regards,

    Anil.

  • Alright here is my whole case. I'm working with the sample project "uart_ech_dma_lld_am243x-evm_r5fss0-0_nortos_ti-arm-clang".
    I want the UART to work with the DMA with no interrupts at all. The sample project enables two types of interrupts (UART INT) and (DMA INT).

    First, I tried to disable the UART interrupt, but the example stopped working and I'm not sure why.
    Then, I have the DMA interrupt that I'm not sure where its callback is, but you already told me how to stop by commenting the registering lines. Your answer then was really helpful and I'm actually trying it right now by the way.

    Also, what I'm doing requires clean isolated drivers. I'm using the Low-Level UART+DMA APIs, but I want to build a separate DMA and a separate UART drivers to be as generic as possible. I already followed the steps I found in the SDK documentation in the following path:
    mcu_plus_sdk_am243x_10_01_00_32_docs_only/docs/api_guide_am243x/DRIVERS_UDMA_PAGE

    I reached the step where the DMA is initialized but as I said I can't find any lead about making the descriptor other than the internal function I mentioned.

    So, to conclude:

    1. As I asked before, I don't want any interrupts. But whenever I try to turn off UART interrupt the whole thing stops working (if you have any lead why this happens).

    2. In case I want to make that generic DMA driver, is there a guide how to make a descriptor?

    3. Where's the DMA Callback function in case I want to add some code to it? I only found that it registers to a local EventHandler but I don't know where's the callback function itself.

  • Hello Hatem,

    If you need the UART in polling mode, run the example below.

    I am not sure which is the example you ran UART in polling mode.

    2. In case I want to make that generic DMA driver, is there a guide how to make a descriptor?

    If you follow my instructions above, you should get the UART DMA to work in polling mode.

    Here, on the sysg side, you need to use the same as the UART DMA config and don't change anything in the ysscfg.

    Where's the DMA Callback function in case I want to add some code to it? I only found that it registers to a local EventHandler but I don't know where's the callback function itself.

     Please look at the example below on how to register callbacks for the DMA UART.

    Regards,

    Anil.

  • Polling Mode in the documentation means that it's blocking and I don't want it in blocking mode.

    and by the way, I tried to comment the part where it registers the event but the whole thing is not working.
    I'm working with the example uart_echo_dma_lld.



    that's the line I commented that made the whole process to not work and debugging it is not possible as the debugger stops in the setup for no obvious reason.

    I'm not sure if the Non-Blocking Polling Mode - which is totally manual polling - is even supported by this board.

    So, thanks for your help. I hope there's a solution that I'm not aware of though.

  • Polling Mode in the documentation means that it's blocking and I don't want it in blocking mode.

    Hello Hatem,

    Please look at the example below and this polling means we are not enabling UART interrupts and not the blocking mode.

    Blocking Mode means different. Block mode means we enable an interrupt for the UART and the UART driver will transfer the bytes, and it will wait for the semaphore signal. Then the task will be blocked until the semaphore signal. Once the signal is received from the ISR routine, the task is resumed.

    So, blocking mode and polling modes are different.

    C:\ti\mcu_plus_sdk_am64x_11_00_00_15\examples\drivers\uart\uart_echo_low_latency_polling

    Next, with my suggestions about DMA polling, what are the changes you made?

    Did you compile the drivers and Application or not after making my suggestions above?

    What was the exact issue ?

    If you share all the steps properly, I can try to help you and whatever method I shared, this is again purely polling mode, which means we are not enabling DMA interrupts.

    ...

    Regards,

    Anil.

  • Hi, Anil.

    I did compile the drivers and application after making the suggested changes, but the code stops working for some reason.
    Now, I just decided to use the low-level driver APIs like UART_lld_dmaInit, UART_lld_writeDma, etc.

    The steps I made to disable the DMA interrupt was as following:
    1. In the file: "drivers\uart\v0\lld\dma\udma\uart_dma_udma.c", I commented the following lines:

        // eventHandle = udmaChCfg->cqRxEvtHandle;
        // UdmaEventPrms_init(&eventPrms);
        // eventPrms.eventType         = UDMA_EVENT_TYPE_DMA_COMPLETION;
        // eventPrms.eventMode         = UDMA_EVENT_MODE_SHARED;
        // eventPrms.chHandle          = rxChHandle;
        // eventPrms.controllerEventHandle = Udma_eventGetGlobalHandle(drvHandle);
        // eventPrms.eventCb           = &UART_udmaIsrRx;
        // eventPrms.appData           = (void *) hUart;
        // retVal = Udma_eventRegister(drvHandle, eventHandle, &eventPrms);
        // DebugP_assert(UDMA_SOK == retVal);

    In both functions: 
    UART_udmaInitTxCh, UART_udmaInitRxCh

    2. I compiled the libraries using the command: gmake -s libs PROFILE=debug

    3. I tried again, but the code is not working, and by "Not Working" I mean that nothing prints on terminal. My guess is that the DMA transactions need to be concluded using the API: Udma_ringDequeueRaw, and UART_lld_Transaction_deInit.

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    The example "uart_echo_low_latency_polling" is fine, but it's not using the DMA.
    So, at the moment I decided to just leave the callback function empty. So, thanks for your help.

    My question is: If the method to disable the UDMA interrupt is the one I did before, how to disable the UART interrupts if I'm using the same "UART_lld_dmaInit" API? I found that I need to pass the callback functions to the Init parameters, and it fails if I left them empty.


    I hope my informations and questions are clear enough and sorry for any frustration I caused you.