Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxp: mcux: flexspi: flash write interrupted by XIP #83231

Closed
Finomnis opened this issue Dec 19, 2024 · 0 comments · Fixed by #83233
Closed

nxp: mcux: flexspi: flash write interrupted by XIP #83231

Finomnis opened this issue Dec 19, 2024 · 0 comments · Fixed by #83233
Assignees
Labels
area: Flash bug The issue is a bug, or the PR is fixing a bug platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP

Comments

@Finomnis
Copy link
Contributor

Describe the bug

Our MCU is an MIMXRT1176; we have a MT25QU01GBBB flash on our system.

We realized our FlexSPI write is sometimes slow, sometimes causes incorrect 0xFF regions and sometimes crashes the entire system.

When analyzing our Flash with a Logic Analyzer, we encountered the following:

Bild (1)

Explanation:

  • We sadly could only probe SCK, SS and DATA0. Therefore we cannot see all data. That said, there is enough data to see the problem.
  • It starts with a 0x21 command, which is a "4k sector erase command".
  • After that, the intended behavior is that it continuously queries if the command finished, by running 0x05. Note that the response to this command comes on DATA1, so we cannot see it. But it should take several milliseconds, so it should finish way in the future.
  • During this entire procedure, interrupts are disabled to prevent other functions that require XIP from running. This is indeed the case, we verified that the 'disable interrupts' function really runs.
  • Now the real problem: There are 0x6c (read) commands in between, which do not get completed, though. They get interrupted by the 0x05 (check state) commands.

Issuing read commands while a previous erase/program command is unfinished puts the entire flash into undefined behavior and must be avoided at any cost, which the Zephyr team is probably already aware, as interrupts already get deactivated during this time and the function itself is already moved to ITCM. However, it seems that some detail was missed.

To Reproduce
Sadly hard to reproduce on official boards. It should be quite obvious when probed with a logic analyzer, but the official 1176-EVK/EVKB boards do not expose those pins (to my knowledge).

Expected behavior
No XIP commands should run while Flash Writes happen.

Impact
Random crashes, lost data, decreased performance, general system stability problems

Environment:

  • Zephyr upstream (4.0.99)
  • Windows 11 / Ubuntu 24.04 (reproduced on both)
  • Our custom board + BSP, sadly not publishable
    • Based on MIMXRT1176 MCU + MT25QU01GBBB Flash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash bug The issue is a bug, or the PR is fixing a bug platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants