Reflash Nano V3 if prior sketch uses serial

Hey friends,

I uploaded a sketch like:

HardwareSerial & serial_stream = Serial;
TMC2209 stepper_driver;


void setup()
{
  Serial.begin(SERIAL_BAUD_RATE);
  stepper_driver.setup(serial_stream);
}

Now, sure enough, I cannot flash and get the classic avrdude: stk500_getsync().

This kind of makes sense. My sketch clobbered the serial interface... how possibly could USB/serial work again in flash mode? I tried some randomly timed board resets during upload without success.

Is there some black magic i can do?

I found this guide. Will give it a shot: Installing an Arduino Bootloader - SparkFun Learn. Has ICSP programming instructions

Take these steps:

  1. Power off the board completely
  2. Remove the USB cable
  3. Hold down the Reset button
  4. keep it held down (or, run a jumper wire from the RESET pin to the GND pin).
  5. Still holding down Reset reconnect the USB cable.
  6. Start uploading a sketch that does not have this problem (I use the Blink sketch).
  7. When you see the Receive light blink, release the Reset button
  8. Change your code and add a delay(3000), or more in setup(). This allows easy recovery from a serial flood.
    Note: I have seen this happen several times when I flood the serial output. An indication is the TX light is stuck on.

90% of my programs use Serial in some form or another so I have serious doubts that your "sure enough" is a valid statement.

You might have accidentally changed the processor under tools -> processor.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.