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.

TMS570LC4357: DMA transfer on MIBSPI keeps sending the same data even if source data has been modified

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

I am using DMA to transfer 1024 bytes out using MIBSPI2 inside a FreeRTOS task.

I specified a global variable ScreenBuffer that I can use to change the data contents and then call the function that will setup the DMA to initiate the transfer.

When the DMA gets executed, it properly transfers the original contents of ScreenBuffer.

When the task modifies the ScreenBuffer contents and then execute the DMA transfer, the DMA keeps on sending the original initialized data.  Inserting a breakpoint prior to the DMA call shows that ScreenBuffer contents are updated/modified.

  • Hi Nino,

    I believe the reason must be the cache settings. If you are using HALCoGen, it configures the entire SRAM to be cacheable with WriteBack. So any writes to the SRAM are actually written to cache and not in SRAM. When DMA tries to fetch the data, it reads the old data because the new data in only in cache.

    In case you need to use SRAM for multiple bus masters, I recommend you to create a memory region which is non-cacheable and shareable and use this region for shared memories. Or you can still enable cache but configure it as Write-Through memory. This makes any writes to be written to cache and to the original location.Another way is to disable the cache at the core

    Thanks and Regards,

    Veena

  • I have already specified the MPU region setting in HalCOGen with no luck previously.

    So, I checked out the FreeRTOS code further and found out that when a task is created it will set the all regions to cacheable as you have indicated. So now, I tried to create a task using xTaskCreateRestricted and specified the buffer I want to update as well as use DMA with it. I've use the region attribute of (portMPU_NORMAL_OINC_SHARED|portMPU_PRIV_RW_USER_RW_NOEXEC).

    This works now.

    Thanks.

    -Niño