Hi
For several years I've been using an Arduino Uno as an ISP to burn bootloaders and upload sketches to different Arduino compatible chips through SPI communication. Common to all my past projects is that I haven't been using external clocks (crystals) for the target chips.
I've recently started work on a project where the target chip is a ATMEGA328PB-AN (SMD) clocked with an external 16MHz crystal. The chip was bought from Mouser. I'm now having trouble burning the bootloader onto the chip.
My method:
-
I soldered up the Atmega, crystal, 22pF crystal caps and 100nF bypass caps as well as a header socket for communication with the Arduino on my custom target PCB. No other components are present on the PCB at this time. All connections have been tested with a DMM.
-
I connect my programmer Arduino Uno with a custom level shifter PCB shield to the target PCB. The Arduino and custom shield is working correctly when used together with my other Arduino compatible projects. The Shield connects pins D10,11,12,13 of the programmer Arduino Uno to the RESET, SCK, MISO and MOSI pins of the target Atmega via level shifters. The target Atmega is powered by the 3.3v output of the programmer Arduino Uno board. Additionally the RESET pin of the programmer Arduino Uno is connected to a 10uF cap to ground.
-
In Arduino IDE I select "Arduino/Genuino Uno" and "Arduino as ISP" and then select "Burn Bootloader"
-
I receive the following error message:
Arduino:1.8.5 (Windows 10), Card"Arduino/Genuino Uno"
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.
An error occurred during bootloader burning.
If i attempt to upload a blank template sketch to the target Atmega I receive the following error:
Arduino:1.8.5 (Windows 10), Card"Arduino/Genuino Uno"
Archiving built core (caching) in: C:\Users\xxx\AppData\Local\Temp\arduino_cache_334018\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfb
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0
I've also tried the "ATMEGA328-PB testing" (github link) without success, producing the following error message:
Arduino: 1.8.5 (Windows 10), Board: "ATmega328PB Crystal Clock, 16 MHz"
***failed;
avrdude.exe: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xf5 instead of 0xfd (double check with your datasheet first).
avrdude.exe: Expected signature for ATmega328PB is 1E 95 16
Double check chip, or use -F to override this check.
Error while burning bootloader.
Also tried the minicore boards which gave the following error:
Arduino: 1.8.5 (Windows 10), Board: "ATmega328, Yes (UART0), 328PB, BOD 2.7V, LTO disabled, External 16 MHz"
avrdude: 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 WunschSystem wide configuration file is "C:\Users\knuto\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328PB
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
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
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Programmer 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 usavrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.avrdude done. Thank you.
Error while burning bootloader.
I've googled the issue, but have been unable to find an explanation for why this is happening. I've checked all connections which leads me to believe that the issue is with my method itself rather than the execution of said method.
Hope someone have suggestions for what to do different.
Append: Would I have an easier time if I went with a ATMEGA328P instead of the PB? I kinda ordered the PB-type by mistake. Should I expect my original method to work if I use a P in place of the PB?