2024-04-22 10:37 PM - edited 2024-04-22 10:53 PM
How STM32WLE5JC pin PAD circuit works in mixed 3 volts Vdd and 4.2 volts for Open Drain Output pin?
Would like to switch medium power LED that takes 45mA and supplied directly by 4.2 volts Li ion cell. LDO, MCP1700, drops cell voltage from 4.2 to 3V to feed MCU four power pins.
Use 3 port pins and each sink 15mA. Configure pin as Open Drain, disable pull up. Disable pull down. Use PA4, PA5 and PA6 that have I/O structure type FT. Is it correct that PA4, PA5 and PA6 can take 3 + 3.9 = 6.9 volts and it is OK in this circuit that put 4.2 volts on IO pin when LED is off? TIA
Solved! Go to Solution.
2024-04-28 02:55 AM
If you want to drive an LED, you have to operate the GPIO in the Output mode, which in your case you are doing correctly with Open Drain and no Pull Up/Down. However, in Table 22 you are referring to the limit values of the GPIO when it is in input mode. The FT note in Table 19 also refers to input, not output.
The simplest and possibly cheaper solution than three resistors is an additional transistor between the GPIO and the LED. If this is a logic level MOSFET, you do not need a gate resistor as with npn BJT, but you should insert a pull-down from the gate to GND so that the gate is definitely deactivated even when the STM32 is switched off.
Hope that helps?
Regards
/Peter
2024-04-28 02:55 AM
If you want to drive an LED, you have to operate the GPIO in the Output mode, which in your case you are doing correctly with Open Drain and no Pull Up/Down. However, in Table 22 you are referring to the limit values of the GPIO when it is in input mode. The FT note in Table 19 also refers to input, not output.
The simplest and possibly cheaper solution than three resistors is an additional transistor between the GPIO and the LED. If this is a logic level MOSFET, you do not need a gate resistor as with npn BJT, but you should insert a pull-down from the gate to GND so that the gate is definitely deactivated even when the STM32 is switched off.
Hope that helps?
Regards
/Peter
2024-04-29 01:59 AM
As there is voltage drop on the LED even at lowest currents, even with VBAT=4.2 you can expect the voltage at P(0|1|2) to be several 100 mV lower. This can save your *ss in some situations...
2024-04-29 02:42 AM
@Peter BENSCH wrote:If this is a logic level MOSFET, you do not need a gate resistor as with npn BJT,
Some BJTs are available with resistors built in; eg,
https://www.rohm.com/products/transistors/digital-transistors/standard/dtc124eu3-product
https://www.rohm.com/products/transistors/digital-transistors/standard/dta124eu3-product
Some call these "digital transistors" or similar.
2024-04-29 02:55 AM
@Peter BENSCH wrote:If you want to drive an LED, you have to operate the GPIO in the Output mode, which in your case you are doing correctly with Open Drain and no Pull Up/Down. However, in Table 22 you are referring to the limit values of the GPIO when it is in input mode. The FT note in Table 19 also refers to input, not output.
Just thinking on that, so would it be possible to switch between Output mode to light the LED, and input mode when the LED needs to be off ... ?
:thinking_face:
2024-04-29 03:01 AM
@Andrew Neil Theoretically, this should be possible. However, modern LEDs light up only weakly, but recognisably, even at the lowest currents in the range of a few microamperes. Real switching off is probably only possible with a dedicated driver such as an external transistor.