Hi!
In my application I have a periodic timer interrupt at ~1 kHz (see Channel 0, M2).
Some of the user data is stored in Flash. To store the data, I basically call:
FLASH_VerifyErase(..., data_page, ...) // Channel 2, before and after M0
FLASH_Erase(..., data_page, ...) // Channel 2, M0
FLASH_Program(..., data_page, data, ...) // Channel 2, M1
The timing can be seen in the appended Logic Pro capture.
The code that is timed on Channel 0 runs in Interrupt context, Channel 2 on normal execution context.
It seems like Erase and Program internally disable interrupts, since the timer interrupt only just starts to execute after the Flash operations are finished. (The timing is measured with GPIO. It appears that Channel 0 executes during the FLASH_Erase call at +2 ms. This is due to the interrupt being scheduled right between the end of FLASH_Erase and GPIO_set_high call. Same is true for FLASH_Program at 3.5 ms.)
Is my assumption true, that interrupts are disabled by the FLASH API calls? I could not find any documentation on this.
I know that it is recommended to disable interrupts during Flash erase/write operations anyway. However, I actively want to decide against it, since I only change some user data in the Flash and not program code.
Hello,
Recommend disable interrupt before operate flash (erase/program), Even though interrupt has on effect with flash in your code.
When the user application code starts executing, the interrupt vectors from the SRAM are active. Before making any IAP call, disable the interrupts. The IAP code does not use or disable interrupts.
BR
Alice