I had previously programmed an ATmega328P using AVRDude - this was some time ago, and I was not even sure what program I had applied.

When I attempted to overwrite the program using the Arduino IDE, I hit a dead end. I got the error message:

stk500_recv(): programmer is not responding

It was clear that something was not quite right.

I inserted the chip into my TL866II and was able to see that the IC itself was working fine - data could be read and re-written to the device. However, even using a complied hex file from Arduino studio, the IC did not appear to work correctly in circuit. Recompiling and burning the hex file over and over was frustrating - I wanted to simply upload from the Arduino IDE.

I decided to start from scratch, with a clean Arduino bootloader, so I could easily continue development.

Within the Arduino installation directory, at C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot there is a clean atmega328 hex file that can be programmed - optiboot_atmega328.hex

I programmed this to the Atmega, but again was unable to program the chip using Arduino studio.

I discovered that specific fuse bits need to be set, and XGPro does not select these by default. The correct settings are:

Fuse Low Byte (none selected)
Fuse High Byte
    SPIEN=0
    BOOTRST=0
Extended Fuse Byte
    BODLEVEL1=0
Lock Bit Byte (none selected)

Setting the fuses in this manner, and re-programming the optiboot_atmega328.hex then worked OK.

Here is a link to an XGPro project with the fuse links set correctly, and the Arduino bootloader included.

Here is the bootloader hex if you are unable to find it in your Ardunio folder.

Previous Post Next Post