2025-06-12 11:27 AM - edited 2025-06-15 11:20 PM
Hello,
I use an external flash in memory mapping mode and I have a strange problem. The application is executed from the internal RAM, while the checksum is calculated on the data from the external flash (simple summing of successive bytes in a loop). Interestingly, sometimes I get an incorrect result, i.e. the sum is a bit smaller, e.g. instead of 3233257 it is 3233225 as if one byte had not been counted. Interestingly, later the program jumps to the application that is executed from the external flash and it works normally (does not crash). I tried to turn off D-Cache but it does not help. Since the program from the flash executes correctly, I assume that it is not a problem with the memory configuration. What could it be?
EDIT:
BR
Artur
2025-06-16 3:46 AM
Hello @Artur5;
Thank you for sharing the issue and your investigation.
It seems that reducing the XSPI clock frequency from 200MHz to 160MHz solves the problem. However, I still do not understand why the program executes correctly from flash.
The maximum frequency of XSPI depends on several factors, including: memory characteristics, the specific STM32 devices used, OCTOSPI pins, the operating modes (SDR, DTR, HyperBus), the system clock, the OCTOSPI kernel clock... Each of these factors can significantly impact the achievable maximum frequency.
The user should refer to the datasheets of both the STM32 and the memory to find the maximum OCTOSPI frequency and the conditions required to achieve this frequency.
Thank you.
Kaouthar
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.
2025-06-16 6:24 AM
Hi. Thanks for your reply. I am using the STM32N6570-DK discovery board as mentioned. Is it designed to work with a 200MHz XSPI clock?
Artur
2025-06-16 7:20 AM - edited 2025-06-16 7:21 AM
Hello @Artur5 ,
The STM32N6570-DK discovery board designed to support maximum frequency.
I'm asking about the software, the software must ensure that SSHIFT = 0 when the data phase is configured in DTR mode (when DDTR = 1), GPIOs is configured very high-speed.
Are you starting from an XSPI examples or XSPI templates?
May be these examples can help you.
Thank you.
Kaouthar
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.
2025-06-16 7:36 AM - edited 2025-06-16 7:55 AM
I use ExtMem Manager to configure memory. As I wrote above, the problem is only when calculating the checksum in FSBL and it is always an error in the same byte. When calculating the checksum, the next bytes from Flash are added (about 300kB). Later, the code starts executing from Flash (XiP). I have not noticed that the application has ever crashed. This is strange to me. I also see a changed byte when I stop the application under the debugger. It happens more often when the board is disconnected from the power supply for a moment.