I have an atmega328p running on a breadboard and I'm using usbtinyisp to program it.
The chip runs at internal 8MHz and I have added a suitable entry to my Boards list.
It is powered by the usbtinyisp providing 5V. All works fine for small sketches.
With larger sketches, I notice read verification errors at random adresses:
avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0c00
0x2e != 0x80
avrdude.exe: verification error; content mismatch
I have the impression it's better when I don't use the IDE's function 'Upload using Programmer' but when I run avrdude maually, like this:
C:\arduino-1.0.1\hardware\tools\avr\bin\avrdude.exe -v -p m328p -c usbtiny
-U flash:w:C:\Users<...>\Temp\build4374060643153925675.tmp\MyTest.cpp.hex:i
The only disadvantage here is that every new IDE start creates a new Temp\build... directory and I have to adjust my bat file.
However when my MyTest.ino grows even more, this trick using avrdude.exe externally also does not help any more.
A sketch of 13k works well:
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 26.60s
avrdude.exe: verifying ...
avrdude.exe: 13230 bytes of flash verified
A sketch of nearly 16k fails "always", but on different locations.
( See first sample output: 0x0c00 is well in an area that was written fine with a smaller sketch )
And the sketch behaves different after another upload try, sometimes it runs anyway, sometimes it hangs, sometimes only most functions work
This makes me guess the problem is in Writing, not in Verification.
There are lots of timing parameters logged, which do not tell me too much, nor do I know where to tune them eventually:
avrdude.exe: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : lpt1
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
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 5 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 : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude.exe: programmer operation not supported
avrdude.exe: Using SCK period of 10 usec
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude.exe: Device signature = 0x1e950f
avrdude.exe: safemode: lfuse reads as E2
avrdude.exe: safemode: hfuse reads as D0
avrdude.exe: safemode: efuse reads as 5
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: Using SCK period of 10 usec
avrdude.exe: reading input file "C:\<...>\Temp\build4374060643153925675.tmp\MyTest.cpp.hex"
avrdude.exe: writing flash (13230 bytes):
Writing | ################################################## | 100% 40.08s
avrdude.exe: 13230 bytes of flash written
avrdude.exe: verifying flash memory againstC:\<...>\Temp\build4374060643153925675.tmp\MyTest.cpp.hex:
avrdude.exe: load data flash data from input file C:\<...>\Temp\build4374060643153925675.tmp\MyTest.cpp.hex:
avrdude.exe: input file C:\<...>\Temp\build4374060643153925675.tmp\MyTest.cpp.hex contains 13230 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 26.60s
avrdude.exe: verifying ...
avrdude.exe: 13230 bytes of flash verified
avrdude.exe: safemode: lfuse reads as E2
avrdude.exe: safemode: hfuse reads as D0
avrdude.exe: safemode: efuse reads as 5
avrdude.exe: safemode: Fuses OK
avrdude.exe done. Thank you.
Any ideas ?
Does it help to add a serial connection to my breadboard, burn a bootloader, and upload sketches via the Serial port ?