GPIO Outputs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO Outputs

Jump to solution
588 Views
seanmccartan
Contributor II

Micro: MKV10Z32VLF7

IDE: MCUXpresso

I am trying to configure two pins on this micro to be digital outputs: PTC6 (pin 39) & PTC7 (pin 40). Code as follows:

gpio_pin_config_t PortC6 = {kGPIO_DigitalOutput,1};            // LED0, startup as HI

gpio_pin_config_t PortC7 = {kGPIO_DigitalOutput,1};            // LED1, startup as HI

.

.

.

void BOARD_InitPins(void)
{
    CLOCK_EnableClock(kCLOCK_PortC);

    PORT_SetPinMux(PORTC, 6U, kPORT_MuxAsGpio);

    PORT_SetPinMux(PORTC, 7U, kPORT_MuxAsGpio);

    GPIO_PinInit(GPIOC,6U,&PortC6);

    GPIO_PinInit(GPIOC,7U,&PortC7);

}

After running the above code, neither of the pins are high.

I read back the following registers:

GPIOC_PDIR: 0x0 - Incorrect, read only register, should be 0xC0

GPIOC_PDDR: 0xC0 - Correct (both pins assigned as outputs)

GPIOC_PDOR: 0xC0 - Correct (both pins assigned level '1')

A value of "0" in the "GPIOC_PDIR" register indicating:"0 Pin logic level is logic 0, or is not configured for use by digital function."

What this is telling me is that I cannot assign these two pins as digital logic. Surely this is not correct? What am I missing here?

Regards,

Sean

0 Kudos
1 Solution
519 Views
seanmccartan
Contributor II

I found the answer:"PTC6 and PTC7 are true open drain pins. These pins cannot drive a logic one without a pull-up resistor."

View solution in original post

1 Reply
520 Views
seanmccartan
Contributor II

I found the answer:"PTC6 and PTC7 are true open drain pins. These pins cannot drive a logic one without a pull-up resistor."