2022-09-29 04:08 AM
I am using HAL_DMA_Start_IT(..) to read data from GPIO that is triggered via a Timer IC. It works the first time, but if I use HAL_DMA_Start_IT(..) again the destination memory is not updated but I get the transfer complete interrupt. If I use a different destination memory address the 2nd time it works. Also if I do a memset() to clear the destination memory, before the 1st transfer, it also does not work. Also placed the destination memory in D2 RAM, but made no difference. Also disabled D-Cache globally that made no difference.
2022-10-20 04:11 AM
Hello & welcome to ST community
Is the number of data items known in advance?
If not, I propose to add DMA timeout.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-10-20 04:23 AM
Hello. Thank you.
Yes the number of items is known. I managed to resolve it by doing the following:
To initiate a DMA transfer I use this: HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
2022-10-20 05:23 AM
How can you disable D-Cache in the linker file ? And shouldn't D-Cache be disabled by default unless you enable it using e.g. SCB_EnableDCache() ?
Also, if you already disabled D-Cache, are you sure it is necessary to invalidate the cache ?
2022-10-20 06:32 AM
I followed the instructions on: DMA is not working on STM32H7 devices replacing DTCMRAM with RAM_D1 in the .data, .bss and .user_heap_stack sections in the linker file. D and I cache is actually enabled with SCB_EnableICache(); and SCB_EnableDCache(); , sorry I did this a while ago and forgot what I have done.
If I do not invalidate the cache, the DMA transfer works only once for the same memory location. Also had to do it in the Ethernet network interface drivers for lwIP for the Ethernet Rx buffer.