ATMEGA1284PU Breadboard Problems

I’m trying to get a minimal breadboard setup with a 1284P. The MCU is a raw MCU that I bought from Digikey and presumably there is no bootloader (but I don’t really need one because I use ISP to program). I have what I think is the minimal circuit:

XTAL1 & XTAL2 => 22pf connected to 16mhz Crystal => GND
VCC & AVCC => 5V with a .1uf decoupling cap
GND => GND
RESET => pulled up with 10k to 5V
MISO, MOSI, SCK RESET, GND & 5V connected to an AVR Dragon programmer

The problem I’m seeing is that when I run AVRDUDE to read the device signature the results are wrong and different every time. I’m running AVRDUDE with “avrdude -Cavrdude.conf -V -patmega1284p -cdragon_isp -Pusb”.

I get the output below but the device signature is a different value every time I run it.

Any ideas what could be wrong with my setup? Could the problem be a bad crystal?

avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is “/home/wesw/dev/arduino-1.8.6/hardware/tools/avr/etc/avrdude.conf”
User configuration file is “/home/wesw/.avrduderc”
User configuration file does not exist or is not a regular file, skipping

Using Port : usb
Using Programmer : dragon_isp
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A200055459
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
boot-loader FW version: 255
firmware version: 7.39
hardware version: 1
S_MCU:
boot-loader FW version: 255
firmware version: 7.39
hardware version: 7
Serial number: 00:a2:00:05:54:59
Device ID: AVRDRAGON
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
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 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

Programmer Type : DRAGON_ISP
Description : Atmel AVR Dragon in ISP mode
Vtarget : 4.9 V
SCK period : 0.50 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x0f001f
avrdude: Expected signature for ATmega1284P is 1E 97 05
Double check chip, or use -F to override this check.

avrdude done. Thank you.

OK, Googling around I found a suggestion to use "-B5" to change the timing and that did it :) I now get the output below. Much better. I need to read up on the fuse settings and maybe I need to tweak things a bit.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x1e9706 (probably m1284) avrdude: safemode: lfuse reads as 62 avrdude: safemode: hfuse reads as 99 avrdude: safemode: efuse reads as FF

avrdude: safemode: lfuse reads as 62 avrdude: safemode: hfuse reads as 99 avrdude: safemode: efuse reads as FF avrdude: safemode: Fuses OK (E:FF, H:99, L:62)

avrdude done. Thank you.

Thanks for the feedback. Karma added ;)

Sounds like the dragon isp needs to be told to use a slower sck clock on a chip that's running at 1MHz (as a virgin AVR does). How annoying - a $3 USBAsp doesn't have this issue!