MKV30F128VFM10 is running code fine. Latest KSDK2 SDK.
PORT_SetPinInterruptConfig( PORTA, 1<<4, kPORT_InterruptEitherEdge );
PORT_SetPinInterruptConfig( PORTA, 1<<18, kPORT_InterruptEitherEdge );
PORT_SetPinInterruptConfig( PORTA, 1<<19, kPORT_InterruptEitherEdge );
EnableIRQ( PORTA_IRQn );
GPIO_PinInit( GPIOA, 1<<4, &sw_config );
GPIO_PinInit( GPIOA, 1<<18, &sw_config );
GPIO_PinInit( GPIOA, 1<<19, &sw_config );
It hard faults when running the PORT_SetPinInterruptConfig on PORTA18 and PORTA19.
The command on PORTA4 doesn't hard fault. If I put the A4 command last, it won't get past A18 or A19.
The pin_mux (configured in the GUI) looks sensible....
/* Port A Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortA);
/* Port B Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortB);
/* Port C Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortC);
/* Port D Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortD);
/* Port E Clock Gate Control: Clock enabled */
CLOCK_EnableClock(kCLOCK_PortE);
/* PORTA18 (pin 17) is configured as PTA18 */
PORT_SetPinMux(BOARD_INITPINS_HALL2_PORT, BOARD_INITPINS_HALL2_PIN, kPORT_MuxAsGpio);
PORTA->PCR[18] = ((PORTA->PCR[18] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_ISF_MASK)))
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set. */
| (uint32_t)(kPORT_PullUp));
/* PORTA19 (pin 18) is configured as PTA19 */
PORT_SetPinMux(BOARD_INITPINS_HALL3_PORT, BOARD_INITPINS_HALL3_PIN, kPORT_MuxAsGpio);
PORTA->PCR[19] = ((PORTA->PCR[19] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_ISF_MASK)))
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set. */
| (uint32_t)(kPORT_PullUp));
/* PORTA4 (pin 16) is configured as PTA4 */
PORT_SetPinMux(BOARD_INITPINS_BUTTON_PORT, BOARD_INITPINS_BUTTON_PIN, kPORT_MuxAsGpio);
PORTA->PCR[4] = ((PORTA->PCR[4] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_ISF_MASK)))
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
* corresponding PE field is set. */
| (uint32_t)(kPORT_PullUp));
void PORTA_IRQHandler( void ) {
uint32_t flags = GPIO_GetPinsInterruptFlags( GPIOA );
if( flags &= 1U<<4) {
GPIO_PortClearInterruptFlags( GPIOA, 1U<<4 );
}
if( flags &= 1U<<18) {
GPIO_PortClearInterruptFlags( GPIOA, 1U<<18 );
}
if( flags &= 1U<<19) {
GPIO_PortClearInterruptFlags( GPIOA, 1U<<19 );
}
}