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: Issuing Adding SPI with DMA to the Ethernet/IP example

Part Number: MCU-PLUS-SDK-AM243X

Hi all,

I am trying to add SPI with DMA to the "ethernetip_adapter_generic_device_mii_demo_am243x-lp_r5fss0-0_freertos_ti-arm-clang" example.

I add SPI in the syscfg and copy "mcspi_loopback_dma.c" form the SPI example:

I'd like to use DMA mode and callback mode. However, when DMA is included, the program is trapped in

when initializing. The functions called before entering this handler are:

CMN_OS_init ();

      System_init();

          Udma_init();

               retVal = Udma_eventRegister 

                   Udma_eventConfig()

                      HwiP_construct(&eventHandle->hwiObject, &hwiPrms); (udma_event.c line:1075)

Actually, including DMA (packet) alone would cause the problem, even without SPI.

Checking "Skip global event registration" in UDMA setting would make is problem happen later in the main task:

EI_APP_TASK_main()

  CUST_DRIVERS_init(&pAppInstance->config.customDrivers);

    Drivers_open();

      Drivers_i2cOpen();

         I2C_open(instCnt, &gI2cParams[instCnt]);

            AddrTranslateP_getLocalAddr(hwAttrs->baseAddr);

              DebugP_assertNoLog(gAddrTranslateConfig.numRegions<AddrTranslateP_MAX_REGIONS);

Any idea what's the cause of this problem? 

Thanks,

Hang.

  • Hi Hang,

    Have you tested the DMA+Callback mode in mcspi_loopback_dma example?

  • Hi QJ and Hang,

    I am encountering the very similar problem.

    I have tested the DMA+Callback mode in mcspi_loopback_dma example and it behaves as follows:

    the first time you load the program,the counsole will show "[MCSPI] Loopback example DMA mode started ...".

    the second time without touching any one of the switchs(MCU_PORz,MCU_RESETz,SoC_RESET_REQz),the counsole will show"ASSERT: 0.3654s: mcspi/v0/dma/udma/mcspi_dma_udma.c:MCSPI_udmaInitTxCh:351: UDMA_SOK == retVal failed !!!".The program is trapped in

    However,if you trigger one of the switches and load the program again,the counsole will show like the first time.

    so,whether the phenomenon is normal?

  • Hi Wang,

    Yes, me and my customer has tested this example with DMA and Callback

  • Hi Hang,

    Can you share your working CCS project of DMA + callback mode in mcspi_loopback_dma example?

  • Hi Wang,

    Sure. Note that there are some minor modifications in the TX and RX loop.

    link: https://tidrive.ext.ti.com/u/nVwrBaFcKziPXCsS/a30eb931-06f4-41e1-b10b-3f8fed178983?l

    passward: 4EME\c9R

    Meanwhile, allow me to share the EIP example here as well in case you want to reproduce my problem. If you debug this project, you will find it stuck at initiation and never reaches the main task.

    link: https://tidrive.ext.ti.com/u/q1iuLpdYrhK5WK45/e317bd44-6af4-42a3-b320-e05f03aea769?l

    password: nLyYy2|6

    Thanks,

    Hang.

  • Thanks Hang for sharing the projects.

  • From your code, you don't call the mcspi_loopback_dma function in the EI_APP_TASK_main(). If DMA is used, the memory shared by DMA and CPU should be configured as non-cacheable or cacheable with write-through.

  • Hi Wang,

    Thank you for the information. I have not added the loopback function yet, since the program trapped in initialization, which is in CMN_OS_init() and is even before EI_APP_TASK_main() is created. I think the program never reaches the return of CMN_OS_init(), because the break point set at the next line of CMN_OS_init() is never triggered. 

    Is it possible to reproduce the problem using the project I shared? You may also reproduce the problem by simply adding SPI with DMA and callback(you may use blank call back function) in the syscfg to the EIP example.

    Thanks,

    Hang.

  • Hi Hang,

    I did a test this morning. Yes, I can reproduce the issue. I will spend some time tomorrow to debug it.  

  • Hi Hang,

    I am sorry for late response. I missed it since the thread was locked. 

    Now, I don't have the solution for DMA with callback in McSPI example.