Hello everyone.
I'm trying to bootload an ATmega328p with an external 8MHz Quarz using an Arduino Pro Mini 3.3V 8MHz as ISP.
Sounds straightforward, but it isn't. Bootloading seems to work, but I cannot upload sketches. I've been playing around with this for quite some time, so I decided to ask for help.
I'm using Windows 7 and Arduino ISE 1.8.2.
Preparation:
I proceeded pretty much like in this tutorial:
However I use an FTDI board to get the RX/TX/DTR signals to the Arduino and an external voltage regulator to get the 3.3V to the ATmega and Arduino Pro Mini. This seems to work well.
I have read there should be a small capacitor between GND and reset of the ATmega, so I added one. Also I put a 10µF capacitor between VCC and GND, as some people recommend this to stabilize the power supply.
I have tried a 10 kOhm and 120 Ohm pullup resistor at the ATmega reset pin, as there are different suggestions out there.
I uploaded the ArduinoISP sketch to the Arduino Pro Mini using Board: "Arduino Pro or Pro Mini", Processor: "ATmega328 (3.3V, 8MHz)
The upload looked good.
Bootloading:
I connected the green/yellow jumper wires of the diagram to connect the Arduino with the ATmega.
As suggested I used "Arduino Duemilanove or Nano w/ ATmega328"
(Although I also tried it with "Arduino Pro or Pro Mini" and "Arduino/Genuino Uno"(optiboot). It didn't make a difference.)
Then I changed the Programmer to "Arduino as ISP" and hit Burn Bootloader.
That also looked fine, avrdude said it's done.
avrdude.exe: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
Using Port : COM13
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: safemode: hfuse reads as DA
avrdude.exe: safemode: efuse reads as FD
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: reading input file "C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\atmega\ATmegaBOOT_168_atmega328_pro_8MHz.hex"
avrdude.exe: writing flash (32652 bytes):
Writing | ################################################## | 100% 0.13s
avrdude.exe: 32652 bytes of flash written
avrdude.exe: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\atmega\ATmegaBOOT_168_atmega328_pro_8MHz.hex:
avrdude.exe: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\atmega\ATmegaBOOT_168_atmega328_pro_8MHz.hex:
avrdude.exe: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\atmega\ATmegaBOOT_168_atmega328_pro_8MHz.hex contains 32652 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 0.15s
avrdude.exe: verifying ...
avrdude.exe: 32652 bytes of flash verified
avrdude.exe: reading input file "0x0F"
avrdude.exe: writing lock (1 bytes):
Writing | ################################################## | 100% 0.06s
avrdude.exe: 1 bytes of lock written
avrdude.exe: verifying lock memory against 0x0F:
avrdude.exe: load data lock data from input file 0x0F:
avrdude.exe: input file 0x0F contains 1 bytes
avrdude.exe: reading on-chip lock data:
Reading | ################################################## | 100% 0.02s
avrdude.exe: verifying ...
avrdude.exe: 1 bytes of lock verified
avrdude.exe: safemode: hfuse reads as DA
avrdude.exe: safemode: efuse reads as FD
avrdude.exe: safemode: Fuses OK (E:FD, H:DA, L:FF)
avrdude.exe done. Thank you.
I also tried this step with a 120 Ohm pullup resistor on the Arduino Pro Mini, as I read the autoreset has to be disabled. But it didn't make a difference.
Uploading a sketch - Here the troubles start:
If I now disconnect the ATmega from the Arduino, connect TX/RX/DTR from the FTDI to RX/TX/reset of the ATmega, I just get the well known "programmer is not responding" error.
What I have tried & tested:
The wiring seems to be correct (I replaced all juper wires, checked again the ATmega pinout in the manual, switched TX and RX in case the FTDI has it labelled wrong, tried to manually reset the ATmega right before the FTDI lights flash briefly...).
I successfully used the FTDI programmer to program the Arduino, so it shouldn't be the FTDI programmer's fault.
I tried it with another ATmega and another Arduino Pro Mini, it's the same result.
I tried programming the blink sketch indirectly onto the ATmega using the Arduino as ISP and this worked well. So the ATmega itself isn't dead.
I tried another optiboot bootloader (optiboot_atmega328_pro_8MHz.hex) and created a new boards.txt entry, but no change.
I connected an LED to pin 19 of the ATmega. The LED repeatedly flashes three times quickly, but as soon as I try to upload a sketch the upload fails and it stops its funny flashing.
As suggested in Unable to write bootloader to arduino via arduino as ISP - Microcontrollers - Arduino Forum I tried the Atmega_Board_Programmer tool using the suggested 8MHz bootloader, but the problem persists.
I also tried using an Arduino Nano as ISP also powering the ATmega with 5V (using a 16MHz Quarz) with the same result.
I'm out of ideas right now and also browsing quite a lot of tutorials and forums didn't lead to a working solution. :o
Does anyone spot a mistake in my description or has suggestions what to try next?
Is there a possibility to check whether a bootloader is working properly? If the LED flashes, the bootloader is running, I guess.
It shouldn't matter what Arduino I use as ISP, does it? (As long as I make sure to choose the right board in the ISE)
I am just curious, because nearly all tutorials use the Uno but I don't have an Uno (yet? ^^)..I don't see why it shouldn't work with a Pro Mini or Nano.
Thanks in advance!