FlashX driver disables interrupts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FlashX driver disables interrupts

766 Views
janahan
Contributor I
Why does the flashx driver need to disable interrupts during some of its operations like erasing sectors, etc.?
0 Kudos
1 Reply

315 Views
trailman
Contributor V

When a flash is beeing written/erased, it can not be read at the same time.

But to execute some code from a flash, a CPU need to fetch (read) the code from this flash.

So as a result, to erase or write a flash when the code is running from the same flash :

- the small code launching the real erase/write and waiting for completion must be copied to RAM run from RAM. The code jumps from flash to this code in RAM, then returns to flash when done.

- the interrupts must be disabled to prevent an interrupt from branching the CPU to an interrupt handler in flash, and to prevent the task from beeing preempted by another running from flash.