I'm having a problem running PTC6 and PTC7 as GPIO. The microcontroller is an MKV10Z16VLC7.
First I initialize the pin for GPIO
PORT_HAL_SetMuxMode(PORTC, 7UL, kPortMuxAsGpio);
gpio_output_pin_user_config_t CLK = {
.pinName = GPIO_MAKE_PIN(GPIOC_IDX, 7U),
.config.outputLogic = 0,
.config.slewRate = kPortFastSlewRate,
.config.driveStrength = kPortLowDriveStrength,
};
GPIO_DRV_OutputPinInit(&CLK);
Then I try toggling the pin manually
GPIO_WR_PSOR(GPIOC, 1U << 7U);
GPIO_WR_PCOR(GPIOC, 1U << 7U);
But this does not work. The pin stays low. And if I try to pull the whole port high, all the pins go high except PTC6 and PTC7.
GPIO_WR_PDOR(GPIOC, 0xFF);
From the datasheet I can see that these two pins are CMP0_INx by default. Is there some sort of internal pull down that I need disable? The pins aren't connected to anything on the PCB either.
Solved! Go to Solution.
Hi Stephen, PTC6 and PTC7 are true open drain pins. These pins cannot drive a logic one without a pull-up resistor. If you want use these pins as GPIO then you must have external pull-up resistor.
Hi Stephen, PTC6 and PTC7 are true open drain pins. These pins cannot drive a logic one without a pull-up resistor. If you want use these pins as GPIO then you must have external pull-up resistor.