You may need TVS transient suppressors right across your load.
incomplete. Vin ? show EXACTLY WHAT is connected here and how
"Incomplete" is putting it mildly, that's literally the most important part of the problem.
The 2 ohm current sense resistor suggests a motor...Why the OP is converting the PWM to dc is unclear