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.
Hi,
I am testing freertos+lwip on the RM57L843. Cache is enabled. I focus on the cache attribute i.e. Write-through or write-back.
Here the MPU I means the MPU in the core not the NMPU like the thread(I paste the URL in the end) discussed.
I configure the memory area(pbuf) used by the lwip task as the WT to enable the uSCU to keep the cache coherency(for CPU-reading) and enable EMAC DMA get the lastest data(for CPU-writing).
Now I have a question, there are several tasks in my system not just the lwip task, what will happen if the EMAC DMA is writing in-coming package into the memory while a task happened, I mean that the cache policy maybe changed(I am not sure about this, because another task will not specify the memory area used by the lwip(EMAC DMA)) and the the WT+uSCU mechanism maybe failed? or the EMAC DMA will not be affected?
TMS570 DMA MPU violation interrupt - Arm-based microcontrollers forum - Arm-based microcontrollers -...
Hi Eric,
eric said:So If I want to guard memory areas from the EMAC's DMA, I should use NMPU
Yes.
eric said:he MPU in the core will not limit the DMA access (or a non-CPU master), although it runs in the user mode(I don't kwow RM57L, but for RM4x, EMAC's DMA runs in user mode), right?
So when I read the details of the ACP port it's not talking about any interaction with the MPU. It just talks about creating coherency operations on the cache for certain writes. This is applicable to the RM57L.
On the other RM4x there is an AXI-S port to the TCM memory inside the CPU. But the manual for the CPU also doesn't talk about interaction between this port and the MPU. Instead there is a bit in the CP15 coprocessor that can block user mode accesses through this AXI-S port .. but it's not tied to any particular MPU region.
So the way I read these manuals the MPU in the processor is only for the processor not for DMA.
eric said:
Although the MPU in the core will not limit the EMAC's DMA access but it will affect the cache coherency when the EMAC's DMA writing L2SRAM(cache WT or WB is different for uSCU component), right?
This is where that programmer's guide seems to indicate you should always either:
a) perform the cache maintenance explicitly if you are in a context switch that changes the MPU setting.
in this case you'd invalidate the PBUF from the cache in software before removing the MPU region covering them.
-or-
b) keep a second region programmed which makes this area cacheable, but not accessible by the CPU.
this way the pbuf can stay in the cache, but the the task you switch to cannot access them.
This is just my interpretation of the documentation; based on the rules it explains. It's hard to read between the lines and find out if these rules are just stated for good practice & portability across processors as sometimes they are, or if there's really an issue breaking the rules. So I'd suggest just keeping it simple and following the stated rules without trying too hard to understand them. I'd do one or the other from the above (a or b) as described in the programmer's guide.