I keep frying MCUs - Page 1
Forum section: electronics / projects

author: angust_uk
author_rank: Regular Contributor
timestamp: January 18, 2024, 01:28:41 pm
content: I've built a very simple board which is part of a larger system and controls a small DC motor on receiving commands over USB. The motor's end stops are monitored by slotted opto switches, and it is driven by a DRV8220 H-bridge.The issue I'm seeing is that 3 boards of 10 (so far) have become damaged during operation, where the sympton is the STM32 heating up (I will do further analysis once I get the boards back from my client!). I know there are multiple things that may cause this, but I was after some suggestions of additional protection I could add to try and reduce the chance of this reoccuring.I am already planning to add a TVS across the DC input, and a 3.3V Zener across the motor's shunt resistor (which is connected directly to an ADC pin on the MCU).Is there anything else I can add as a 'belt-and-braces' approach to try and make this more robust?(Note that the rest of the system is outside my control, but what I do know is the board is connected to an 'industrial' USB hub, and is powered by a good quality 12V supply)

author: Siwastaja
author_rank: Super Contributor
timestamp: January 18, 2024, 01:38:51 pm
content: DRV8220's GND connected through 1R seems like colossally bad idea. All the pins are referenced to this GND, which now rises higher. Use direct connection and do current sensing otherwise, e.g. high side on Vcc, at which point add a sense amplifier to reject common mode signal and reduce the voltage drop needed. For a quick fix you can try to reduce the resistance value significantly so that voltage drop is just some 100-200mV or so with worst case maximum motor current, but quite obviously your measurement accuracy will be very poor then, but maybe it's still good enough indication of motor stalling etc.?

author: angust_uk
author_rank: Regular Contributor
timestamp: January 18, 2024, 01:44:30 pm
content: Thanks SiwastajaThe sense resistor arrangement was suggested in the datasheet, though admittedly a smaller value. I will change this for a smaller part, and take the hit of lower measurement accuracy

author: Siwastaja
author_rank: Super Contributor
timestamp: January 18, 2024, 01:51:14 pm
content: Yeah, it says 0.5V max across the shunt resistor and you have to consider this is the worst case peak value, and indeed they have actually used 150mV max for the actual calculation which lines up with my earlier recommendation of 100-200mV. For a rough idea about motor stall vs. normal operation, the accuracy probably is good enough. You can experimentally just stall the motor and apply maximum DC input voltage and measure the voltage drop over that shunt resistor and make it smaller until you hit something like 200mV. With a 12-bit ADC using internal 1.1V reference (I don't remember if that STM32 had that, but whatever), 200mV would still be 744LSBs, so plenty of resolution, but lacking differential measurement ground shifts around your board cause a significant error, maybe 10-20% of total range?Note that your RC filter doesn't filter much because of the very low impedance. Compare to datasheet example (fig 9-23): you need to add larger value series resistor between your R4 and C5. This RC filter would also protect against short peak voltages, the C5 alone doesn't do well.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 18, 2024, 10:39:17 pm
content: I suppose it's for current measurement? I would really suggest going for a high-side measurement instead and connect the driver to GND directly. This kind of low-side arrangement makes me cringe. And yes, as said above, you should at the very least use a much smaller value (did your realize that 1A across 1ohm is 1V drop, making the driver IC basically impossible to control with its logic inputs?), but still - I don't like it. Trying to save the cost of an added current sense amplifier (which would maybe add less than 50 cents to the design) is definitely not worth it here.Other than that, beside TVS diodes, I would add a fuse in series with VUSB and another one in series with the 12V in.