I am developing a product based on I.MX RT1170 from NXP, which requires an external NOR Flash connected to its FlexSPI interface.This way,the NOR Flash is mapped to the CPU's memory. Subsequently, the program can run in the NOR Flash.
Due to project requirements, I need to use memory starting from 0x60C00000 to store some data, and I need to erase about 1M of memory.However, after erasing this memory, the program freezes after a while, and sometimes it directly resets.
The program doesn't freeze during the Flash erasure process. Instead, it usually occurs after calling my erase function (erasing 1M in size) and running some simple code afterward, such as printing "Hello, world." The likelihood of the program freezing in this scenario is minimal. However, if more complex code, similar to LwIP, is executed subsequently, the program is more likely to freeze.
Here is a brief description based on my implementation:
- the size of the program I wrote is less than 0xC00000
- I disable interrupts before executing the Flash erase functions.
- If the program is executing in NOR Flash, the Flash erase functions cannot be placed in NOR Flash. This would lead to errors in Flash. Therefore, we typically link Flash functions to RAM. However, I am using the ROM API (which executes the chip's built-in ROM BootLoader from Flash after power-up, providing Flash APIs), ensuring there are no conflicts as mentioned earlier. I also attempted to implement Flash erase functions myself and link those files to RAM, but the issue of program freezing persisted.
- The same Flash erase code works fine on two other products using the RT1170 chip (same Flash model and connection).
Additionally, if I link the program to run in RAM, there are no issues. So, I suspect that erasing the Flash is causing an error when the subsequent chip tries to fetch code from NOR Flash.So this seems to be a hardware issue, but I haven't made any changes to the NOR Flash circuitry, and the rest of the system has no issues before I perform the Flash erase.
I am completely puzzled by this problem.Could you provide me with some ideas?