Hi, I'm having some trouble with the GPIO_PORT_C | GPIO_PIN3 on the K60F120M in MQX 4.2.0. Whenever I try to use it as an input and read it's value or when I try to use it as an output and give it a value it always has an unspeccified value when we control it with an Oscillioscope. The code looks exatly the same as for the other Pins I'm using (except for the pin number of course) and with them I'm having no problems. I tried to find if MQX have another defualt usage for that Pin but the only thing I could find was the RX function for UART 1. I have both BSPCFG_ENABLE_TTYB and BSPCFG_ENABLE_ITTYB set to 0 in my user_config file so it sohuldn't even be used and I even tried to remove the pctl->PCR[3] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK; line from init_gpio.c but that didn't help either.
So, does anyone know if the PTC3 pin has another default usage that could interfer when I try to use it as an input GPIO?
Solved! Go to Solution.
I managed to find the problem. And that problem was me being an idiot forgetting to set the functionality to GPIO
Hello Jesper
It doesn't matter if the port in question is initialised by other code or not since your configuration of it will override it.
Perhaps there is some other usage in the system that it being repeatedly reconfigured and so overrides yours?
Simply check PORTC_PCR3 after you have written it (and later after the system has run some more) to see whether its value is as expected.
Regards
Mark
Kinetis: µTasker Kinetis support
K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support
For the complete "out-of-the-box" Kinetis experience and faster time to market
I managed to find the problem. And that problem was me being an idiot forgetting to set the functionality to GPIO