Then, I try to upload a modified blink sketch (modified for LED on D8). The sketch has been compiled on the spare PC, using the custom board definition.
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyS8 -b 57600 -U flash:w:Blink.cpp.hex
returns :
avrdude-original: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyS8
Using Programmer : arduino
Overriding Baud Rate : 57600
done with autoreset
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 : Arduino
Description : Arduino
Hardware Version: 2
Firmware Version: 1.16
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude-original: Device signature = 0x1e950f
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
avrdude-original: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "Blink.cpp.hex"
avrdude-original: input file Blink.cpp.hex auto detected as Intel Hex
avrdude-original: writing flash (1106 bytes):
Writing | ################################################## | 100% 0.33s
avrdude-original: 1106 bytes of flash written
avrdude-original: verifying flash memory against Blink.cpp.hex:
avrdude-original: load data flash data from input file Blink.cpp.hex:
avrdude-original: input file Blink.cpp.hex auto detected as Intel Hex
avrdude-original: input file Blink.cpp.hex contains 1106 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 0.24s
avrdude-original: verifying ...
avrdude-original: 1106 bytes of flash verified
avrdude-original: safemode: lfuse reads as 0
avrdude-original: safemode: hfuse reads as 0
avrdude-original: safemode: efuse reads as 0
avrdude-original: safemode: Fuses OK
and the LED starts to blink.
Now I try to burn the same sketch a second time :
avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyS8 -b 57600 -U flash:w:Blink.cpp.hex
returns :
avrdude-original: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyS8
Using Programmer : arduino
Overriding Baud Rate : 57600
done with autoreset
avrdude-original: stk500_recv(): programmer is not responding
So, UART is not working anymore.
I then check the fuses using SPI :
avrdude -p atmega328p -c gpio -U lfuse:r:-:i -U hfuse:r:-:i -U efuse:r:-:i -U lock:r:-:i
returns :
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.34s
avrdude-original: Device signature = 0x1e950f
avrdude-original: reading lfuse memory:
Reading | ################################################## | 100% 0.06s
avrdude-original: writing output file "<stdout>"
:01000000E21D
:00000001FF
avrdude-original: reading hfuse memory:
Reading | ################################################## | 100% 0.05s
avrdude-original: writing output file "<stdout>"
:01000000D926
:00000001FF
avrdude-original: reading efuse memory:
Reading | ################################################## | 100% 0.08s
avrdude-original: writing output file "<stdout>"
:0100000005FA
:00000001FF
avrdude-original: reading lock memory:
Reading | ################################################## | 100% 0.05s
avrdude-original: writing output file "<stdout>"
:010000000FF0
:00000001FF
avrdude-original: safemode: Fuses OK
avrdude-original done. Thank you.
So, the SPI connection still works, and the fuses settings didn't change.
So, why is it not working anymore with UART ?
I want to use the SPI to 'bootload' the ATmega with the right settings (3.3v, 8Mhz internal), and then only use UART to reprogram the chip.
What am I doing wrong here ?