10 years, 7 months ago.

PWM and driving LEDs

Hi All,

This board has a pile of PWM outputs - how many could I concurrently use to drive a set of LEDs (one LED per pin) ?

AB

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

2 Answers

10 years, 7 months ago.

Wow thats so strange, when i first got this board ( About a week after it was released) It only had support for 3 pwm outputs! What in the world is going on! Also, does anyone know why i can't buy the MCU that is on this board at MOUSER or DIGIKEY? All i can find is a 256k version of it.

10 years, 7 months ago.

I don't have it myself, but generally what should work is all of them, as long as you do not use duplicate names, So PC8 and PC9 have both PWM3_3, and you can use only one of them.

I also do not know if the F401 can deliver enough current to drive an LED directly, and especially many LEDs at the same time.

Hi Erik, I have one already and know that the software supports it, I was actually probing to find current limits. I am looking to drive 6 x RGB LEDS ie 18 *small* LEDs

posted by Anthony Buckton 07 Apr 2014

Ah is that the question :P. Datasheet: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00102166.pdf

Quote:

The GPIOs (general purpose input/outputs) can sink or source up to ±8 mA, and sink or source up to ±20 mA (with a relaxed VOL/VOH) except PC13, PC14 and PC15 which can sink or source up to ±3mA.

Absolute maximum ratings:

Quote:

  • Output current sunk by any I/O and control pin 25mA
  • Output current sourced by any I/O and control pin 25mA
  • Total output current sunk by sum of all I/O and control pins (2) 120mA
  • Total output current sourced by sum of all I/Os and control pins(2) -120mA

And then there is also the total power supply current, so including the uCs own consumption, which need to stay under a max.

Page 92 gives the voltage levels at some different drive currents, at 20mA there is 1.3V drop from the driving output stage (so 2.0V instead of 3.3V when sourcing, and 1.3V instead of 0V when sinking). This means you also might possibly need to take care of cooling the IC.

So with 18 LEDs without transistors as buffers (or inverter IC) you can use about 6-7mA as absolute max.

posted by Erik - 07 Apr 2014