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: 4 UARTs with DMA, UART_udmaInitRxCh fails

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: SYSCONFIG

Hello,
I try to use 4 UARTs on AM243x and enable DMA for all of them. For some preliminary tests I just modified the uart_echo_dma example.

Following UARTs should be used:
USART1
USART2
USART3
USART4

I added all of them into sysconfig and activated DMA Mode for transfer mode. Running the application Drivers_open() then tries to open all 4 UARTs. However, for last UART (USART4) it fails.

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



If I delete a UART e.g. USART3 the code works again. So, for me it rather seems to be a problem with the number of USARTs than with one particular USART.

My question is can 4 UARTs with DMA be used together/parallel or is there any restriction?

What can I do to overcome this error? As far as I see the error seems to occur in Udma_chAllocResource() (returns -5), which calls Udma_rmAllocRxCh(). There rmInitPrms->numRxCh is set to 3. This setting/limit seems to originate from Udma_rmGetSciclientDefaultBoardCfgRmRange(), so this is a hard limit for the board/I cannot use 4 DMA channels?


Here the relevant part of sysconfig:
/**
 * Write custom configuration values to the imported modules.
 */
uart1.$name        = "CONFIG_UART_CONSOLE";
uart1.intrEnable   = "DMA";
uart1.operMode     = "13X";
uart1.baudRate     = 921600;
uart1.UART.$assign = "USART1";

uart2.$name        = "CONFIG_UART2";
uart2.intrEnable   = "DMA";
uart2.baudRate     = 921600;
uart2.operMode     = "13X";
uart2.UART.$assign = "USART2";

uart3.$name        = "CONFIG_UART3";
uart3.operMode     = "13X";
uart3.baudRate     = 921600;
uart3.intrEnable   = "DMA";
uart3.UART.$assign = "USART3";

uart4.$name        = "CONFIG_UART4";
uart4.baudRate     = 921600;
uart4.operMode     = "13X";
uart4.intrEnable   = "DMA";
uart4.UART.$assign = "USART4";

