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
Hi Jorge,
I'm using CAN HIGH SPEED with a baud rate equals to 500 Khz.
Yes I checked the status of Can and I saw that it is in disable mode.
I think it is not related to the speed but it depends from the time that you keep stopped the interrupts.
If you do this frequently (disable -- flash operation -- enable ) you can reproduce a block of the CAN peripheral.
Thanks for your answer ,
Luca
Hi Luca
I can't see the problem of working in this mode, you need to enable and disable interrupts to ensure that there will not come an interrupt while you are modifying flash.
Could you clarify how is the setup of your CAN? before start writing to flash, how did you leave the CAN module? also, are you able to check the Status and error register to verify if you have something in there?
If possible, could you change the CAN speed and verify if the problem occurrence reduces? I would like to find if the problem is related to this.
Best regards
Jorge Alcala