Why am I seeing voltage spikes on the output of an LM2596?
I advise you to reconsider the design and consider the following:
Etch away as little copper as possible. Reduce the impedance of the lines on the circuit board. Define a single ground point.
Use the two layers properly.
Do not let the inputs, especially on logic components, float.
When it comes to switching power supplies, the quality of the capacitors used is very important. POSSIBLY. Ceramic capacitors can be placed very close to the source of interference.