udma1.$name      = "CONFIG_UDMA0";
uart1.udmaDriver = udma1;
uart2.udmaDriver = udma1;
uart3.udmaDriver = udma1;
uart4.udmaDriver = udma1;
udma1.instance   = "PKTDMA_0";

  • Hi ,

    Can you answer the following queries -

    1. If you enable all the 4 UART, does it work ?

    2. If you use USART3 without DMA, does it work ?

    Do you have a SDK project that we can use to replicate the issue ? Hoping that you are using 08.05 release of SDK.

    Best Regards,
    Aakash

  • Hi Aakash Kedia,

    1. If you enable all the 4 UART, does it work ?

    No it does not work. Initialization fails.

    2. If you use USART3 without DMA, does it work ?

    Yes, then initialization is OK

    Do you have a SDK project that we can use to replicate the issue ?

    all you would need to do is add 4 UARTs e.g. USART1, USART2, USART3 and USART4 to sysconfig and then select DMA for all of them.

    here the complete sysconfig:

    /**
     * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
     * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
     * @cliArgs --device "AM243x_ALX_beta" --package "ALX" --part "ALX" --context "r5fss0-0" --product "MCU_PLUS_SDK_AM243x@08.05.00"
     * @versions {"tool":"1.14.0+2667"}
     */
    
    /**
     * Import the modules used in this configuration.
     */
    const uart       = scripting.addModule("/drivers/uart/uart", {}, false);
    const uart1      = uart.addInstance();
    const uart2      = uart.addInstance();
    const uart3      = uart.addInstance();
    const uart4      = uart.addInstance();
    const udma       = scripting.addModule("/drivers/udma/udma", {}, false);
    const udma1      = udma.addInstance();
    const debug_log  = scripting.addModule("/kernel/dpl/debug_log");
    const mpu_armv7  = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
    const mpu_armv71 = mpu_armv7.addInstance();
    const mpu_armv72 = mpu_armv7.addInstance();
    const mpu_armv73 = mpu_armv7.addInstance();
    const mpu_armv74 = mpu_armv7.addInstance();
    const mpu_armv75 = mpu_armv7.addInstance();
    
    /**
     * Write custom configuration values to the imported modules.
     */
    uart1.$name        = "CONFIG_UART_CONSOLE";
    uart1.intrEnable   = "DMA";
    uart1.operMode     = "13X";
    uart1.baudRate     = 921600;
    uart1.UART.$assign = "USART1";
    
    uart2.$name        = "CONFIG_UART2";
    uart2.intrEnable   = "DMA";
    uart2.baudRate     = 921600;
    uart2.operMode     = "13X";
    uart2.UART.$assign = "USART2";
    
    uart3.baudRate     = 921600;
    uart3.operMode     = "13X";
    uart3.$name        = "CONFIG_UART3";
    uart3.intrEnable   = "DMA";
    uart3.UART.$assign = "USART3";
    
    uart4.$name        = "CONFIG_UART4";
    uart4.operMode     = "13X";
    uart4.baudRate     = 921600;
    uart4.intrEnable   = "DMA";
    uart4.UART.$assign = "USART4";
    
    udma1.$name      = "CONFIG_UDMA0";
    uart1.udmaDriver = udma1;
    uart2.udmaDriver = udma1;
    uart4.udmaDriver = udma1;
    uart3.udmaDriver = udma1;
    udma1.instance   = "PKTDMA_0";
    
    mpu_armv71.$name             = "CONFIG_MPU_REGION0";
    mpu_armv71.size              = 31;
    mpu_armv71.attributes        = "Device";
    mpu_armv71.accessPermissions = "Supervisor RD+WR, User RD";
    mpu_armv71.allowExecute      = false;
    
    mpu_armv72.$name             = "CONFIG_MPU_REGION1";
    mpu_armv72.size              = 15;
    mpu_armv72.accessPermissions = "Supervisor RD+WR, User RD";
    
    mpu_armv73.$name             = "CONFIG_MPU_REGION2";
    mpu_armv73.baseAddr          = 0x41010000;
    mpu_armv73.size              = 15;
    mpu_armv73.accessPermissions = "Supervisor RD+WR, User RD";
    
    mpu_armv74.$name             = "CONFIG_MPU_REGION3";
    mpu_armv74.baseAddr          = 0x70000000;
    mpu_armv74.size              = 21;
    mpu_armv74.accessPermissions = "Supervisor RD+WR, User RD";
    
    mpu_armv75.$name             = "CONFIG_MPU_REGION4";
    mpu_armv75.baseAddr          = 0x60000000;
    mpu_armv75.size              = 28;
    mpu_armv75.accessPermissions = "Supervisor RD, User RD";
    
    /**
     * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
     * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
     * re-solve from scratch.
     */
    uart1.UART.RXD.$suggestSolution = "ball.B12";
    uart1.UART.TXD.$suggestSolution = "ball.A12";
    uart2.UART.RXD.$suggestSolution = "ball.R21";
    uart2.UART.TXD.$suggestSolution = "ball.R20";
    uart3.UART.RXD.$suggestSolution = "ball.V21";
    uart3.UART.TXD.$suggestSolution = "ball.U21";
    uart4.UART.RXD.$suggestSolution = "ball.T18";
    uart4.UART.TXD.$suggestSolution = "ball.U19";
    

    If this doesn't work for you here the complete project. As I said there are no changes in source code, I just modified sysconfig and I am talking about generated initalization functions ...

    uart_echo_dma_am243x-lp_r5fss0-0_nortos_ti-arm-clang.zip

  • Hi Dominik,

    This limitation is because the number of PKTDMA channels allocated to this core are restricted to 3 in Sciclient default RM Configuration. In the upcoming AM243x release planned for next week, we have added support for board configuration tool which would help you to make updates to the default Resource configuration and increase the number of channels allocated to this core.

    Do let me know if you are okay to wait for the next release, or else I can help you edit the default configuration manually.

    Regards,

    Ashwin

  • Hi Ashwin,

    I am okay with the fixes in an upcoming release, if this is planned for next week. However, if you already have the solution ready to hand out I will appreciate if you can provide it (especially if release is not next week)

  • There hasn't been a release of the MCU+ SDK for AM243x till now

    Can you please advice me how to edit the default configuration manually.

  • Hi Dominik,

    MCU+ SDK Release for AM243x is planned for today and it has the resource configuration tool update.

    Apologies for the delay.

    Regards,

    Ashwin

  • I tested 8.6.0 but I do not know how to increase the number of channels allocated to the used core.

    Can you please give me some advice, where to find board configuration tool and how to do the adjustments?

  • Hi Dominik,

    Please refer to the Developer guide section in AM243x SDK User Manual on "Modifying Resource Allocation" to update the default resource allocation.

    Regards,

    Ashwin