[Pro Mini clone] Can only upload once

Hi guys out there :slight_smile:

Finally starting into the world of arduino.
I got some Pro mini clones which came without bootloader. I googled around a bit and found a way to write a bootloader with a Raspi Pi. So this all works nice, but i got a big problem, i can only upload a sketch once with the arduino IDE (TTL USB adapter with DTR)

I recon that the upload overwrites the bootloader, because mayyyybe the fuses are not locked?

Here is how i upload the bootloader

1st open fuses

avrdude -c linuxspi -p atmega328p -P /dev/spidev0.0 -b 115200 -e -u -U lock:w:0x3f:m -U efuse:w:0x05:m -U hfuse:w:0xDE:m -U lfuse:w:0xFF:m

2nd upload and lock

avrdude -c linuxspi -p atmega328p -P /dev/spidev0.0 -b 115200 -U flash:w:/usr/share/arduino/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex -U lock:w:0x0f:m

After this the LED13 blinks. Now I hook up the Pro Mini to the USB TTL Adapter and upload a sketch with Arduino IDE - this works perfectly, but when i try to upload a second time neither the LED13 blinks (as a sign for reset over DTR) nor the IDE uploads, instead i get the famous message of not in sync an programmer not responding.

I hope you guys can help me on this.

Greetings and thank you - Wayan

The boards.txt file which comes with the Arduino IDE has the fuse settings in it for you to go look at.

Where it is depends on your app install location. The full path on my Mac computer is

/Applications/Arduino.app/Contents/Java/hardware/arduino/avr

On my Windows computer it is

C:\Program Files\Arduino\hardware\arduino\avr

On my Linux computer it is

/home/David/Applications/arduino-1.6.5/hardware/arduino/avr

Have a look at those values in the boards.txt. I believe you need the high fuse set to DA and that turns on the BOOTRST fuse bit, and that tells it to run the bootloader on reset. You can see what the different values do here: http://www.engbedded.com/fusecalc/
A fuse calculator like that, combined with googling for what the different settings mean, combined with the datasheet for the ATmega328P will really get you familiar with the inner workings...

If it still won't load a second sketch after setting the high fuse to DA, then look at the DTR pin connection to the correct pin on the Pro Mini, should be connected to GRN or DTR depending on the markings the manufacturer decided to put on the Pro Mini.

Hm, I tried that, but it didn't work.
While the first uploading, I get a DTR blink, but nothing happens at the second upload :frowning:
DTR is connected correctly. I have a second clone from another manufacturer - there a second upload works without problem.

edit: checked with pressing the reset button, that works sometimes... so you seem to be right with the DTR pin, but it is wired right... at the clone there DTR is marked... scratching my head

Good night an sleep well everybody!

A single serial upload per bootloader installation is a classic symptom of the Auto Reset feature not working. Perhaps your system is not toggling DTR as it should or the clone hardware is not implementing Auto Reset correctly. Try holding down the Reset button (or the Reset pin if you don't have a button) and release it when you see the RX light blink after you start an upload. If that (manual reset) works you should investigate the Auto Reset further.

I like to make a logic probe on a breadboard to troubleshoot that sort of thing. I connect the Arduino's VCC to a 220 ohm resistor and other side of resistor to anode of LED, then cathode of LED to a wire, and then poke around with the wire. If you hold it on DTR and click upload, the LED will come on and stay on during the upload attempt. Hold it to RST and it should flash only at the beginning of the upload (it actually flashes a couple of times in quick succession). If you don't see that, the problem is the DTR capacitor. On a Pro Mini, it could have fallen off, was a bad part, or had an inadequate solder job. I've had a Nano which lost parts before. That Nano is now in my spare parts pile ready to cannibalize.

Guys, just don't laugh at me :frowning:

I had a quick look in the morning and the DTR pin was connected with an empty lilac wire, the DTR wire is grey on my programmer... yesterday evening the colors looked the same :frowning:

When I'm home from work i will have a look if that was the problem :slight_smile:

Greetings and have a nice day

Wayan