I have a circuit that it is a STM32F103RET6(Reference Manual) board and one LCD. everything work very well just one thing! PWM! when I use my J-Link debugger to supply the circuit(or USB connector), the PWM is correct. look:


But when I use my switching supply, the output is:


My switching supply is this and I'm using this module to make 5v from my switching supply. the schematic of my board is this:


Please note that when I use my switching supply, everything work very well except PWM.(I mean even the MCU and LCD work very well). in fact, the problem that I have is just PWM. What's the problem? how to figure it out?

  • 1
    \$\begingroup\$ What does the power rail look like on a scope? \$\endgroup\$ – Matt Young May 4 '15 at 18:15
  • \$\begingroup\$ @MattYoung You have asked a question that I always afraid of it, Matt! I don't have Scope. \$\endgroup\$ – Roh May 4 '15 at 18:18
  • \$\begingroup\$ I would beg, borrow, or steal one. Problems like this almost always point at sketchy power. \$\endgroup\$ – Matt Young May 4 '15 at 18:19
  • \$\begingroup\$ What's your logic voltage threshold on the analyzer? Also, have you connected the analyzer to the circuit's ground? \$\endgroup\$ – Scott Winder May 4 '15 at 18:25
  • \$\begingroup\$ @ScottWinder WoW! good question. I did all things that you said and know it's working. Perfect! please provide your answer. I'm waiting to see your answer and accept it. Thanks again Scott. \$\endgroup\$ – Roh May 5 '15 at 5:10

Belatedly closing this loop. Because the logic analyzer doesn't measure an analog voltage, it uses a threshold voltage to determine whether the input is a logical 1 or a 0. There are a few possible causes for the data you're seeing, but the most common ones would be lack of a good ground connection, or "bounce" caused by poor contact with the input (usually from a handheld probe). If the voltage on the input is near the transition threshold, then the logic analyzer's threshold voltage could be a determining factor as well (many logic analyzers allow you to change this voltage, and that would be a good test).


First, that REG1117 is a linear regulator, not a switcher. It seems to be connected correctly. The 100 µF and 100 nF caps on the output make sense. The 220 µF on the input makes sense too, but something will low impedance at high frequencies is missing there. USB allows up to 10 µF on the power line, but even just a 1 µF ceramic immediately across pins 3 and 1 of the regulator should be all that is needed. Check the regulator datasheet.

Another problem is the lack of bypass caps for the microcontroller. None are shown. There are two caps off in the lower left corner for no apparent reason, but I count 5 power pin connections, so two caps is insufficient even if that's what C7 and C8 are (in which case they should be labeled as such on the schematic). Not only should there be one per power pin, but they must be physically close to the power and ground pins. Note that there is a ground pin adjacent to each power pin. One cap needs to be close to the chip across each pair of power/ground pins.

Another issue is that 32 kHz crystal has no load caps, but that unlikely has any bearing on the symptoms you are reporting.

The procedure for debugging this is to look at the power voltage at each power pin. Also make sure each ground pin is really at ground. A small break in a ground connection can cause all manner of trouble.

  • \$\begingroup\$ Yes I know that REG1117 isn't a linear regulator and I didn't say it. but I think this is a good answer. Scott Winder found out the problem. look at the comments. anyway, your answer was very good. Thanks again. +1 \$\endgroup\$ – Roh May 5 '15 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.