I want to use PTB5 as one of the ADC channels. In the HW design there is a pulldown fitted. Out of reset this pin defaults to NMI_b and hence causes the device to be stuck.
Can NMI_b be disabled on KL02Z at startup? I have tried setting the following in my kinetis_sysinit.c.
NV_FOPT &= ~NV_FOPT_NMI_DIS_MASK;
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;
PORTB_PCR5 = PORT_PCR_MUX(1);
Maybe this is not possible and I just cant use this pin. Can it be done and if so what am I doing wrong.