AnsweredAssumed Answered

Trouble reading some Port C input pins on K64 using PE and sdk 1.3

Question asked by Ian Norman on Jul 10, 2017
Latest reply on Jul 13, 2017 by Ian Norman

I'm scratching my head trying to read an 8 pin dip switch connected to port pins PTC12 through to PTC19. I can only successfully read the status correctly of the one connected to PTC19. All the others only show as high if I have the pull-up enabled, and low if the pull-up is disabled no matter the state of the switch.


I've configured the pins in pin_mux to have the gpio function enabled with pull-up enabled as below

pin mux setup

and then setup as input in the gpio component. 

And then in my code i'm calling the function GPIO_DRV_ReadPinInput to read the state of each pin and outputting the result to the console.


state2=GPIO_DRV_ReadPinInput(CONFIG2); //check switches first
if (debug==1)
   PRINTF("\r\nstate2 %x\r\n", state2);


I've checked the default state of these pins in the datasheet, but see they default to disabled. Could anything else be interfering with there setup as input? Odd the one PTC19 is working fine while the others PTC12 to PTC18 are not. 



Kind regards