I am using an Arduino Uno as the hardware programmer together with avrdude as the software programmer for flashing an Atmega328.
I have noticed
PB0 was set to output the system clock with a logic analyzer. The currently running code was setting
PB0 as an input. Double checked with avrdude that the
CKOUT bit in
lfuse was programmed, so I have changed it like such:
avrdude -P COM20 -b 19200 -c avrisp -p m328p -F -U lfuse:w:0xe2:m
-F is there because this old avrdude that I am using does not know about
m328. According to the datasheet the fuses are the same between the P and non-P versions of this MCU.
The low fuse has been verified by avrdude to be written fine, no more clock on
PB0 logic analyzer trace, all good. Except that I am no longer able to program the ATmega238. I am stuck at the dreaded
avrdude.exe: Device signature = 0x000000
According to the datasheet
CKDIV8 - unprogrammed CKOUT - unprogrammed SUT1 | SUT0 `10` - Slowly rising power (default) CKSEL3 | CKSEL2 | CKSEL1 | CKSEL0 `0010` - 8 MHz inner oscillator (default)
I wonder how I have managed screwing up this time and whether I can unscrew it somehow. Any clues ?
In short, no idea on what was wrong, but the previous lfuse changing just happened to coincide with the moment it has stopped working.
I have replaced the MCU. Still not working; observed a finicky MOSI line with the logic analyzer, messed around, eventually took out a 47 ohm resistor from the MOSI line and in the process galvanically separated another chip from the same MOSI line.
LE: I have put the 47 ohm resistor back in and it does not fail...