I am just getting started with the FRDM_KL02Z and the Kinetis SDK 2.0 using Kinetis design studio. I am just learning how to use the different peripherals starting with standard GPIO. I got the GPIO LED output demo from KSDK 2.0 working. Now I want to modify it so that when I hook up a push button to GPIO B8 and press it then the LED will flash and when it is not pressed it continues with whichever state it last entered (LED on or LED off).
I also want to use the the internal pullup resistor on GPIO B8 so I don't have to hook one up externally. I created the relevant circuit and modified two files (included) to test this functionality.
In a nutshell it isn't working. Even with nothing hooked up to GPIO B8 (except the internal pullup resistor), the value I get from
GPIO_ReadPinInput(GPIO_BTN, 1u << GPIO_BTN_PIN);
is 0. This leads me to believe that I didn't set up the internal pullup resistor correctly. If I read the datasheet correctly, the KL02Z microcontroller only allows pullup resistors on most of the GPIO's, but that is what I want and I thought I enabled it correctly. I appear to have done something wrong. Second even if I connect GPIO B8 directly to 3V3 (with 10k resistor to prevent shorting) I still get 0 from the call above. This leads me to believe that my call to GPIO_ReadPinInput is not working.
It's a bit embarassing that I can't get something as simple as polling GPIO input working, so please be patient with a new Kinetis developer.
Edit 1: I added the folder containing the entire project. I realized that this would make it easier for others to help me.
Original Attachment has been moved to: led_output.zip