Hello, i have created a freeRtos project for s32k142 (cortex m4), the task are working as they should be, but when i added interrupt (interrupt on rising edge on a gpio), it didn’t work, i can’t really know what is the cause or how to debug it because i have only put a breakpoint on the isr i created and i am sending pulses all the time but it never reach the isr, it’s like it doesn’t care about the pulses, does anyone know how can i know what is the cause.
Thank you
Show the code Zak
The ISR function (the name should match the default weak handler to override), the NVIC setup code related to setting the priority and enable of the respective IRQ.
One thing to verify is that you have enabled everything needed, Normally there will be an enable in the GPIO controller to configure when you want an interrupt, and then there will be an enable on the NVIC also (as well as setting the interrupt priority). You need to do both to get into the ISR.
One common pitfall on Cortex PODs is to forget to enable the clock for the respective module (in your case GPIO) along with the rest of the configuration outlined by Richard.
But as Hartmut pointed out: Without showing us code, all you can expect is shots in the dark.
Hello,
- What did you mean by this “the name should match the default weak handler to override”
- I have done this " there will be an enable in the GPIO controller to configure when you want an interrupt"
- “to enable the clock for the respective module (in your case GPIO)” thiss also i have done it.
this is some code of my configuration
Ok - I see that the s32k142 uses a different mechanism to install ISRs. Forget about overriding the default ISR handler used by other MCUs.
So I guess that other ISRs are working properly. Then the issue might be related to the PORTC configuration as @RAc mentioned.
Is it enabled and is the port pin configured properly (as input) ?
I’m not sure about the interrupt priority. With other Cortex-M MCUs prio 0 is the highest prio and won’t work with FreeRTOS. However, probably there is related demo project to use as basis or to compare your application with.
Hello, yes I am sure about pin configuration because i have got it to work previously but it was not with freertos now that i am using interrupt it doesn’t detect the isr.
I couldn’t find any example for s32kxxx can you tell me where i can find it
Sorry - I’m not familiar with this MCU. But doesn’t NXP provide any (also FreeRTOS based) demos ?
But I wonder why the interrupt doesn’t work if you got it working already.
FreeRTOS is not directly involved in interrupt handling at the 1st place.
Means setting up the ISR and the related interrupt should work exactly as your bare metal application.
Do you also start the scheduler with vTaskStartScheduler which globally enables interrupts ?
Again the interrupt prio 0 seems suspicious…
Did you enable configASSERT and are you using a newer FreeRTOS version ?
Your code snippet appears to show only how you configure some timer interrupt, but not the interrupt in question, in particular the initialization of the gpio pin.
Can you verify that your isr on invoked without FreeRTOS, ie a barebone system?