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.
Hi Daniel,
That's great!
Thanks,
Andre.
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.
Hi @Frotz
Yes. I will take your suggestions to the SDK doc team. Thank you very much.
Regards
Daniel