I purchased three Amtel ATMega328p MCUs from Amazon. The product was advertised as coming "w/ Arduino UNO Bootloader", which I thought nothing of because I was going to overwrite the bootloader with my own programs.
However, I did not anticipate the fact that these units would actually come with their fuses set to the Arduino UNO defaults: most notably, they configured the unit to be driven by an external clock, which disabled the chip's internal 1 Mhz oscillator. This made it impossible to communicate with the chip via avrdude
, as the chip was eternally waiting for an external clock to drive it.
Fortunately, after much searching and experimentation, I found a modified ArduinoISP script by a david.prentice that modified the default ArduinoISP to emit a slow clock signal on the Arduino's digital pin #3. Once I connected this to my MCU's XTAL1 clock input, avrdude
was able to communicate with it.
I used the Engbedded fuse calculator to find the default fuses for the chip and configure them via avrdude
on my system:
avrdude -F -V -c avrisp -p atmega328p -P /dev/ttyACM0 -b 19200 -U lfuse:w:0x62:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
This allowed me to remove the clock source from XTAL1 and use the chip's internal 1 Mhz oscillator.