Can't download new sketch after changing serial speed

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was diddling around with an AT09, trying to talk to it.  Eventually, it became obvious.

 

In any event, I was using the SoftwareSerial library to talk to the AT09, and regular serial (through usb) to talk to the serial monitor.  (gee, these aren't the same AT codes I was using in 1982!).  I could happily talk to it.  I used "Serial.begin(9600);", which seems to be the source of my problems.

 

The sketch still runs and responds, but it won't take a new one. (It has been disconnected for a matter of days, and I've unplugged several times).  The green light stays on, the red flashes, and I get

 

      User configuration file is "/Users/hawk/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.wchusbserial1420
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

I've tried hitting reset as compile finishes, holding it down as I apply power trying to hit at various times at the end of the compile, and whatever I do, the old sketch runs.

 

It even sends my test messages (such as ***splat***!) back to the serial monitor.

 

I'm using the same computer with the same cable as when I could change it before, and I've installed the arduinio side on another computer, with the same results.

 

I've put the drivers for the 34x chinese chips on both, and it clearly talks to and sees the chip.

 

The board is a nano clone with mini usb on board.

 

I'm not being a path out other than starting with another board . . .

 

any suggestions would be appreciated.

 

thanks

 

hawk

This topic has a solution.
Last Edited: Wed. Oct 10, 2018 - 04:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not enough info for us to help, start by showing us...

1) you AVRDUDE command line (copy/paste, do not type)

2) AT09?  Attiny9?  (if so, then what arduino core are you using? or bootloader s/w?) Show your schematic including how you connect it to your serial interface, or at least a clear picture of the setup

3) show us the sketch that is running on the AT09 and the one your trying to upload to it.

 

Jim

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

Not enough info for us to help, start by showing us...

1) you AVRDUDE command line (copy/paste, do not type)

 

Clipping the compile data and the command, and response, 

 

Sketch uses 444 bytes (1%) of program storage space. Maximum is 30720 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

/Users/hawk/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/hawk/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.wchusbserialfd130 -b115200 -D -Uflash:w:/var/folders/zw/80mmg8352gqb2ldt_d0k9qhr0000gn/T/arduino_build_403974/null_1001.ino.hex:i

 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch

 

         System wide configuration file is "/Users/hawk/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"

         User configuration file is "/Users/hawk/.avrduderc"

         User configuration file does not exist or is not a regular file, skipping

 

         Using Port                    : /dev/cu.wchusbserialfd130

         Using Programmer              : arduino

         Overriding Baud Rate          : 115200

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

 

avrdude done.  Thank you.

 

An error occurred while uploading the sketch

ki0bk wrote:

 

 

2) AT09?  Attiny9?  (if so, then what arduino core are you using? or bootloader s/w?) Show your schematic including how you connect it to your serial interface, or at least a clear picture of the setup

ki0bk wrote:

 

 

At this point, it's not even in the circuit; that's just why the sketch has serial commands at all.  I have SPST switches to ground on D3 and D4, and LEDs with 330 Ohm limiters on D9 & D10.  But that's not the problem; the circuit works and they do their thing.

 

The problem is that I cannot put *any* other sketch onto it, and this sketch survives and does its thing in spite of my efforts to overwrite it.

 

ki0bk wrote:

3) show us the sketch that is running on the AT09 and the one your trying to upload to it.

 

I'm not running on the AT09; it was on there there to play with bluetooth and serial.  (Ultimately, I expect to use  the AT09 or some such as a controller, but right now I'm still trying to get the basics going . . .)

 

The controller is a chinese nano clone, with a 328p and programmed through the mini usb connector.

 

The sketch that won't go away is 

 

#include <SoftwareSerial.h>

//use 11 & 12for RX & TX


int off3 = 0;
int off4 = 0;

int btTx = 12;
int btRx = 11;

SoftwareSerial btSerial(btTx, btRx);


void setup() {
  // put your setup code here, to run once:
  // buttons on 3 & 4
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);

  // LED on 9 & 10
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  Serial.begin(9600);
  while (!Serial) {};

  Serial.println("***splat***!");

  btSerial.begin(9600);

  Serial.println("***wham***!");



}

void loop() {


  if (btSerial.available()) {
    //  Serial.println("Data coming:");
    Serial.write(btSerial.read());
  }

  if (Serial.available()) {
    //Serial.println("Sending ");
    btSerial.write(Serial.read());

  }

  if ((digitalRead(3) == LOW) && (millis() > off3)) {

    off3 = millis() + 1000;
    digitalWrite(10, HIGH);
    // Serial.print("button 3 ");
    //Serial.println(off3);
    btSerial.write("AT\n");



  }

  if ((digitalRead(4) == LOW) && (millis() > off4)) {

    off4 = millis() + 1000;
    digitalWrite(9, HIGH);
    // Serial.print("button 4 ");
    //Serial.println(off4);
    btSerial.write("AT");



  }

  if (millis() > off3) {
    digitalWrite(10, LOW);
  };
  if (millis() > off4) {
    digitalWrite( 9, LOW);
  };

}

 

