Hi all,
I wanted to know what is the right way to invalidate the FlexSPI cache/RX buffers on an RT600? I am using the UM11147 Rev 1.4 as reference.
Problem:
I am observing that after writing to flash when I dereference the memory mapped address to read back what was written to flash the value returned is the old value.
For example, if the memory mapped 0x8dd000c contains "test", and after disabling write protection, erasing the page, writing "dead" to it and then dereferencing 0x8dd000c still shows "test". However after rebooting and checking the address I see "dead". It also works fine if I use memcpy, but not directly dereferencing the memory mapped address.
What was attempted to fix this problem, and DID NOT work:
To fix this issue, I attempted the following:
- Clearing AHBCR.CACHABLEEN (0x4013400c bit3)
- Clearing AHBCR.PREFETCHEN (0x4013400c bit5)
- Invalidating using CCR (0x40033800 bit 24,25,26,27 and 31), similar to
CACHE64_CleanInvalidateCache in fsl_cache.c
Temporary workaround:
The only fix worked was resetting the AHB controller (setting MCR0.SWRESET or 0x40134000 bit0), but resetting the controller each time I write to flash does not seem like the right solution.
Thanks,
Sid