It could also be wiring problem. When you swap the board around the connectors and cables get moved around and they are working again. Have you tried to wiggle the connectors and cables when the gantry is moving to see if that has any effect?
I've also had some random stalling problems after assembling my machine and they turned out to be my bad crimp connections.