Arduino IDE get stuck while uploading sketch
Is the motor driver connected to the Arduino while you program it? 

When the Arduino is reset, the output pins on the Arduino are driven high. If too much current is drawn though any of these pins, then the voltage supply to the ATMega328 may drop, and the ATMega328 gets stuck in a brownout.