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.

MCU-PLUS-SDK-AM243X: How to use 2 Different UDMA instances at the same time

Part Number: MCU-PLUS-SDK-AM243X

Tool/software:

Currently my set up is we have 1 UDMA Instance for the OSPI that use UDMA_INST_ID_BCDMA_0 and I want to add another udma instance for the uart, namely UDMA_INST_ID_PKTDMA_0.

But the second "Udma_chOpen()" is failed because the "drvHandleInt->drvInitDone" is not done yet. If I debug this function, it runs to "Udma_chPair()" and return fail.

So I test it on the uart dma echo example on the Evaluation Module and observed that if I add another instance to the code (by add it in example.syscfg):

/* UDMA driver instance object */
Udma_DrvObject          gUdmaDrvObj[CONFIG_UDMA_NUM_INSTANCES];
/* UDMA driver instance init params */
static Udma_InitPrms    gUdmaInitPrms[CONFIG_UDMA_NUM_INSTANCES] =
{
    {
        .instId             = UDMA_INST_ID_PKTDMA_0,
        .skipGlobalEventReg = FALSE,
        .virtToPhyFxn       = Udma_defaultVirtToPhyFxn,
        .phyToVirtFxn       = Udma_defaultPhyToVirtFxn,
    },
    {
        .instId             = UDMA_INST_ID_BCDMA_0,
        .skipGlobalEventReg = FALSE,
        .virtToPhyFxn       = Udma_defaultVirtToPhyFxn,
        .phyToVirtFxn       = Udma_defaultPhyToVirtFxn,
    },
};

