CAN Bus messages missing during Flash write operation

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

CAN Bus messages missing during Flash write operation

Jump to solution
1,518 Views
pejo
Contributor III

Hi,

I have a bare metal OS system working for a while. I noticed recently that sometimes canbus messages are lost when I run a FLASH Write operation. It happens only in case of high traffic. 

- Canbus communication is configured as non-blocking.

- I don't detect MCAN Errors. I check in callback function for : kStatus_MCAN_RxFifo0Full & kStatus_MCAN_RxFifo0Lost

I checked for non blocking flash but no such function exists. Apparently there is no interruption associated to flash operations, meaning that I cannot prioritize can over flash operations.

Any ideas or suggestions? Currently my only solution would be to make sure that I write to Flash when there is not a lot of canbus traffic.

 

Labels (1)
0 Kudos
Reply
1 Solution
1,501 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you use LPC55xx family, which has only one flash block, if you erase/program sector or page of the same block where you save code and execute, you will have issue. while the flash block is erased/programed by calling IAP function, you can not access the block, so you have to disable interrupt, but you use CAN non-blocking mechanism, which uses interrupt mechanism, it will leads to error.

If you want to erase/program flash and hope you can use interrupt mechanism, you have to copy the interrupt table to SRAM and copy the ISR to SRAM from flash, because core fetches interrupt table from RAM and execute code from RAM, it is okay, although you erase/program flash page or sector

Hope it can help you

BR

Xiangjun Rong

 

View solution in original post

3 Replies
1,502 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you use LPC55xx family, which has only one flash block, if you erase/program sector or page of the same block where you save code and execute, you will have issue. while the flash block is erased/programed by calling IAP function, you can not access the block, so you have to disable interrupt, but you use CAN non-blocking mechanism, which uses interrupt mechanism, it will leads to error.

If you want to erase/program flash and hope you can use interrupt mechanism, you have to copy the interrupt table to SRAM and copy the ISR to SRAM from flash, because core fetches interrupt table from RAM and execute code from RAM, it is okay, although you erase/program flash page or sector

Hope it can help you

BR

Xiangjun Rong

 

953 Views
pejo
Contributor III

Hi Xiangjun,

we're now considering to port the code to SRAM in order to try one of the solutions that you suggested. That way we could still be able to use interruptions during the flashing of the data.

Would you please answer a couple of questions?

- As I understand I need to copy to ram the interruptions table, the interruption function with ALL the dependencies, functions and code used in the interruption function. Can you confirm this?

- The APIs for flashing the memory are blocking, so during the flashing only the interruption functions will be executed. Is it so?

Thank you!

0 Kudos
Reply
1,498 Views
pejo
Contributor III

Hello Xiangjun,

your explanation makes all the sense. Thank you very much.

Probably the easiest is to avoid using interruptions with canbus as I understand that the function MCAN_TransferReceiveBlocking allows. 

0 Kudos
Reply