o.k. i see, from your previous schematic the Back emf diode where installed in a weird way, maybe why Alain suggested that. The diode should be in parallel with your motor. Like when you drive a Relay. It's not a bad thing to install a capacitor as well.

Do the calc of Alain's routine with some ADC value. The results have to be bellow 255 or at very least bellow SPWM_RES value... i didn't did it here, but just for safety sake you should check that.