2

I recently started playing around with a "Blue Pill" board that uses the STM32F103 MCU. The board has an onboard user LED, that is driven by sinking current into the PC13 pin. This is done because the PC13 pin should not be used for sourcing current higher than 3mA. This is a known property of the BP board.

However, while reading up on the MCU manual, I discovered this:

The GPIOs (general-purpose inputs/outputs) can sink or source up to ±8mA, and sink or source up to ±20mA (with a relaxed VOL/VOH) except PC13, PC14 and PC15 which can sink or source up to +/-3mA. When using the GPIOs PC13 to PC15 in output mode, the speed should not exceed 2 MHz with a maximum load of 30 pF.

Form this, it seems, that PC13 (along with PC14 and PC15) can not sink current above 3mA.

My question:
Is the "Blue Pill" violating the STM32F103 spec by sinking more than 3mA into the PC13 pin?

  • How much current do you think is flowing through the LED? How did you come up with that value? – Elliot Alderson May 29 '19 at 12:58
  • See table 7, absolute max ratings are 25 mA. – Michel Keijzers May 29 '19 at 13:02
  • 1
    But Table 7 does not apply here, as mentioned multiple times elsewhere in the datasheet, PC13 is a special weak pin powered from Vbat domain. In addition, the chip is said to sink/source 20mA, which means it will still operate properly as specified. Drawing more than 20mA means it may not work properly, but it does not break permanently either. 25mA is the limit after which it can break permanently and never work again. Most likely PC13 drivers are so weak it can't even sink/source 20mA. – Justme May 29 '19 at 14:23
  • @Justme I was not aware of me (I think it's quite misleading info in the datasheet anyway). – Michel Keijzers May 29 '19 at 15:03

1 Answers1

1

No it is not.

Reasoning:

The LED is connected to 3.3 V, is a blue LED and has a current limiting resistor of 510 ohm.

Blue LEDs have a forward voltage drop of around 2 V (this is a low value estimate for low currents, it's likely higher), so 1.3 V left for the resistor, gives a current of around 2.5 mA.

I'd say it's fine. Maybe a bit borderline as the forward voltage drop of LEDs is not a very well specified value, but should be okay.

Arsenal
  • 17,464
  • 1
  • 32
  • 59
  • Good clarification that the LED is blue. 3mA would flow if LED has 1.77V over it. Blue LEDs should have greater forward voltage so less current will flow. The OP should be able to measure voltage over the resistor and LED with a multimeter to calculate the current. – Justme May 29 '19 at 14:32
  • A Blue LED same as white is about 2.4 to 2.6 @ 2mA so with 510 ohm, I would expect 1.6 mA which is just adequate for a low level indicator. Maybe you were thinking of the older GaN Blue LEDs – Tony Stewart EE75 May 29 '19 at 21:09
  • My BP has a green LED, I haven't measured it yet, but I assume, that is has a similar power draw. I guess I just assumed, that it draws more, as I usually drive my LEDs with 10 mA. This still begs the question as to why power is sunk into the pin as opposed to sourced from it? – Kaarel Pärtel May 31 '19 at 07:48
  • Pins are better at sinking current than at sourcing current. (Most of them at least because they are the same size and nmos have lower resistance) – Arsenal May 31 '19 at 15:07