I'm using MKV11 (arm m0+) and I have some interrupts( like CAN_IRQ ecc). I decided to split the flash memory in two section and the bootloader decides to jump on the first or on the second.
During the update procedure on the main application I need to erase and write the internal flash and for doing it I have to disable and the re-enable globally the interrupts.
After the disable and re-enable procedure , the CAN IRQ does not working and it is in disable mode.
I tried to write only 16 byte and wait 3 ms in each write to allow the CAN IRQ can work but sometimes does not work the same.
When I disable and re-enable globally the interrupt I have to be fast ( my operation has not be last more than ...) or I'm working in a bad mode ???
On the examble below I try to write 512 bytes in block of 16 bytes each.
During each write I disable and re-enable globally the interrupts .
while(IndexBuffer < BL_PAYLOAD_SIZE)
{
DisableGlobalIRQ();
stat_tmp = FLASH_Program(&driver_flash_int_state, AddrWr,(uint32_t *)&PayLoadBuffer[IndexBuffer], 16);
EnableGlobalIRQ;
if (kStatus_FLASH_Success != stat_tmp)
{
EndFunction(BOOT_RET_NOT_OK);
return;
}
IndexBuffer+=16;
AddrWr+=16;
vTaskDelay(3);
}
Do you have some guideline to prevent this interrupt block ??
Is there some councils to prevent that the CAN IRQ does not working after a interrupt disable ??
Thank you very much ,
Luca