Can't program new Atmega328P chip on Serial 7-segment display

Hey, I have a new Serial 7-segment display and am flashing custom firmware using a USB AVR programmer, and it works great. However, on another Serial 7-segment display, I replaced the chip with a new Atmega 328P from Mouser, because I damaged the chip. I can’t program that one, using the exact same setup as with the unit that can be programmed. So my question is, does Sparkfun burn anything on the chip before shipping them that I can’t do with an AVR programmer using avrdude? I tried burning the fuses using avrdude and the fuse bytes from the board description, but get the “initialization failed, rc=-1” error. I am using the Polulu USB AVR programmer v2.1, and that can program a fresh Serial 7-segment display correctly. Using a Mac.

The soldering job looks good, and the board is in good shape, so I’d be surprised if it were to be a hardware issue, although that is never impossible.

Thanks in advance

Serial 7-segment display: https://www.sparkfun.com/products/11441

Programmer: https://www.pololu.com/product/3172

Hi Tristan.

does Sparkfun burn anything on the chip before shipping them that I can’t do with an AVR programmer using avrdude?

Nope, we start with fresh out of the package ATmega328, write some fuse bits then write a bootloader and the code that runs the display followed by the lock bits. We use a Raspberry Pi with a [Pi AVR Programmer HAT rather than a dedicated programmer, but it does the same thing as your USB AVR Programmer v2.1.

I tried burning the fuses using avrdude and the fuse bytes from the board description, but get the “initialization failed, rc=-1” error.

A couple of things can cause this. The first would be a bad chip, the second could be a issue with soldering and the third could be that you may have written the wrong fuse settings and the 328 doesn't have a clock anymore. Without a clock, the chip and programmer can't communicate.

We use the internal clock in the ATmega328 for this design and don’t include an external crystal on the board. If you’ve accidentally enabled an external clock on the chip, you can’t program it without an external clock or crystal attached. I don’t know if it would work, but you might try connecting a 8 or 16MHz crystal to the XTAL1 and XTAL2 pins to see if that gets the programmer talking to the chip again. If it does, select the correct fuse bits to re-enable the external clock and you can remove the crystal.

Here are the correct fuse bits for this board:

HIGH_FUSE=0xDE

LOW_FUSE=0xE2

EXT_FUSE=0xFF](SparkFun Pi AVR Programmer HAT - DEV-14747 - SparkFun Electronics)