2022-10-04 07:34 AM
I'm working on a project involving a 5V servo motor with a 3V3 MCU, and I wanted to get some advice on how best to translate the PWM output from the 3V3 MCU to the 5V servo motor. I made the mistake of initially just using a MOSFET that was controlled by the PWM signal, and while the code seems to work, the signal obviously is all wonky.
Right now, the main option I'm considering is a level shifter like an NVT2010,118 (probably something with fewer channels), since I need to level shift some I2C lines anyway, but I wanted to get a second or third opinion on that, and maybe other options I could consider
edit: it occurs to me I should have asked this elsewhere. Apologies for the mistake
Solved! Go to Solution.
2022-10-04 10:01 AM
Forgot to mention: table 20 of the data sheet lists the pin functions, e.g. I/O structure FT = Five Volt Tolerant.
Details about the 5-Volt-tolerant GPIOs can be found in RM0438, e.g. in figure 38.
Regards
/Peter
2022-10-04 08:27 AM
The servo motor topic already fits into the STM32 category, because you only have to generate a PWM signal according to whose ratio the rotation angle of the servo is set.
Typically, the frequency of the PWM signal is not particularly high, so you don't necessarily have to use a level shifter. Even a 5V-tolerant output of the STM32 should be able to drive this by setting the relevant GPIO to open-drain and connecting an external pull-up of approx 1...2kOhm, possibly even the internal pull-up of the GPIO is sufficient.
Regards
/Peter
2022-10-04 08:36 AM
Well, that's good to know. I've actually been trying to determine which pins on the microcontroller I'm using (STM32L552ZET6Q) are 5V tolerant, but I can't find it in the datasheet so far. Are they all 5V tolerant, or is there a list of which specific ones are?
2022-10-04 09:55 AM
My previous statement was not entirely correct, because you must disable the internal pull-up and use an external pull-up when connecting a 5V component to a 5V-tolerant pin in order not to create an injected current at that GPIO pin.
The list of 5V-tolerant pins of the STM32L552ZE can be found in the data sheet, table 21.
Regards
/Peter
2022-10-04 10:01 AM
Forgot to mention: table 20 of the data sheet lists the pin functions, e.g. I/O structure FT = Five Volt Tolerant.
Details about the 5-Volt-tolerant GPIOs can be found in RM0438, e.g. in figure 38.
Regards
/Peter
2022-10-04 10:07 AM
Thanks for the info!
2022-10-04 10:12 AM
You're welcome!
If the problem is solved, please mark this thread as answered by selecting Select as best, as also explained here. This will help other users find that answer faster.
Regards
/Peter
2022-10-04 10:19 AM
Does it need conversion?
The Servo can be powered via 5V supply, with adequate current sourcing.
Does the signalling need to be? What's the VIL/VIH expectations of the 50 Hz (20ms) signals with 1-2 ms pulse width?