cancel
Showing results for 
Search instead for 
Did you mean: 

how to output 5V to GPOIA instead of 3.3V

bean_much
Associate
Posted on December 16, 2011 at 00:12

I have and LCD screen that requires a positive threshold of 3.5 volts for logic high and the discovery board is only putting out 3.3V for high is there a way to change this on the board or will i need just to add some other hardware to shift the logic level to 5 volts

#3.3v-to-5v-volts #3.3v-to-5v-volts
9 REPLIES 9
Posted on December 16, 2011 at 01:22

For the 5V tolerant pins, you can program them to use open-drain mode, instead of push-pull, and then pull up to 5V with a suitable resistor. The output will then swing from clamped to GND for LOW, and the PULL-UP VOLTAGE for HIGH.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bean_much
Associate
Posted on December 16, 2011 at 06:31

I've tried this and it goes from ground to about 3.4V not 5V. I've switched to open drain mode and have (5V->10k resistor -> GPIOA 1) i measure at GPOIA 1 and it is always at 3.4V changing the resistance had no effect on the voltage. 

Posted on December 16, 2011 at 16:21

I've tried this and it goes from ground to about 3.4V not 5V. I've switched to open drain mode and have (5V->10k resistor -> GPIOA 1) i measure at GPOIA 1 and it is always at 3.4V changing the resistance had no effect on the voltage.

 

But PA.01 isn't a FT (FIVE VOLT TOLERANT) pin is it? Try it with PC.06, or PC.07, or PA.08 thru 15 if you're wedded to GPIOA

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
oussama-laribi
Associate II
Posted on May 07, 2013 at 15:30

hi clive

I tried your method to open drain mode ..

I connected GPIO_Pin_10(port A) with resistance to 5v of my STM32F4 .. but it does not work, I always have 5v on GPIOA_PIN_10 even if I did a ''GPIO_ResetBits (GPIOA, GPIO_Pin_10)'' ..!

Posted on May 07, 2013 at 16:20

Without knowing what processor, or seeing the code, I can't help you much.

If a peripheral doesn't respond, check it's being clocked.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
oussama-laribi
Associate II
Posted on May 07, 2013 at 17:08

here is my code..:

#include ''stm32f4_discovery.h''
GPIO_InitTypeDef GPIO_InitStructure;
void Delay(__IO uint32_t nCount);
int main(void)
{
/* GPIOA Periph clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* Configure PA10 in output OD mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
while (1)
{
GPIO_SetBits(GPIOA, GPIO_Pin_10); 
Delay(0xFFFFFF);
GPIO_ResetBits(GPIOA, GPIO_Pin_10);
Delay(0xFFFFFF);
}
}
void Delay(__IO uint32_t nCount)
{
while(nCount--)
{
}
}

Posted on May 07, 2013 at 20:19

Doesn't look problematic. I might choose PA8 on the STM32F4-Discovery as it's less conflicted.

47K pull up to 5V?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
n_
Associate II
Posted on July 10, 2013 at 09:00

Thank you Mr Clive1,your suggestion worked with my STM32F0discovery  board.

dthedens23
Associate II
Posted on July 10, 2013 at 18:37

Best if you drive the pin low and keep it low.

then change the direction.  Set as Output will pull it low.  Set as Input the resistor will pull it high.  Be careful of the R/C.  High values of R will draw less power but may have rise time issues.