Hi PetrS martinkovar, Is there anyway that I can read IRQ (through register) numbers during run time for CAN node in MPC5777M .
suppose for M_CAN_1 the IRQ are 688 and 689.
So I want to read these numbers run time and raise the particular ISR.
Any Update?
I am afraid your question does not make too much sense to us. Could you please ask different way letting us to understand your question? Thanks
Thank you , OK . My requirement is like single ISR function to be used in my function and I want to call this function by checking IRQ number so that I can pass the parameters corresponding to that IRQ number.
Example :
ISR(x)
{
/// code
}
if(IRQ == 688u)
{
ISR(M_CAN_1)
}
else if (IRQ == 689u)
{
ISR(M_CAN2)
}
So through which register I can read IRQ number that caused the interrupt during runtime ?
Hello,
the solution you try to create is definitely not correct way, how interrupts should work or be implemented.
Correct way is to implement interrupt using peripheral interrupt registers and INTC controller configuration. Another way is to use polling, it means check peripheral interrupt flag by software.
Please look at the following example. It shows, how to use FlexCAN with interrupts. Example is not created for MPC5777M and MCAN module, but for MPC5775K and FlexCAN module, but the idea of using interrupts is the same.
Example MPC5775K FlexCAN_with_interrupts_v1.1 S32DS
For correct polling method implementation, please see the example below:
Example MPC5777M MCAN simple TX/RX GHS614
Please do not try to use the way you designed. It can cause unpredictable microcontroller behavior.
Regards,
Martin