This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Concurrently using XIP and QSPI to read back data from external flash

Dear Nordic,

I have a 4MB external flash on my board, I've successfully run the code on it by using XIP. However, I got stuck when I was trying to read back data from external flash. The following picture has the call stack trace. It's a failure of NRFX_ASSERT.

Some more details:

Using nrfx driver both in bootloader and application is not a good idea, because the driver status is stored in the different RAM area. I add a fake initialization function for QSPI to keep the peripheral status consistent. Do you have any better ideas?

Best Regards,

Eugene

  • Well, you can't execute code from XiP whenever the QSPI driver in internal flash tries to R/W to external flash. What you need to do is to prevent the CPU from returning to code in XiP. You can make the calls to the QSPI driver blocking calls, that does not return until the QSPI operation is complete. In that way you should be safe. 

    If the IRQ for the QSPI is in internal flash you wont have any problems with interrupts of higher priority as the CPU will return to the internal flash to finish proccessing the IRQ or driver before returning to XiP. 

  • haakonsh said:
    If the IRQ for the QSPI is in internal flash you wont have any problems with interrupts of higher priority as the CPU will return to the internal flash to finish proccessing the IRQ or driver before returning to XiP. 

     Sorry, I don't understand why it is safe without disabling all interrupts, QSPI interrupt occurs when DMA transfer is finished, but when it is transferring, if some interrupt comes, for example, Systick, the Systick interrupt handler is in the external flash, then MCU crashes.

    As per my understanding, we have to use block send for QSPI and disable all interrupts during data transfer. Does it make sense?

  • If we disable all the interrupts, then we cannot deal with user BLE callback...

  • It is my understanding that no IRQ handler will work in XiP memory, regardless of whether you're using the QSPI driver or not. You will need to place all IRQ handlers in internal flash. 

Related