Reproducing the gpio_input_interrupt example on FRDM-KE15Z

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

Reproducing the gpio_input_interrupt example on FRDM-KE15Z

1,062 Views
Frotz
Contributor III

Hi,

I've got the gpio_input_interrupt SDK example working just fine on the FRDM-KE15Z in MCUXpresso 11.3.0 using version 2.9.0 of the SDK. But when I try to make a new project for that board to do exactly the same thing, with the same pins, pressing SW2 does nothing. There's no interrupt, no hang, no crash, just nothing. Of course I've used the pin tool to automatically generate the PORT_SetPinMux() calls for PORTD/pin 0 for the LED, and PORTB/pin 11 for the switch. The example doesn't use the pin tool so I can't really compare both projects to see if everything's set up identically. As for source, I'm copying the code from the example project (selected lines from the gpio_input_interrupt.c file only) into the new project and checking that the right functions etc. are performed in the same order with the same parameters as in the example, but no joy. The only real difference I can see is that the new project is C++ instead of C. What did I miss?

Thank you very kindly,

Andre.

0 Kudos
Reply
3 Replies

1,004 Views
Frotz
Contributor III

Hi Daniel,

That's great!

Thanks,

Andre.

0 Kudos
Reply

1,042 Views
Frotz
Contributor III

Hi,

I've found the problem. Turns out that C++ was the issue and it's mangling of function names made my handler invisible. Found this out in the startup_mke15z7.cpp file where it reads:

//*****************************************************************************

// Forward declaration of the core exception handlers.

// When the application defines a handler (with the same name), this will

// automatically take precedence over these weak definitions.

// If your application is a C++ one, then any interrupt handlers defined

// in C++ files within in your main application will need to have C linkage

// rather than C++ linkage. To do this, make sure that you are using extern "C"

// { .... } around the interrupt handler within your main application code.

//*****************************************************************************

 

It would be helpful if this tip were in the SDK documentation somewhere handy. Don't you agree?

 

Best,

Andre.

 

1,031 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @Frotz 

 

Yes.   I will take your suggestions to the SDK doc team.  Thank you very much.

 

Regards

Daniel

0 Kudos
Reply