Is there a driver test software for KEAZ128 that shows how to set up an external interrupt handler?
I wasn't able to find it in the FRDM-KEA-QSP v7 (Quick starter package).
Any pointers / help would be appreciated.
FYI:
I am using s32 Design studio for IDE.
Hi
The KEAZ128 has either a single IRQ input or multiple keyboard interrupts.
Assuming that you are interested in the IRQ pin, which can be on PTA5, PTI0, PTI1, PTI2, PTI3, PTI4, PTI5 or PTI6 (only one at a time) it can be done as follows (example of falling edge with pull-up enabled):
POWER_UP_ATOMIC(0, IRQ); // enable clocks to the external interrupt module
SIM_PINSEL0 = (value depending on PTI pin required); // only when PTA5 not used
IRQ_SC = IRQ_SC_IRQPE; // enable IRQ pin function with pull-up
fnEnterInterrupt(irq_IRQ_ID, IRQ_PRIORITY, _IRQ_isr); // enable IRQ interrupt in NVIC and enter handling function
IRQ_SC |= (IRQ_SC_IRQIE | IRQ_SC_IRQACK); // enable interrupt and reset pending interrupt
When the interrupt fires the interrupt is cleared by the handling function with
IRQ_SC |= (IRQ_SC_IRQACK); // reset the interrupt flag
When using PTA5 as IRQ input there is one thing that has to be done specially and that is to clear the SIM_SOPT_RSTPE flag in SIM_SOPT0 so that the pin is no longer the reset pin; this is a write once flag and so writes to this register have to be coordinated carefully.
Full code for KEA128 IRQ and Keyboard interrupts is in the Open Source code link below, including KEA128 simulation for verifying the functionality (example below)
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis KEA128:
- http://www.utasker.com/kinetis/TRK-KEA128.html
- http://www.utasker.com/kinetis/FRDM-KEAZ128Q80.html
S32 Design Studio: http://www.utasker.com/kinetis/compilers.html#S32
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html