1
\$\begingroup\$

I have an application that includes a dc motor and a dc generator. I am using stm32f103 blue pill. I am controlling the speed of the dc motor by measuring the voltage and changing the PWM duty cycle on the PA15 pin.

However, today the stm32 burned. Voltage regulator was hot (Around 45 Celsius). Is there a reason for STM32 to draw high current? Is there an error in my schematic?

[![schematic][2]][2]

\$\endgroup\$
4
  • \$\begingroup\$ Once you start messing with motors, there are many things that can go wrong. Is the voltage regulator the only component which is hot? If so it may be damaged itself, but more often there would be something else damaged (MCU stuck in latchup, short, etc) and drawing high current. Also note that in dropping from 12v to 3.3v even reasonable current can lead to overheating if you do not have a suitable heatsink. \$\endgroup\$ Jul 26 '18 at 14:35
  • \$\begingroup\$ Didn't have a heatsink attached to the regulator. Now I am measuring the regulator and it still outputs 3.3V (without load). I checked connections again and there is no short. Of course mcu 3.3 and gnd shorts coz it's death. \$\endgroup\$
    – sinany1
    Jul 26 '18 at 15:15
  • \$\begingroup\$ This sort of thing can be caused by inadequate attention to layout - eg. current from the motor return causing voltages below MCU ground to be applied to an input without enough series current limiting resistance. Unfortunately, the schematic does not help with layout issues. \$\endgroup\$ Jul 26 '18 at 15:49
  • 1
    \$\begingroup\$ @sinany1 Why did you edit this to remove the information about what voltage you are measuring? That makes the question even less likely to be answerable. \$\endgroup\$ Nov 9 '18 at 19:14
0
\$\begingroup\$

What is the peak voltage output of your generator?

Note, that it is connected to ADC with protection diodes. So, positive voltage will go through D2, R3, R5 and if at this point it is higher than Vcc it will open D4 and jump to +3.3V rail.

Sure, you have quite a lot of resistance here, but it does not really matter. High enough spikes from generator will burn your STM32 in no time.

What you really need is zener somewhere (maybe in parallel with R4) to limit voltage input from generator. Also I'd recommend checking the rest of the circuit. The generator output (either positive or negative) might have some other path to jump to the rails.

Also, to measure variable as it is voltage output from the generator you need a low-pass filter. Coincidentally, a capacitor in the circuit before protection diodes could have helped save your STM32 too.

The heating of the LDO is not related to the problem, it is only because of lack of heatsink and huge voltage drop from 12V. I'd recommend using thermal resistance from datasheet to calculate appropriate heatsink, instead of adding second LDO.

\$\endgroup\$
1
  • \$\begingroup\$ Rarely generator peaks to +15V (from the output of D2 ). Your advices helped a lot. I think if I limit the generated voltage to +12V (or maybe +11V to be sure) it will work. Negative voltage is also mechanically prevented. Going to try tomorrow thanks for your help. \$\endgroup\$
    – sinany1
    Jul 26 '18 at 19:39
0
\$\begingroup\$

The schematic as drawn looks ok.

If gen+ got to 12V (worst case) the pins on the STM32F would only receive less then 0.4mA of current even with no protection diodes, which should be fine for the STM32F. With the diodes the limit would be even less, the gen pin looks good.

Any over voltage from the motor should be stopped to some extent by the voltage regulator, to be sure, put a scope on it to make sure when the motor is switched on or off there isn't a problem there.

The diode across the motor should stop flyback in the negative direction so I wouldn't be too worried about that either. But implementation is everything, a bad grounding system (or a diode that isn't installed correctly) could be part of the problem. Make sure your implementation matches the schematic.

The rule of thumb I use with STM32's in max/normal operation is roughly 50mA, so that would be (12V-3.3V)*0.05A = 0.435W which may be why the regulator feels hot. You may want to step the voltage down with two regulators, or get a '7805 series' drop in compatible DC DC regulator.

In my experience STM32's get blown out from overcurrent, if there is too much voltage on a pin and the protection diodes turn on and the maximum rated current for the pin reached.

\$\endgroup\$
1
  • \$\begingroup\$ According to Blue Pill's schematic I can also supply MCU with 5V on 5V pin. I am going to try 7805 tomorrow. Hope it works, thanks for your advices. \$\endgroup\$
    – sinany1
    Jul 26 '18 at 16:40

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.