I discovered something interesting with a HC12 (did the adoption to the existing HCS12 port on my own) that I can not explain at the moment.
I have a CAN interrupt receive service routine. If I overload the HC12 with high CAN message frequency the application crashs at the call of: portTASK_SWITCH_FROM_ISR() at the end of the interrupt service routine. If I replace it with portYIELD() it works perfectly. I looked to the stack pointer and it points on the same adress, regardless which of the task switch functions I am calling, right at the beginning and just before exiting the service routine. I use only ‘static’ variables in the service routine. Surprisingly the code for portTASK_SWITCH_FROM_ISR and portYIELD is exactly the same. The only difference in calling portYield is that within the interrupt service routine an other one (portYIELD) is called because the swi instruction is used. So an additional entry and exit to interrupt service routines are performed.
Anyone an idea what makes the difference ?