I am working on two stepper motors and trying to control them using RPi3(Ubuntu mate) with A4988 motor drivers. I successfully managed to drive the motors with external 12V battery source. After sometime, I tried to test the circuit again but now the RPi is heating up and not booting. I don't know what happened. Please help

The red LED is glowing but its not booting. Also I am only connecting the stepping mode pins and STEP, DIR pins of the A4988 to the RPi. There are two motors whose Vdd and Vmot pins are connected together.
An LM2596 is used to step down (12v to 5v) the voltage used for Vdd

Update: I checked each of the A4988 drivers,they are in working conditions. Only the Rpi got fried.
I hope somebody could explain ,why only the Rpi got fried?
and What are the precautions to be taken to ensure this does not happen again?

Update2: I used another Rpi to test the same circuit and its working fine.
I think the reason for the RPi getting fried is that there was an open 12V wire coming from the source which might have accidentally touched the RPi.

I tried booting the fried Rpi and I found that it's actually booting up, but the processor is heating up. I don't know the reason for this behaviour. I read something about the polyfuse which takes time to reset. Maybe the polyfuse might have blown and now resetting.