STM32F7: DMA only relieable in first 64k of RAM?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-04 6:08 AM
I just discovered some strange behaviour while working with the STM32F7 discovery: The SD card driver suddenly stopped working, because I added some additional buffers, variables in memory, nothing else. After investigation of the problem it looks to me that the problem was, that the SD DMA buffer moved from memory location 0x2000xxxx to 0x2001xxxx. So I simply used a fix location in memory for the buffer and decided to do some further investigation when I have more time.
Today I had some problems with the ethernet Driver. To my surprise I had a memory overlap because of some #pragma location=0x20002000 for the ethernet dma buffers in ethernetif.c (from the cube)
But after removing the pragma, ethernet did no longer work reliable.All in all it looks to me that there is a bug in the STM32F7...
or am I the only one with that problem? But obvously the cube developers seemed to have it too... anybody else? Thanks for listening Hannes- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-24 4:28 AM
Just had some time to take another look at the problem. And now I am even more confused:
According to the datasheed, the DTCM is mapped to 0x20000000-0x2000FFFF. In my opionien, DMA should not be possible in the DTCM. My experience is, that it is the other way around. Could somebody from ST clearify this? Thanks, Hannes- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-24 5:36 AM
According 2.3 Embedded SRAM from RM0385:
DTCM-RAM on TCM interface (Tightly Coupled Memory interface) mapped at
address 0x2000 0000 and accessible by all AHB masters from AHB bus Matrix but
through a specific AHB slave bus of the CPU.
No wonder that you can DMA at 0x20000000.
Regarding the 0x20010000 boundary, it sound related to the use of SRAM1, but can't tell why DMA cannot access it.
Can you provide a *very* minimal code to be tested on discovery ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-24 6:00 AM
Thank you for the information. Now I know (and clearly see) what the small dotted line inside the CPU core means on the bus matrix schematic...
To reproduce the DMA-below-64k problem, it should be enough to remove the #pragma location / _attribute__ at in the lwIP sample for the F7 Discovery (lwIP_HTTP_Server_Netconn_RTOS - File: ethernetif.c).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-24 6:42 AM
Location pragma or attributes are not there for aesthetic reasons.
You cannot move them randomly, without consequences. A quick look at the code showed me that region below 64K is uncached whereas upper region is cached. That's certainly the reason why a displaced DMA'ed buffer from low to high region is not working properly. DMA work with any part of SRAM. But wen the area is cached you *must* manage the cache to avoid incoherency. Otherwise keep buffer placed in uncached area. If your application grows, and overlaps reserved uncached area, you must reshuffle your data placement. Good luck.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-24 6:56 AM
Great. That is the point: ''Otherwise keep buffer placed in uncached area''
I did not think of this. Thank you very much. Hannes- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-12-14 5:20 AM
Hi,
I had the same problem with the ethernet and I solve it using the ethernetif.c from cube examples.
https://community.st.com/0D50X00009XkaTjSAJ
Now I'm having this problem with QSPI with DMA.
Did you figure out how to solve this without having to keep the buffer in uncached area?
Ari.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-12-20 3:54 AM
Hello,
Maybe the data is stucked in the cache ? it could explain why you have issues with QSPI and Ethernet ...
Kind regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-12-26 3:20 AM
Hello,
When datacache is enabled, it is recommended to pay attention to MPU configuration in order to ensure data coherency.
The
(Level 1 cache on STM32F7 Series) provides tips to efficiently configure MPU. It contains also an example with some suggested solutions that should be helpful depending on the situation and expected behavior.In the particular case when DMA is used, we have following recommendations:
- If the software is using cacheable memory regions for the DMA source/or destination buffers. The software must trigger a cache clean before starting a DMA operation to ensure that all the data are committed to the subsystem memory. After the DMA transfer complete, when reading the data from the peripheral, the software must perform a cache invalidate before reading the DMA updated memory region.
- Always better to use non-cacheable regions for DMA buffers. The software can use the MPU to set up a non-cacheable memory block to use as a shared memory between the CPU and DMA.
-Amel-
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-12-26 4:00 AM
Hi Amel,
Can you show me the code to make all SRAM1 as non-cacheable?
Ari.
