Hi everyone,
When I perform a flash write operation on the KM34Z256 MCU before initializing interrupt-driven peripherals, the operation works correctly. However, if the peripherals are running, the MCU enters the fault handler.
To resolve this, I disabled all interrupts before the flash write operation and re-enabled them afterward. Although this prevents the MCU from entering the fault handler, it causes the peripherals (ADC, timer interrupts) to malfunction.
Could you please provide guidance on how to perform a flash write operation without disrupting the functioning of the interrupt-driven peripherals?
Hi,
As you know that the KM34Z256 has only one flash module, when you are operating the flash for example erasing/programming flash, the code to operate flash must be located at RAM and execute from RAM, secondly, you can not execute any code in flash, if you put the vector table in flash and put the ISR in flash, you have to disable interrupt, after the flash operating complete, enable interrupt.
If you want to enable interrupt while you operate flash, the interrupt vector table must be copied to RAM and modify the Vector Table Offset Register, thirdly, you have to put all ISR in RAM by copying the ISR from flash to RAM.
Hope it can help you
BR
XiangJun Rong