3
\$\begingroup\$

I'm developing a circuit with a charger inside. The charger has 2 STAT pins that indicate the functionality of the board (charging, standby, fault, etc.)

As the datasheet suggests, I've connected two LEDs to determine the state of these tw0 pins. Additionally, I want to save this type of information in the MCU memory, so I decided to link these 2 pins to the MCU (STM32L433.)

Here is where my doubts begin:

enter image description here

The two STAT pins are connected with an open drain circuit, therefore when they are "high", they are floating:

enter image description here

Without the resistors R1 and R2, I suspect there might be a flow of current from the 4.5V+ output to the input of the GPIO of the MCU, as the reference voltage for the MCU is 3.3V. The datasheet recommends avoiding any possible current flow into these pins. For this reason, I added two 10k-ohm resistors to keep the cathode of the LED high when the STAT pins are in a floating state.

Is my reasoning correct? Is the choice of the R3 and R7 resistors correct to source the LED? (Vf= 2.2V, I_led = 2.3 mA.)

\$\endgroup\$
4
  • \$\begingroup\$ What pins of the STM32L433 are STAT? Do you always have 3.3 V when 4.5 V is present? \$\endgroup\$
    – MiNiMe
    Nov 5, 2023 at 11:48
  • \$\begingroup\$ I'm connecting to the GPIO pins of the MCU, so I can configure them using pullup, pulldown or floating mode. The idea was to use it in floating mode if I consider the circuit I've uploaded. The MCU has a supply of 3.3V, the 4.5V is used in a previous part of the circuit. (The STM32 cannot accept the 4.5V as source) \$\endgroup\$
    – Filo_Gold
    Nov 5, 2023 at 12:15
  • \$\begingroup\$ I hear you. Do you have a regulator or converter from 4.5 to 3.3 V then, or how is 3.3 V supplied? \$\endgroup\$
    – MiNiMe
    Nov 5, 2023 at 12:16
  • \$\begingroup\$ Yes, there are 2 regulators, the first DCDC gives the 4.5V and the second gives the 3.3V. Should I directly use the 3.3V? A block of the circuit (the DCDC and the charger) may lose the external source for a period of time, can it makes some troubles if I use the 3.3v? (If I use the pull'up mode it shouldn't, right?) \$\endgroup\$
    – Filo_Gold
    Nov 5, 2023 at 12:22

4 Answers 4

4
\$\begingroup\$

Since the STAT1 and STAT2 outputs from the charger are open-collector, a scheme like the following could prevent the 4.5V pull-up supply to the charger LEDs from back-feeding power into the STM32L433 MCU GPIOs:

schematic

simulate this circuit – Schematic created using CircuitLab

The STM32L433xx datasheet shows that for a 3.3V VDDIO supply, the VIL is max of 1.227 V which should allow for a nominal 0.7 V voltage drop on D1 and D2 when the charger STAT1 and STAT2 outputs are pulled low.

\$\endgroup\$
2
  • \$\begingroup\$ clear. Thank you for the response. In case I decide to use the 3.3V, could I omit the diodes? The pullup resistances you placed is to make stronger the internal pull-up of the GPIO MCU pins? \$\endgroup\$
    – Filo_Gold
    Nov 5, 2023 at 13:42
  • 2
    \$\begingroup\$ @Filo_Gold a) If you decide to use the 3.3V as the supply voltage for the charger LEDs, the isolation diodes D1 and D2 could be omitted. b) If the MCU GPIO internal pull-up is enabled the external pull-up resistors R1 and R2 can be omitted. I didn't consider the use of internal pull-ups which is why showed external pull-ups. \$\endgroup\$ Nov 5, 2023 at 13:55
4
\$\begingroup\$

Without the resistors R1 and R2, I suspect there might be a flow of current from the 4.5V+ output to the input of the GPIO of the MCU

With or without R1 and R2, when STAT1 and STAT2 are high (floating), and +4.5V is alive, there certainly will be current flowing into those MCU IO pins, and R1 and R2 only exacerbate this issue.

In the case where nothing else is connected to STAT1 and STAT2, just LEDs and the MCU, you can use the +3.3V rail for those open-drain outputs:

schematic

simulate this circuit – Schematic created using CircuitLab

You say that +3.3V is always alive, as is presumably the MCU, and if that's true, the use of the 3.3V supply to "pull-up" the open drains of STAT1 and STAT2 can never result in current flowing via the MCU IO pins.

The only other change is a reduction of R3 and R7 to compensate for the lower supply voltage.

\$\endgroup\$
1
  • \$\begingroup\$ I added a 100K resistor to ground from the IO inputs to simulate a nominal (guessed) input impedance. The input voltage drops to 2.3V which may be below the threshold for a high input. The results will vary with different LEDs. I think pull-up resistors would be prudent to get a clear logic 1, rather than relying on voltage "coming through" a switched off LED. \$\endgroup\$
    – Rodney
    Nov 6, 2023 at 9:51
0
\$\begingroup\$

As it currently is connected, your MCU could receive 4.5 V over those two STAT pins if there's a common GND. From the information in the comments, since 3.3 V is present whenever 4.5 V is, you would be better off using 3.3 V driving the LED's. Also skip those 10k resistor all together.

This have one major requirement, that there's common GND between 4.5 and 3.3 V.

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

Tying the pull-ups to 4.5V is likely not a good idea. Since the MCU runs at 3.3V, and not all inputs tolerate more than 3.3V, the pull-ups do more damage than good. Even if the MCU pins were 5V tolerant when MCU is powered up, you need to check what is the maximum voltage when MCU is unpowered.

Another problem is if you simply change the pull-ups to MCU supply. If MCU 3.3V supply is unpowered, the resistors will leak 4.5V through LEDs and resistors to MCU 3.3V supply which may turn both LEDs dimly on and cause the 3.3V supply to rise depending on load.

It might be best to also put the LEDs to 3.3V supply. But when 3.3V supply is off, the LEDs are also off even if battery is being charged.

Maybe use some transistors or diodes to isolate the MCU side from the charger side.

Another thing is, if there is load on the battery while the battery is being charged, the charger IC cannot know when the battery charging should be stopped because of the current not only going to battery but also to load. It will likely overcharge the battery each time and it may degrade and damage.

\$\endgroup\$
1
  • \$\begingroup\$ thank you very much, got the problem. There's no way to have 3.3V unpowered, only the 4.5V may be unpowered. To make the circuit simpler, I just change the source with the 3.3V, set the GPIO in pull-up mode and place 2 diode between the input of the MCU and the cathode? \$\endgroup\$
    – Filo_Gold
    Nov 5, 2023 at 13:31

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.