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.

Compiler/PROCESSOR-SDK-AM437X: NIMU example with UART DMA

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: SYSBIOS, AM4376

Tool/software: TI C/C++ Compiler

My project need communicate with serial port and network port at the same time. so I try add the uart function into NIMU example. but if I enable the uart dma, the nimu can not start up  normally.

The specific steps are as follows:

1. compile the NIMU_BasicExample_skAM437x_armExampleproject example, confirm that the network protocol stack is normal running. pinging IP address is OK.and we can see the imformation about the protocol stackstartup and negotiation process from the debug port.

2. GNU compiler Directories add:

    ${PDK_INSTALL_PATH}ories add,  ${EDMA3LLD_BIOS6_INSTALLDIR}/packages, ${CG_TOOL_INCLUDE_PATH}

3. GNU compiler Symbols add:

   BUILDCFG_MOD_UART, UART_V1, UART_DMA_ENABLE

4. nimu_skam437x.cfg add:

 var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

var drv          = xdc.loadPackage ("ti.sdo.edma3.drv");
 var rm          = xdc.loadPackage ("ti.sdo.edma3.rm");

Hwi.dispatcherSwiSupport = true;
Hwi.dispatcherTaskSupport = true;
Hwi.dispatcherAutoNestingSupport = true;
Hwi.initStackFlag = false;
Hwi.checkStackFlag = false;

/* Force peripheral section to be NON cacheable strongly-ordered memory */
var peripheralAttrs = {
    type : Mmu.FirstLevelDesc_SECTION, // SECTION descriptor
    tex: 0,
    bufferable : false,                // bufferable
    cacheable  : false,                // cacheable
    shareable  : false,                // shareable
    noexecute  : true,                 // not executable
};
/* Define the base address of the 1 Meg page the peripheral resides in. */
var peripheralBaseAddr = 0x44DF2800;
/* Configure the corresponding MMU page descriptor accordingly */
Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                          peripheralBaseAddr,
                          peripheralAttrs);
                         
var peripheralBaseAddr = 0x44e0b000;
/* Configure the corresponding MMU page descriptor accordingly */
Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                          peripheralBaseAddr,
                          peripheralAttrs);                         
                         
/* Define the base address of the 1 Meg page the peripheral resides in. */
var peripheralBaseAddr = 0x49000000;
/* Configure the corresponding MMU page descriptor accordingly */
Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
                          peripheralBaseAddr,
                          peripheralAttrs);
UART.Settings.useDma = "true";
and then, compiling, it's pass.
but when running the program, nothing from debug port, and it cannot ping.
if delete the UART.Settings.useDma = "true" from .cfg file, the program run normally again.  IP address is OK also.
can the uart dma not be used in the nimu? or I lost something?
processor_sdk_rtos_am437x_6_01_00_08, Code Composer Studio Version: 9.1.0.00010. AM4376.
  • Hi Bin,

    By default, the NIMU example is not using EDMA for UART. In order to add the EDMA for UART, you will need to make necessary changes to the NIMU example. You can refer to the UART example under pdk_am437x_1_0_16\packages\ti\drv\uart\example or pdk_am437x_1_0_16\packages\ti\drv\uart\test. There should be some example for  UART with EDMA.

    Ming

  • Hi Ming,

    I just refer to the example you mentioned: C:\ti\pdk_am437x_1_0_16\packages\ti\drv\uart\test\am437x\armv7\bios\UART_BasicExample_dma_evmAM437x_armTestProject.txt, the project of which is created by pdkProjectCreate.bat.

    and this is its result : if  adding UART.Settings.useDma = "true" in .cfg file, the program can not run normally.

    In addition, the compilation about it is supplemented as follows:

            need to add the files in it project path:    sample_am437x_arm_int_reg.c, sample_am437x_cfg.c, sample_arm_cs.c, sample_arm_init.c.

  • Hi Bin,

    That is strange, the UART DMA example should have set useDMA to true in CFG file already. 

    I will look in to this example for AM437x and get back to you.

    Ming

  • Hi Ming,

    if setting useDMA to true in CFG file in the nimu project. the nimu program can not run correctlly.

  • Hi Bin,

    I am a little bit confused by the following statements:

    >>I just refer to the example you mentioned: C:\ti\pdk_am437x_1_0_16\packages\ti\drv\uart\test\am437x\armv7\bios\UART_BasicExample_dma_evmAM437x_armTestProject.txt, the project of which is created by pdkProjectCreate.bat.

    >>and this is its result : if  adding UART.Settings.useDma = "true" in .cfg file, the program can not run normally.

    >>In addition, the compilation about it is supplemented as follows:

    >>        need to add the files in it project path:    sample_am437x_arm_int_reg.c, sample_am437x_cfg.c, sample_arm_cs.c, sample_arm_init.c.

    I did the same steps for the evmAM437x for the UART DMA test example. The example built fine and the  UART.Settings.useDma = "true" in .cfg file was set already. Because I do not have a evmAM437x at hand, so I cannot test it.

    Does this example work for you or not? If not, we need look into it, because it means the UART with DMA has problem, then the NIMU example will not work. If this example works, then we need to focus on how the UART with DMA is set up in NIMU  example.

    Ming

  • Hi,

    the example UART_BasicExample_dma_evmAM437x_armTestProject is OK. and I've tested different UART ports, its are all right.

    the problem is that I want to implement the function of UART DMA in the NIMU example, so I migrated the code of UART DMA into NIMU example, the compiling of migrated code is ok, but it run abnormally.  

  • Hi Bin,

    I did some research on the UART DMA support. It is not jus simply add the edma driver and set the useDma to true. There are whole bunch code need to be added. The most important one is UartApp_edmaInit(). Please refer to the pdk_am437x_1_0_16\packages\ti\drv\uart\test\src\main_uart_test.c code sections enabled by UART_DMA_ENABLE. You have to make the same changes in your NIMU example.

    Ming

  • Hi Ming,

    Yes, I did. On the TOP:

    3. GNU compiler Symbols add:

       BUILDCFG_MOD_UART, UART_V1, UART_DMA_ENABLE

  • Hi Bin,

    Just define the UART_DMA_ENABLE is not enough, you will need to look what has been done in pdk_am437x_1_0_16\packages\ti\drv\uart\test\src\main_uart_test.c specially the code sections enabled by the UART_DMA_ENABLE, such as  function UartApp_edmaInit() and where it get called. You need to do the same for your NIMU code.

    Ming 

  • Hi Ming,

    I had added all the codes you mentioned before, but when I found that the network was not working properly, I deleted them. It turns out that network is not right if  the UART.Settings.useDma = "true" in .cfg file. 

  • Hi Bin,

    The only other thing I can think of is that the UART DMA and NIMU/NDK are using the same edma which may cause conflict.

    Ming

  • Hi Ming,

    That means I can't implement UART DMA in the NIMU?

  • Hi Bin,

    I meant that you may want to look into the emda channels used for UART DMA and NIMU/NDK DMA are not conflict.

    Ming

  • Hi Ming,

    do you have any design documents about the edma implement of UART DMA and NIMU/NDK DMA?

  • Hi Bin,

    I do not have the design documents you asked, but the NIMU example code should have the edma3 settings for NIMU/NDK DMA.

    Ming