CONFIG_UDMA_NUM_INSTANCES also increased to 2. But the FW also stopped at "UART_udmaInitRxCh()" in "Udma_chOpen()" just like in my app above without actually using the 2nd udma yet.
So my question is how could I use 2 instance at the same time, specially 1 for Ospi and 1 for uart (with pdma).
Is it possible to use it that way?
  • Hello Khoa le,

    I am looking at your queries and you may get reply in one or two days .

    Regards,

    Anil.

  • Just for update, It worked once i separate the UDMA object (i.e. UDMA0 for Uart and UDMA1 for OSPI).

    is it mean only 1 udma is allowed to be used for 1 peripheral?

    In my case I want to use the more than 2 peripherals with udma (ospi, uart, cpsw and might be some more), what options do i have?

    The tests that i examined:

    +uart dma echo example, than enable ospi udma on udma0 -> not work (possibly conflict between uart and ospi udma?)

    +uart dma echo example, than enable ospi udma on udma1 -> work (does not stuckt at UART_udmaInitRxCh())

    +enet_l2_cpsw_switch example, than enable uart (using the same CONFIG_UDMA_PKTDMA_0 as cpsw), OSPI (BCDMA_0 on UDMA0) -> not work (stuckt at UART_udmaInitRxCh())

    +enet_l2_cpsw_switch example, than enable uart (using the same CONFIG_UDMA_PKTDMA_0 as cpsw), OSPI (BCDMA_0 on UDMA1) -> not work (stuckt at UART_udmaInitRxCh())

  • Hello Khoa le,

    There are two DMA modules. One is DMSS (Data movement subsystem) and PDMA.

    PDMA is mostly used to transfer data in between from peripherals to destination memory with the PKTDMA and DMSS is used to transfer data in between memories with BCDMA channels.

    From system cfg, you can enable both BCDMA and PKTDMA.

    From the BCDMA you can allocate many channels and there are no issues.

    And, coming to PKTDMA, you can only enable the PDMA + PKTDMA config and, along with that only it can be allocated one channel and remaining channels, you need to do manually.

    I can raise bugs on this issue.

    Now, temporarily you can fix issues like below.

    BCDMA Channels : 

    1.  Enabled UDMA + BCDMA 

    2. Configure many channels from system cfg 

    PKTDMA Channels : 

    1. Enabled UDMA + PKTDMA 

    2. In your use case CPSW uses PKTDMA, so the UDMA object files are defined in the CPSW example, and you don't need to configure them again.

    Now, you need to enable PKTDMA for UART . In this you need to do manual UDMA objectives config for both TX and RX channels.

    For this, simply reuse the UDMA objectives same generated file from the UART DMA example 

    Regards,

    Anil.

  • Hi, Thanks for the reply.

    As far as I understand (I rephrase my understanding after your explaination):

    1/There are 2 UDMA modules, each of them could behave either as a DMSS (works with BCDMA config) or as PDMA (with PKTDMA config).

    2/In each Configuration (BCDMA or PKTDMA), there are several channels (depends on which DMA), that could then be used to move data (or it is only available in BCDMA???).

    But I see that the PDMA0 or 1 are only limited to certain peripherals (like descriptions in page 6118 of SPRUIM2G – MAY 2020 – REVISED JULY 2023):

    So this means if my device use UART0 (only PDMA0 available) and UART2 (only PDMA1), then I would have to use 2 PDMAs, as a result I then have to use 2 UDMAs for 2 UARTs. and other BCDMA required communications are then off the table?

    3/ Currently under PKTDMA, there are no option to add channels. This does not mean in PKTDMA only 1  channel available but it is just a bug and I need to manually add the configurations from uart?

    Which configurations do you mean in this case?

    As I observed, i just need to enable the DMA mode and UMDA object under UART peripheral, then the generated files from example.syscfg already contain the uart dma object already. But this still stopped at UART_udmaInitRxCh() (just like mentioned above).

  • So this means if my device use UART0 (only PDMA0 available) and UART2 (only PDMA1), then I would have to use 2 PDMAs, as a result I then have to use 2 UDMAs for 2 UARTs. and other BCDMA required communications are then off the table?

    On the SOC there are two PDMAs and those are fixed.

    You don't need to bother about how many PDMA s there are. On each PDMA there are different peripherals supported.

    So, users need to configure channel numbers for each peripheral.

    For example, you need to enable DMA for UART0.

    In this case, Tx and RX (2) channel numbers should be configured properly with the one PKTDMA instant 

    3/ Currently under PKTDMA, there are no option to add channels. This does not mean in PKTDMA only 1  channel available but it is just a bug and I need to manually add the configurations from uart?

    Yes, this is a software bug. To add more PKTDAM channels, you need to do it manually.

    In your use case , CPSW is already using two channels for PKTDMA and for the UART + DMA you need to do it manually. Y

    1/There are 2 UDMA modules, each of them could behave either as a DMSS (works with BCDMA config) or as PDMA (with PKTDMA config).

    Yes, your understanding is correct.

    2/In each Configuration (BCDMA or PKTDMA), there are several channels (depends on which DMA), that could then be used to move data (or it is only available in BCDMA???).

    Yes, your understanding is correct. On BCDMA or PKTDMA there are different channels. We need to allocate separate channels for each peripheral 

    Can you please tell me what are the peripherals needs the DMA  and which version of MCU+SDK you are using?

    So, I can try to create an example in that try to add 2BCDMA and 2PKTDAM channels allocation.

    If you need more channels, then you have to do it similar way.

    Regards,

    Anil.

  • Hi,

    currently I need: CPSW (PKTDMA), OSPI(BCDMA), SA2UL(PKTDMA) and UART(PKTDMA).

    Thanks

  • Hello Khoa le,

    I can try to create an example for OSPI(BCDMA), SA2UL(PKTDMA) and UART(PKTDMA).

    And, you need to do same for adding more PKTDMA channels .

    Regards,

    Anil.

  • Hi,

    Thanks I will try it when the example is available.

    Regards

    Khoa

  • Hi Anil,

    is there problem with the examples?

    Regards,

    Khoa

  • Hello Khoa,

    Sorry for the delayed reply.

    Please find the attached file and I have created 3 UART's with 1 PKTDMA and 1 BCDMA channel allocation and did not face any issues.

    Here, the idea is that we need to enable BCDMA and PKDTDMA instants and in  these instances  we can create more channels .

    So, I have enabled 1 PKTDMA and 1 BCDMA instances.

    Next, for each peripheral, we need to send the same instant but with the different channels.

    Currently, when we are configuring uart with more PKTDMA channels, the uart_dma open function is making an error.

    TI generated code is supposed to point at the same PKTDMA instantly, but it is pointing to a different PKTDMA instant due to this, we are having issues while opening channels. I have fixed this issue temporarily and I will raise the bug internally to fix it in the next release.

    For your use case , you need to follow the steps below.

    Currently, you need: CPSW (PKTDMA), OSPI(BCDMA), SA2UL(PKTDMA) and UART(PKTDMA) applications.

    We need 1 BCDMA and 1 PKTDMA instants.

    Steps : 

    1. Under the PKTDMA you need to allocate different channels.

    Now, in the above examples, the CPSW module is a big one, so take this example.

     Already PKTDMA instant is initialized by the CPSW driver and TX and RX channels are also allocated from the system cfg.

    2. Next, enable the BCDMA module for OSPI and see how OSPI DMA is used in the SBL. Similar steps you need to follow  in the example.

    3. Next, you need the SA2UL for this. You just enable crypto modules, and now you can integrate code as we have done in the SA2UL example.

    4. For UART, you don't need to enable PKTDMA from the system cfg and just configure UART DMA as enabled from the system cfg.

    Please follow the above steps if you still face the issue and share your integrated code. So, that I can work on it.

    uart_echo_dma_am64x-evm_r5fss0-0_nortos_ti-arm-clang.zip

    Regards,

    Anil.

  • Hi Anil,

    could you please try once more on the AM243x EVM board?

    I tried to replicated your example on my am243x evm but it is still faced the same issue:

    [MAIN_Cortex_R5_0_0] ASSERT: 0.5602s: uart/v0/dma/udma/uart_dma_udma.c:UART_udmaInitRxCh:129: UDMA_SOK == retVal failed !!!

    (The project files are below).

    What i have tested:

    1/ I  tried to replicated your example on the sdk 08.06.00.42 (mcu_plus_sdk_am243x_08_06_00_43), the same issue appeared.

    2/ I see the sdk that you use is 9.xxx, so i repeated with this sdk (mcu_plus_sdk_am243x_09_02_00_50), the same issue shown.

    sdk_09_02_00_50_uart_echo_dma_am243x-evm_r5fss0-0_nortos_ti-arm-clang.zip

    3/ I compared the directory of your am64 evm and mine, which shown that there are no different (except Share memory configuration and AM64 cores).

    4/ I think it might be possible that i accidentally changed something in the sdk somwhere. So I tried again with a newly downloaded SDK (mcu_plus_sdk_am243x_08_06_00_45). Nothing chaged, the same issue appeared.

    5/ I guess might be the SDK 9.xx would be better, so i tested it again on newer sdk (mcu_plus_sdk_am243x_09_02_01_05), But again it failed at the same place.

    sdk_09_02_01_05_uart_echo_dma_am243x-evm_r5fss0-0_nortos_ti-arm-clang.zip

    In both test the the sdk 9.xx I have added:

    #include <drivers/uart/v0/lld/dma/udma/uart_dma_udma.h>
    extern UART_UdmaChConfig gUartUdmaChConfig[CONFIG_UART_NUM_DMA_INSTANCES];

    and

    gUartUdmaChConfig[1U].drvHandle = &gUdmaDrvObj[0];
    gUartUdmaChConfig[2U].drvHandle = &gUdmaDrvObj[0];

    For similarity between the two folders.

    I also check the example project that you gave me, which shows that the 3 uart instances use only PKTDMAs  from udma0, not 1 PKTDMA and 1 BCDMA? Is it another example?

  • Hello Khoa,

    I can provide  reply by EOD or tomorrow morning as I am on training today.

    I have verified at my side and with the above project did not face any udma_driver_open issues .

    I need to check one more time and get back to you.

    Regards,

    Anil.

  • Hello Khoa,

    Can you please look at the image below ?

    So, there is no problem while loading the 3 UART's with one PKTDMA+ one BCDMA  example at my test setup.

    I have tested on AM64X and this is the same as AM243 devices.

    I also check the example project that you gave me, which shows that the 3 uart instances use only PKTDMAs  from udma0, not 1 PKTDMA and 1 BCDMA? Is it another example?

    As I mentioned above, we need to enable one BCDMA and one PKTDMA instant .

    Under this instant we can create many channels.

    So, currently, I did enable one PKTDMA instant, after that, I have enabled 3 channels.

    Can you please confirm you initialized SOC with 09.02 binaries before loading  above 09.02 version example ?

    Since, except resource allocations, there are no issues when you load the above example from CCS.

    So, just try to flash the SOC with the 09.02 version binaries  and see if you are able to load it or not .

    Regards,

    Anil.

  • Hi Anil,

    Now when I import example EVM projects (uart echo dma and udma adc) from the library, the udma is stopped at the init like above.

    Even after I delete the sdk 8.6.0.43 and 9.2.0.50 and reinstall it from CCS (Resource Explorer), none works.

    So it is strange now, as I recalled last time when I do test, it should work when I import the evm project to the ide.

    I will try on another pc later today.

    Regards,

    Khoa

  • Hello Khoa,

    Please let me know results once you have done testing .

    Regards,

    Anil.