I know that the sketch is running, as the LEDs indeed come on for about a second when their corresponding buttons are pushed.  I also get the splat/wham messages on the IDE serial console.

 

There isn't even a particular sketch that I want on it that is the issue.  I've tried both the blank sketch that the editor comes up with, and this triviality:

 



void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
  while (!Serial) {};

  Serial.println("***splat***!");
}

void loop() {
  // put your main code here, to run repeatedly:

}

IN both cases, all 10 attempts to write are made, with all 10 "not in sync:" responses, faster than my eyes can follow. (and, now that I think of it, isn't there supposed to be a wait of some tens of milliseconds between?)

 

I've tried holding down the reset button while inserting USB, holding it until compile, and every variation of this that I can think of (most of which aren't really variations), and it stubbornly stays put.

 

My working assumption is that when I initiate the serial console to 9600, this is somehow blocking the side coming in at a higher speed.

Thanks

 

hawk

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I miss understood, you have a nano clone the you were able to upload to one time and now you are unable to upload a new sketch.

 

If this is a normal nano, you need an external serial interface to connect the usb cable to it, correct? 

And you have selected from the Tools/Boards menu the Arduino Nano, correct?

 

If the above is correct, the DTR line from the USB interface triggers the reset pin on the nano, some china made nanos have been reported as having a 1k pull up on the reset line, which is too small, should be 10k.

That will have the problem your setup is showing...   

How skilled are you at replacing the SMD resistor on the nano?   You could try just removing the pull up resistor, use a solding iron, bridge both ends of the resistor with a large blob of solder and use tweezers to lift the part off the board.

It's easier to do then to type out how to do it!  video: https://www.youtube.com/watch?v=...

 

Jim

 

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have overwritten the boot loader.  That most likely causes getsync() errors on the PC that is trying to write to an Arduino. 

 

What is a AT-09?  Is it a BLE Bluetooth 4.0 Module TI CC2541 (HM-10)?  Are you trying to write code to this board from your PC and are receiving getsync() errors?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
You have overwritten the boot loader
How do you conclude that?  The only avrdude command lines the OP has show us use -c arduino.  You can't overwrite the bootloader by talking to the bootloader.

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:
How do you conclude that? 
+1 

 

Though I guess we should ask OP the question: "have you ever connected an ISP programmer or a debugger to this board?"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Ok, I miss understood, you have a nano clone the you were able to upload to one time and now you are unable to upload a new sketch.

[\quote]

 

Yes, exactly.

 

I successfully uploaded a few for the original LED program, and after with the AT-09, and a week later, could not replace it.

 

 

 

 

ki0bk wrote:
  If this is a normal nano, you need an external serial interface to connect the usb cable to it, correct? 

 

No, it was programmed exclusively through its onboard mini USB connector. Or did you mean the external connection from its USB to the mac?

 

 

ki0bk wrote:
 

And you have selected from the Tools/Boards menu the Arduino Nano, correct?

 

Yes.  Also:

processor:ATMega328p

port: /dev/cu.wchusbserialfd130 (although his varies, but always matches /dev)

programmer: arduino as ISP (although I"ve tried others)

 

 

 

ki0bk wrote:
 

 

  If the above is correct, the DTR line from the USB interface triggers the reset pin on the nano, some china made nanos have been reported as having a 1k pull up on the reset line, which is too small, should be 10k. That will have the problem your setup is showing...    How skilled are you at replacing the SMD resistor on the nano?   You could try just removing the pull up resistor, use a solding iron, bridge both ends of the resistor with a large blob of solder and use tweezers to lift the part off the board. It's easier to do then to type out how to do it!

 

It's been 20 years since I had a reason to replace a surface mount, but I did it several times for the fuse on my Powerbook 180 (a $2 fuse or a new motherboard isn't a hard choice . . .)

 

I don't have any surface mount resistors around (or any other SMD save for a few ICs when I wasn't paying close enough attention . . .).   

 

If I remove it, will a 10k to ground from DTR on the breadboard do it?

 

Or, for that matter, adding a SPST switch between DTR and ground?

 

As I look at the device, it seems I have a row of four 102 resistors below the four LED indicators.These are all I see other than the connectors, reset button, air, and what I think is a crystal.  They would also seem to be the current limiting resistors for the LEDS, and at 1k that I looked up for a 102 online, would give about 2ma, which seems right.

 

I don't see any more resistors: