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
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
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.