KW41Z interrupts issue

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

KW41Z interrupts issue

389 Views
satsok_n
Contributor III

I am working on a project with KW41Z. I am trying to get 2 external interrupts from SW3 and SW4 buttons. When I tried this example it didn't work at all. 

v1.PNG

Sometimes I get a print on button push SW3 but it doesn't work when I push the button again. I cant understand why the same code sometimes works and sometimes doesn't.

Furthermore I saw this post  Input interrupt Handler example on KW41Z  and I cant get both buttons working. Shouldn't this be working if I add these lines of code (since both buttons have the same handler)?

   PORT_SetPinInterruptConfig(BOARD_SW_PORT, BOARD_SW4_GPIO_PIN, kPORT_InterruptFallingEdge);

   GPIO_PinInit(BOARD_SW_GPIO, BOARD_SW4_GPIO_PIN, &sw_config);

Labels (1)
0 Kudos
1 Reply

319 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi kostas,

Please refer the init codes of PTC4. If not the PTC5 is disable by default.

GPIO_GetPinsInterruptFlags should be use to check which SW caused interrupt, and then clear the corresponding interrupt flag.

SW3 SW4 FRDM-KW41Z.png

KW41Z Pin Assignments.png

GPIO interrupt example.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos