Hello,
I am trying to do something rather similar to what is described here, but so far without success:
Enable GPIO pin interrupt S32K144 MCU
Example: S32K148 GPIO Interrupt
First, I setup the pins PTD24 and PTD27 as inputs:
Next, I configure them to interrupt on falling edge:
In the PEX settings I do not clear the flag, with the intention of doing so manually in the ISR handler. (side question - I'm a bit confused about this - if you had PEX clear the flag, would that happen immediately after the ISR?)
Next, I create the ISR. Because there are multiple interrupts, I check the intflags using the SDK calls. Presently both interrupts take the same action.
Next, I install the handler, after PINS_DRV_Init().
I've tried it two ways:
and also this, with & in front of handler name:
because some examples I've seen use the & notation. (side note: I've even tried with the 2nd argument cast to isr_t since that what INT_SYS_InstallHandler expects.)
Neither approach works unfortunately.
I'm able to confirm a falling edge on the GPIO pin in question, however the code never triggers the interrupt or calls the handler.
Additional note - despite the RTOS-like handler naming, I'm not doing anything with RTOS apart from what comes automatically with the PEX/SDK template.
I wonder if there is something else I am missing. Examples seem pretty straightforward.
Thanks
Thanks Robin. Unfortunately this example doesn't answer any questions (except that the example uses the &function notation).
Are there any other prerequisites to the interrupt handler getting called, other than installing it, and specifying an interrupt type in the pin settings?
Argh. I made a mistake and was looking at the wrong pin the whole time. Sorry!
CAN_PAL example is still setup wrong though, someone should check that out.
Thanks
Hi Matthew Mishrikey,
I am glad to hear you find out the problem.
Thank you for the report, I'll inform the SDK team about this.
Best Regards,
Robin
By the way, the can_pal example project seems to have an error in it.
BUTTON1 and BUTTON2 are PTC12 and PTC13 in the code,
however the interrupt settings in PEX are applied to PTC13 and PTC14:
Hi Matthew Mishrikey,
Please refer the GPIO interrupt shown in can_pal_s32k148 example.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------