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.

TMS570LC43x Help example_sci_dma.c fails

Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

I'm trying the example_sci_dma.c example on an TMS570LC43 LaunchPad.

I followed the step by step settings in HALCoGen, as described in the Help File, and performed flash and linker settings as explained in

processors.wiki.ti.com/.../LAUNCHXL2-570LC43-RM57L:_LinkerECCRecommendation

I cleared out HL_SYS_main.c and copied the content of the examples/example_sci_dma.c in it.

The kept LOOPBACKMODE=1

When running the program, it doesn't copy the data from TX_DATA into RX_DATA

(I'm expecting that after 

while(dmaGetInterruptStatus(DMA_CH1, BTC) != TRUE);

)

and the checkpoint failes when i == 1:

if(RX_DATA[i] != TX_DATA[i])

Program ends with: 

[CortexR5] Fail

HALCoGen 4.05.01

CCS 6.1.1.00022

Compiler TI v5.2.6

 

 

(additional info, may or may not be relevant: the red error flag on the launchpad also turns red as soon as the code is loaded to the launchpad (even with adapted linker file and adjusted flash loader setting as per link above), once you copy over examples/example_sci_dma.c. If you load the project with an empty HL_SYS_main.c file, this doesn't happen. Is there anything in the code that plays with the memory ECC ?)

  • Update

    The part of the example file that generates the memory parity error is:

    if(i<size)
    {
      printf("Fail\n");
    }
    else
    {
      printf("Pass\n");
    }

    if you remove these lines of code, the red ERR led stays off after loading the program to flash. Strange, but not relevant to the example failing :)

    The example also doesn't copy TX into RX without those printf() lines in the code.

  • There could be multiple possibilities that cause the failure. I would suggest to rule out the Flash ECC error first. in your link command file, change "vfill" to "fill" and enable ECC autogeneration in CCS. In this way, all the valid flash addresses will be programmed with correct ECC. It may a few minutes to complete the loading but it will ensure correct ECC for all Flash addresses. We can look into other issue after this step is done.

    Thanks and regards,

    Zhaohong
  • Thank you, . I'm testing this now.

  • The ECC error is gone after I applied your suggested changes to the linker command file and the Flash autogeneration.

    The program now loads to the LaunchPad without getting the ERR led switching on.

    However, the DMA example doesn't  load data from the transmit to receive buffer.

    After this line:

    while(dmaGetInterruptStatus(DMA_CH1, BTC) != TRUE);


    RX_DATA array still contains all 0x00 values.

    I've uploaded a zipped archive of my project.

    0741.TMS570LC43_example_sci_dma.zip

  • I took a quick look at your project. I did not see SCI is configured to generate DMA request. It seems that Halcogen does not support DMA. I think that the discussion in the following thread would provide you with useful information

    e2e.ti.com/.../312286

    Thanks and regards,

    Zhaohong
  • Would it be worth it to adapt or discard the step-by-step example in the HALCoGen help file of TMS570LC43x in that case?
    That's typically the first thing you try when testing a feature.
    Maybe no example in the help file is better than one that doesn't work?

    Regards, Jan

  • hello, I have the same problem with the version RM57 as well!
    hope you can resoult this problem so i can testing with my version of launchpad!
  • I do not see DMA support on TMS570LC4357 in Halcogen. You can use the example I sent earlier as reference. I have also passed your question to the Halcogen team.

    Thanks and regards,

    Zhaohong
  • Hi,


    HALCoGen has DMA support, but it does not provide a GUI configuratioon like other drivers. It generates the DMA driver code along with other drivers.

    After reading your query, I think the issue is with the cache. Can you rerun your code with cache disabled?

    Since the TX_DATA is filled after the cache is enabled (configured as write back), the data resides only in the cache. And hence DMA copies the the old data from the buffer (which I believe is all zeros). I think this is the reason you don't find the correct data in the RX_DATA buffer.

    As a workaround I suggest you to move the TX_DATA and RX_DATA buffers to the non-cache RAM region

    Hope this helps!


    Thanks and Regards,

    Veena
  • You are right. The example works with cache disabled (I just generally disabled it for this exercise by putting this as the main line of code in main():

    	_cacheDisable_();

    It may be good to adapt the HALCoGen example "example_sci_dma.c" in a future halcogen release.

  • I fine-tuned the solution by making a similar SHAREDRAM section as in HALCoGen example example_mibspiDma.c

    In that help file there's a detailed instruction on how to  force write back for the memory locations that receive DMA data for that example.

  • To synchronize with DMA, you need to set up cache as "write through". The default in Halcogen is "write back".

    Thanks and regards,

    Zhaohong

  • I've created a small how-to on the E2E Launch Your Design group: