Can upload sketch to Arduino pro mini only once

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

Hi,

 

I have a bootloader issue (I think so).
One of my two Arduino Pro Mini 3.3V 8MHz refuses to upload sketchs. I MUST press reset button to make it upload.

So I have reflashed the bootloader.
That solved the problem. But at subsequent uploads, I have the same error.
In fact, after burning the bootloader, I can upload a sketch only once!
I always need to reflash the bootloader before.

I use IDE option "Burn bootloader". It generates the 2 following commands:

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:i -Ulock:w:0x0F:m

 

My second Arduino Pro Mini works perfectly.

Both are genuine Arduino Pro Mini (Adafruit).

 

I've spent all day searching. From what I've read, these commands seem correct.

So I don't understand what's happening.

Any idea?

This topic has a solution.
Last Edited: Sat. Aug 24, 2019 - 11:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nbenm wrote:
. I MUST press reset button to make it upload.

Replace the cap(C2 0.1uf) that triggers the auto reset when scripts are uploaded, also check the pull up resistor(R2 10k) on the reset line as well on the one that does not work.

Jim

 

edit: added part numbers and values

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Fri. Aug 23, 2019 - 01:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

 

Replace the cap(C2 0.1uf) that triggers the auto reset when scripts are uploaded, also check the pull up resistor(R2 10k) on the reset line as well on the one that does not work.

 

edit: added part numbers and values

Thanks @ki0bk

I'm going to check C2 and R2. For C2 I have an old multimeter with capacitor function.

 

Is there a reason the first upload after burning bootloader works fine? This one is done with a ftdi board.

In fact it's the second upload, as burning bootloader uploads "blink" app. But this one is done with an usbasp.

 

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

nbenm wrote:

ki0bk wrote:

Replace the cap(C2 0.1uf) that triggers the auto reset when scripts are uploaded, also check the pull up resistor(R2 10k) on the reset line as well on the one that does not work.

edit: added part numbers and values

Thanks @ki0bk

I'm going to check C2 and R2. For C2 I have an old multimeter with capacitor function.

I have checked them, they are both good.

R2∽10KΩ

C2∽90nF

 

Another idea ?

 

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

Does the fail to upload only happen with a particular script or any script?   If only with a particular script, can you post it?

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

1. Burn Bootloader

2. disconnect external programmer

3. connect USR-Serial dongle to GND, VCC,  RXD, TXD, DTR pins.

4. Upload sketches via the Bootloader in the normal way ctrl-U

 

Alternatively:

5. connect programmer

6. build sketches and program with ctrl-shift-U

 

If none of your projects use the Serial Terminal the second method is probably more convenient.

 

If your Serial Dongle has got GND, VCC,  RXD, TXD, DTR in a female header,   you can plug it straight into your Pro Mini easily.    And Bootloader works fine.   Just like buying a Nano or Uno in the first place.

 

David.

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

ki0bk wrote:

Does the fail to upload only happen with a particular script or any script?   If only with a particular script, can you post it?

It happens with any script. Blink app, and a big one of mine.

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

nbenm wrote:
It happens with any script. Blink app, and a big one of mine.

Ok, but only on that one pro-mini, the other works ok, is that right?

Follow david's advise above, if it still does not work, time to buy another.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Hi David,

 

Method 2 works fine. I use CMD-shift-U because I'm on Mac.

I disconnect TX and RX for doing that, because they are connected to a Sigfox module.

This is not a problem for me.

 

Method 1 works fine with one Pro mini (remember I have two)

With the second Pro mini it works once only. If at step 4 I want to upload a new sketch, or the same one, it hangs.

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00

.

.

.

 

I have a third method that works too. When the sketch begins compiling, I press the reset button. And it works.

 

My serial dongle is connected as you say. But I use Dupont wires as the dongle has male header.

 

The reason why I'm posting here is that I want to understand what's happening.

Why one board works fine and the other doesn't.

 

 

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

Proper Arduinos have onboard USB-Serial.   Bootloader is painless.

 

Method 2 is probably easier for a Pro Mini.

 

If you have a USB-Serial permanently connected to the Pro Mini it is worth installing a Bootloader.

Note that you must always select the correct Board when burning Bootloader i.e. 8MHz or 16MHz.

 

Most Bootloader problems are :

1.  pressing Reset button fast enough (or a good DTR signal)

2.  using the correct baud rate e.g. 57600 baud, 115200 baud,  38400 baud, ...

 

If you selected the correct Board,  it should burn the correct Bootloader.

 

David.

 

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

ki0bk wrote:

nbenm wrote:
It happens with any script. Blink app, and a big one of mine.

Ok, but only on that one pro-mini, the other works ok, is that right?

Follow david's advise above, if it still does not work, time to buy another.

Yes, it happens only with this one.

I think you are right. It's best to buy a new module.

 

Just a last thing. On the "bad" module I have removed the regulator, and the power led.

I want to save power. My board is battery powered, and I want it to last months.

I've done this in a clean way, using microscope.

Can it be the reason?

 

 

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

david.prentice wrote:

If you selected the correct Board,  it should burn the correct Bootloader.

As I said to Jim, I will buy a new module.

 

Thanks to both smiley

 

Bye

 

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

nbenm wrote:

I have a third method that works too. When the sketch begins compiling, I press the reset button. And it works.

 

david.prentice wrote:

1.  pressing Reset button fast enough (or a good DTR signal)

 

Most dongles have DTR or RTS signal.   This should provide a Reset pulse (via the DTR capacitor on the Pro Mini)

 

It is this Reset pulse that makes modern Arduinos "nice to use"

If you have to press the Reset button at exactly the right time it is painful.

 

David.

 

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


nbenm wrote:

I have a third method that works too. When the sketch begins compiling, I press the reset button. And it works.

Suggests the reset mechanism isn't working.  DTR pulls the reset pin low, and a capacitor + resistor on the prop mini turns it into a short pulse resetting the avr, then the bootloader takes over.

 

nbenm wrote:

Just a last thing. On the "bad" module I have removed the regulator, and the power led.

I want to save power. My board is battery powered, and I want it to last months.

I've done this in a clean way, using microscope.

Can it be the reason?

Possibly.  Are you certain you affected nothing else?

 

The reset capacitor/resistor require VCC to be present.  If you somehow managed to cut or damage a trace or component involved in that, it would prevent the DTR signal from triggering a reset and starting the bootloader.

 

Why does it work once?  With a blank application section, execution eventually reaches the bootloader anyway.  The bootloader runs, finds no-one wants to talk to it, and re-launches the app... which eventually reaches the bootloader, which... etc.

 

Once an app is loaded, the bootloader will only ever run once, right after power-up.

 

Check for continuity between:

  • C2 and the DTR input
  • C2 (other side) and the reset pin
  • reset pin and R2
  • R2 (other side) and VCC.

 

"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."

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

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joeymorin wrote:

nbenm wrote:

I have a third method that works too. When the sketch begins compiling, I press the reset button. And it works.

Suggests the reset mechanism isn't working.  DTR pulls the reset pin low, and a capacitor + resistor on the prop mini turns it into a short pulse resetting the avr, then the bootloader takes over.

I have checked continuity, it was ok.

As you have talked about "pulse", I have measured voltages with a scope.

And indeed, when DTR goes down, there's no pulse on the reset pin.

I have tried with the good arduino, and I can see clearly this pulse

So I have replaced C2, and bingo!

It works fine now.

 

Jim was right yesterday...

 

I had checked C2 yesterday with an old (and cheap) multimeter which has capacitance function.

I see now it was a wrong result.

 

I'm happy now because I have understood reset mechanism, and how the bootloader is run.

 

Thanks to all.

 

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

Jim with the save, Joey with the assist! ;-)

 

Glad you got is sorted.

"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."

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