0
\$\begingroup\$

I'm working on a project with pulse width modulation. I need my logical high output to be 5 V. However, as my Vdd is 3.3 V, the output high level is approximately 2.9 V. This isn't sufficient for my purpose.

Somebody suggested that I configure the IO pins to open drain mode which I did actually through CubeMX, and I connected the pin to a resistor and that resistor to 5 V, but the output of the logical high level is still around 2.8 V.

I have looked through the user manual of the microcontroller which is an STM32F303VCT6 but I couldn't find anything related to whether the pins can be pulled up to 5 V or not, and if so, then which pins exactly are 5 V tolerant.

Could you please shed some light on this?

\$\endgroup\$
2
  • \$\begingroup\$ The GPIO might have some internal diodes that clamp the voltage to around Vcc + diode drop (which may not be the case since it would be a bit higher than 2.9V, and not 2.8V, but anyway its nice noting). \$\endgroup\$
    – Wesley Lee
    Commented Aug 15, 2018 at 19:30
  • 2
    \$\begingroup\$ From the results you describe, IMHO one or more parts of your system are not what you believe they are. Therefore please: (a) Edit the question & add the hardware schematic and photos; (b) Reduce your code to the minimum which shows the problem (i.e. open-drain output cannot be pulled-up with external resistor to 5V) and add that code into the question; use MCVE approach as explained on Stack Overflow; (c) What value resistor was the pull-up to 5V? (d) Do you have an oscilloscope or only DMM? (e) How did you prove open-drain pin was open-drain mode? \$\endgroup\$
    – SamGibson
    Commented Aug 17, 2018 at 1:36

3 Answers 3

3
\$\begingroup\$

I have looked through the user manual of the microcontroller which is namely a stm32f303vct6 but I couldn't find anything literally anything related to whether the pins can be pulled up to 5V or not, and if so then which pins exactly are 5V tolerant..

This information is in Table 13 ("STM32F303xB/STM32F303xC pin definitions") of the microcontroller datasheet -- it starts on page 35 of the current revision.

All pins with the letters "FT" ("five-volt tolerant") or "FTf" in the "I/O structure" column are 5V tolerant, and can be pulled up to 5V. Make sure that the pin is configured as open-drain, and internal pullup/pulldown resistors are disabled.

\$\endgroup\$
2
  • \$\begingroup\$ You have no idea how much this helps, thanks! I'll try it right away. \$\endgroup\$
    – abdo hajar
    Commented Aug 16, 2018 at 5:56
  • \$\begingroup\$ bro, I made sure that I used a 5V tolerant pin. But I still get the same output of around 2.8V at the output... It wouldn't matter whether I'm using the HAL library rather than the SPL would it?... Because I can honestly see no other reason anymore.. Thank you! \$\endgroup\$
    – abdo hajar
    Commented Aug 16, 2018 at 7:34
0
\$\begingroup\$

Some of the GPIOs are 5V tolerant. Search in the datasheet 5V, you will quickly find it. Please use open drain with external pull-up to 5V, bipolar transistors or CMOS-TTL buffer IC.

\$\endgroup\$
0
\$\begingroup\$

Do a double check of your circuit, check for internal pulldown activated in cubeIDE and also let me know the pullup resistor value. if you are using a 47k resistor as pullup and internal pulldown(30k) is active then maximum it will be around 2.8 volts as you told. Also check the default value of PWM.

\$\endgroup\$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.