Hi HangZhang,
Thanks for your suggestion.
We understand that you didn't reproduce this issue because it is really difficult to reproduce and the error rate is quite small.
1. Check Power and Reset Sequencing: Ensure that the power supply to the SPI Flash and the LPC4337 is stable and that the reset sequence meets the required timing specifications. Variations in power supply or reset timing could cause intermittent issues, especially in cases where marginal boards are affected.
-> When debugging this problem, the first thing we thought of was the stability of the power supply, but when we tested, the reason was not the power supply, we added capacitors but the result didn't change. Furthermore we measured the time from power on to SPI Flash initialization is about 150ms, much longer than the maximum Tpu (Power On Time) ~300us.
2. SPIFI Configuration and Timing: Review the configuration of the SPIFI peripheral, especially concerning timing parameters such as the clock speed, setup, and hold times. Ensure that these parameters are within the operating limits of the SPI Flash memory, particularly after a reset.
-> SPIFI clock is about 1Mhz during SPI Flash configuration, then changed to about 68Mhz for data transmission. Configuration is fine, we check the waveform with oscilloscope and it is normal.
3. Hardware Variations: Since the problem is only seen in some boards, consider the possibility of slight variations in hardware (e.g., differences in component tolerances, PCB layout, or soldering quality) that may contribute to the issue.
-> PCB has no problem, no warping or damage, we also resoldered MCU and SPI Flash but the issue is still there. However when we tried replacing other MCU (still LPC4337) on the board with the read error, the read error disappeared.
4. Delays and Timing Adjustments: As you’ve already discovered, adding a delay seems to mitigate the issue. You might try to pinpoint the minimum required delay to see if it reveals any timing sensitivities. Also, consider if there’s a more deterministic way to ensure the system is ready before performing the SPI Flash read.
-> We tested with various delay times, we found that if the delay was around 3ms then the occasional read error would still appear, a delay greater than 3ms would no longer cause the read error.
Actually, before asking for support from NXP, we have been debugging this problem for a month and had a lot of internal meetings, we think the issue is only on the MCU side, we found that if the RGU triggers a reset signal to any peripheral or block when initializing, the SPIFI will not stabilize the initial timing. Since some zeros are inserted at the beginning and the data is shifted to the right, we think it is related to the SPIFI buffer.
Although this issue can be fixed by replacing another MCU, there is still a chance of error (~2% , ~80/4000 boards have issue), so we want to fix it in software by adding a 100ms delay.
We are wondering if anyone has encountered SPI Flash issue caused by RGU or similar issue like us and is there any solution for this issue?
We want to confirm that adding delay will solve the issue from everyone who has encountered similar issue or from NXP before applying it to our software.
Best regards.