S32K144EVB MBD GPI ISR not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144EVB MBD GPI ISR not working

668 Views
ruicui
Contributor II

Dear support,

I am using model based design tool box to check GPI ISR function. However, I can't get expected result. It seems like PTE16 is always set as logic 0 no matter what voltage I feed(5v or 0v), GPI read block works as intended.

Untitled.png

Thanks,

Ray

Tags (2)
0 Kudos
1 Reply

577 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi ruicui‌,

Couple of things you should consider:

1: Due to a limitation in the SDK version release with MBDT v.3.0.0 the ISR functionality can't be used in the same time with Read/Write GPI functionality.

2: To have the GPI ISR working on a pin, you first have to initialize the pin (e.g. using a GPI read block that has a higher Simulink Priority than GPI ISR) and then use only GPI ISR block to read from the associated pin using a data variable to hold the states.

3: Please use interrupt on edge transition rather than level since you might overrun the CPU with interrupts. The alternative would be to use the enable/disable interrupt once you are o a level.

Here is an example of how you should tackle the problem.

pastedImage_4.png

In this example i'm going to initialize the PTC13 as input and read it's value in RED_LED_STATUS

Then, i'm going to initialize the GPI ISR on either edges of PTC13 and use the subsystem to negate the value of the RED_LED_STATUS each time a ISR is triggered.

Ultimately the status of another GPO is set based on the actual value of the RED_LED_STATUS. This is done on the standard Simulink step function. 

The Freemaster block is optional but it is a good option to check the values of the RED_LED_STATUS and how it changes when the ISR is generated as a press of button.

Hope this helps!

Daniel

0 Kudos