Hello,
I am integrating NXP Mcem on MPC5777C.
I did configuration by using tresos.
Mcem code and tresos configuration is buildable and it is running on the board.
After I run SW on the board I can see that configuration phase is passed.
Software is running as expected.
When I inject fault I would expect that:
FCCU moves from Norma to Alarm state and trigger ISR as I enable ISR.(ISR is triggered once)
Calls my callback from ISR.
Waits for defined timeout and switch to Fault state.
Behavior I have when I inject fault:
FCCU moves from Norma to Alarm state and trigger ISR. ISR is triggered constantly.
Even when I move from Alarm to Fault state ISR is still triggered.
Everything else is stooped just this ISR is executed.
Only when I clear the error ISR is not executed any more.
I am using Vector AUTOSAR OS.
Can you tell me what is expected behavior?
Hey Again,
Do you clear the interrupt status flag before returning to the main routine ( Before the callback, inside the ISR).
As i know, Interrupts has a flag and Mask. Mask allows you to enable IRQ, when the processor results with the FLAG & MASK as true
triggers interrupt. As i understood you didn't clear the interrupt flag after interruption. You have to clear the flag shown below, to not see the condition repetitively.
If the problem is different than i thought, we can talk again
Best Wishes
Ege
Hello egeonurg,
I am not clearing interrupt status flag before inserting to my callback.
Actually, I am only implementing callback and using Mcem implementation NXP provides.
Regarding your suggested solution to clear IRQ_STAT, I am not sure that I can clear that register as this register are in direct relation ship with FCCU state. Even if I clear it as error is still there it will again set IRQ_STAT bit for Alarm(ALRM_STAT) to 1 and again trigger ISR.
Only way to clear IRQ_STAT is by clearing error, at least only way know to me since now.
Please correct me if I miss something.
Thanks for your support and best regards.
What exactly the problem is is not clear. As I understood, you are already in a fault state and executed the fault handler in the callback of ISR. IRQ informs your software immediately when the case occurs. Isn't it obligatory to clear ISR after the completition?
Best Wishes
Ege
Hello egeonurg,
Thanks for quick answer.
Sorry If I was not clear enough.
Problem is that ISR is constantly triggered.
I would expect that ISR is executed once(in point in time when error occurs), ISR calls the callback I defined, exits from ISR and that this is implemented as part of Mcem code NXP provides.
If I understood you correctly I have to clear ISR in my callback? Is that expected behavior?
If that is expected behavior how I can clear ISR is my callback?
One way is to clear error but than in NCF_S register I will not have information about error?
Even after I switch to Fault state I still have this ISR triggered.
I can see that at the end of ISR there is EXIT_INTERRUPT()
But as I am using AUTOSAR OS, so AUTOSAR_OS_NOT_USED is not defined this EXIT_INTERRUPT is defined as nothing.
Best regards.
Hello mikiB,
Could you provide the interrupt function's name, which was implemented when the interrupt occurred?
And I want to know what the flags were set when the interruption occurred?
Best regards,
Dan
Hello nxf78987 ,
I am using Mcem implementation NXP provides with Safety package.
When I fake fault FCCU goes to alarm state and triggers ISR: ISR(FCCU_ALARM_AND_TIMEOUT_ISR)
and that ISR will trigger my callback function.
When fault happened:
IRQ_STAT bit for alarm( ALRM_STAT) is set to 1
NCF_S0 or NCF_S1 is set depending which fault I fake
STAT is updated for PhysicErrorPin to 2.
Also if I in callback function request state than I will see that FCCU is in FAULT state.
Best regards
Hello @mikiB,
I have tested on my board and I see exactly the same behavior, i.e. after injecting the fault the alarm ISR is triggered all the time. This is the expected/designed behavior. To not get the ISR triggered all the time it is needed to clear the fault (on FCCU HW this actually means to “clear the alarm interrupt”). For this there can be used the function:
status = Mcem_ClearFaults(nFaultId);
If you inject the fault by SW for testing purposes then it is always needed to clear the fault in the ISR (otherwise application will get stuck calling the ISR forever, unless the fault would be configured for NMI or reset reaction once FCCU enters the fault state).
Best Regards,
Frantisek