AnsweredAssumed Answered

open drain GPIO output

Question asked by Evert on Apr 29, 2013
Latest reply on May 1, 2013 by Andrew Neil
Dear all,

A question about configuring GPIO outputs,
I've connected a Led to 3v3 and the other side via a resistor to the STM32F051.
I want to switch on the led with the GPIO_SetBits() function
However my led is by default 'on' and goes 'off' when I enter GPIO_SetBits() function.

This is my configuration setting:

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOC, &GPIO_InitStructure);

I was expecting that in an open drain configuration, the output should be enabled when the set function is entered. What is wrong with my configuration and is it possible to resolve this? Or do I have to use the GPIO_SetBits() function to disable to led after configuration and use the GPIO_ResetBits() to enable the led?