D1 shunts the current due to the inductance of the motor armature winding (This is NOT the same thing as the voltage generates while still spinning. It is the opposite polarity to that.)
Without D1 there would be high voltage spikes which here is shunt by the D1. It also helps to maintain the current through the motor during the PWM off time.
Explanation from another user in another forum for the same question i had asked.
As mentioned above, that doesn't break the motor. The energy stored in the motor's inductance is tiny, compared to the mechanical inertia, which generates a voltage a little lower than the supply voltage, assuming it's running at full speed. Try turning the shaft with that circuit connected, then again with nothing connected and note that it makes little difference. Now try turning the shaft with the motor's terminals short circuited and note how much more difficult it is to turn. If it's a small motor, without a gearbox, the difference may not be noticeable, as the torque will be tiny but it will be with a larger or geared motor.
My previous schematic was incomplete as the PCB was not clear. I've removed all the components and looks good now.
D1 is a dual diode with common Anode. The working is like this when in the OFF State as seen in the schematic, current flows from M2 through D1 and into the M1 of the motor. Making it a dead short aka Dynamic Brake.
In the ON State current flows through M1, through M2 and D1, when the Gate of Q1 is pulsed it conducts and completes the circuit.
That looks right, but you've got the values of R1 and R2 wrong. 400Ω is far too high and will drop such a high voltage, hardly any current will flow through the motor. The letter L is used to denote milliOhms and R1 and R2 are marked 4L0, which means 4m0, so they're 4mΩ or 0.004Ω. See the links below for more information on SMD resistor marking.
https://www.rohm.com/datasheet/PMR18EZPFV/pmr-ehttps://www.vishay.com/docs/20020/smdmark.pdfTry measuring R1 and R2 with a multimeter and they should read short circuit, as their value is well below the minimum resistance most multimeters can reliably read.
The circuit short circuits the motor, which is fine for a load without too much inertia, as the motor can safely dissipate the energy in its windings, but it will be no good in an application such as an electric vehicle, which would cause the motor, wiring and switch to overheat, especially when going down a hill. In applications which require breaking a large mechanical load, the motor is briefly short circuited, the current monitored until it exceeds a certain level, then it's connected back up to the battery for long enough for the voltage generated by its inductance to be clamped by the battery, before being briefly short circuited again. The motor's inductance is being used as the inductor in a boost converter, with the load, being the battery and the supply voltage the back-EMF generated by the spinning armature.