Hi all,
I'm working on a project with the KL05 freedom board (also having the same issue with a custom board with the same MKL05Z32VFM4 microcontroller). I'm developing the code using Kinetis Design Studio 3.
The project involves using 3 switches which triggers their respective interrupts. The buttons are designated to PA9, PA10, and PA11.
I have managed to get the interrupt request for PA10 and PA11 to function successfully -- button presses result in entering the PORTA_IRQHandler. However, I am unable to get PA9 specifically to function. While stepping through the code with the debugger, successful set up of the PCR registers for PA10 and PA11 have the value of 0xa0107. However, the same setup procedure for PA9 results in a read register value of 0x107.
Essentially, this is what I have been doing for pin assignment setup for my button inputs:
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK; //enable clocks for ports A and B
NVIC_SetPriority(PORTA_IRQn, 1);
NVIC_EnableIRQ(PORTA_IRQn);
PORTA_PCR10 = (PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK | PORT_PCR_PFE_MASK);
GPIOA_PDDR &= ~(1<<10);
PORTA_PCR9 = (PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK | PORT_PCR_PFE_MASK );
GPIOA_PDDR &= ~(1<<9);
PORTA_PCR11 = (PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK | PORT_PCR_PFE_MASK);
GPIOA_PDDR &= ~(1<<11);
__enable_irq(); //enable global interrupt
//later in the code, i configure the interrupt config bit of each register exclusively.
PORTA_PCR10 |= PORT_PCR_IRQC(10);
PORTA_PCR9 |= PORT_PCR_IRQC(10);
PORTA_PCR11 |= PORT_PCR_IRQC(10);
If anyone has dealt with the same issue with being unable to write to the register, what was the path taken to correcting the issue?
Thanks,
Matt