Electronic – Burnt MOSFET in the following circuit. Why

failuremosfet

I made the following circuit. As the test load I used 10cm of a standard 12V LED strip to be sure I don't sink too much current.

Used 5V from uC to drive the circuit, toggling it on and off every second. It seemed to work properly but after literally a dozen of cycles M1 exploded loudly with a flame, permanently shorting its' drain and source.

What was wrong? According to datasheet, M1 can withstand over 2A of continuous current. Any ideas why it failed?

schematic

simulate this circuit – Schematic created using CircuitLab

EDIT:
D1 is a red diode which turns on whenever the main load is under power (theoretically). I'd like to keep it within this circuit but can also move it away to another pin and toggle by software.

Best Answer

Hypothesis: you are not fully turning on the M1 and its channel resistance remains fairly high, which cause it to overheat.
That's cause by not driving the VGS of M1 low enough.
That's caused by not driving VGS of M2 high enough.
That's caused by presence of a diode drop of D1 at the M2 source. D1 is an LED, so the diode drop could be, say, 1.7V.

Try the following.
Remove D1 and replace it with a short.
Remove R2 and replace it with a short.
Test the circuit.