I want to implement something in an ARM Cortex-M3 processor (with NVIC). I have limited knowledge about embedded systems, but I know, that an ISR routine should be as simple as possible.
Now I have the following problem: I have an interrupt routine which invokes when a CAN message is received. In one case I have to calculate some time-consuming task with the CAN message which task cannot be interrupted by another CAN message, but other interrupts can be served during this operation. My idea is the following:
- CAN message received, ISR started, do some simple jobs (e.g. setting flags)
- Disable CAN interrupts in the CAN ISR routine. Also save the CAN message into a global variable so it can be reached in the main loop.
- In the main loop, do the time consuming task.
- After this task, enable the CAN interrupt handling again.
Is it a good (or not totally bad) idea or should I do this in another way?