The story of a mishap...
Here's one of my projects at work, of which I blew up the MCU quite stupidly. The board is a motor controlling unit that uses stall currents to stop the controlled motors. It drives up to 2 motors and has 4 SPST relay outputs. Motors are powered by an IC that I re-used from my predecessors' project. The difference is my board uses miniature OMRON H-bridge relays instead. The absolute maximum current is 23 amps, as per MEGA-FIT connector specs.
The microcontroller is an Atmel ATmega64M1 as shown on the picture. The firmware has several configuration options such as inrush delay, power on delay and threshold (stall) current. There's also a stall delay that is zero by default. The latter delay allows a motor to run on even though the stall current was reached. The configuration can be changed by plugging a USB cable and connecting it to any computer with a VT100 terminal emulator (that's the purpose of the MCP2221).
When motor currents fall within the specs even when stalled, all is well. All motors my unit drives stall at no more than 20 amps... with one exception: our sunroof motor. The latter is a rather old unit that stalls at more than 30 amps! As I didn't have time to upgrade the board for stronger currents, I decided to give it a go.
Unfortunately the rooftop didn't close even with a current limit of 20 amps. I don't know what I had in mind that day but I enabled the stall delay and set it to 1 second... I lost all communications with the unit all of a sudden. I took the board off the car and plugged it to my test bench and then... smoke!
I quickly realized the VND600, which is rated for 25 amps maximum was blown without a hint, which incidentally caused its inputs to be shorted to ground. Had I driven the VND600 inputs with the MCU internal pull-ups instead of setting the outputs directly, I would have spared the microcontroller.
That experience also stresses on the fact you need to be extra careful also designing the firmware as well. I didn't use intermediate resistors to drive the VND600 here, which would not have been a problem if I had enabled the MCU port pull-up circuitry. Also the now obsolete
VND600 has no current limitation internals, which modern drivers, like the
VND5xx series have.
Call it a lesson learnt ;-) .