Why won't my circuit take a bootloader

:confused: :confused: :confused:
I'm tearing my hair out here.
I've breadboarded a concept which is effectively an ATMEGA328P that reads active low inputs from any of its I/O pins, tallies them and outputs this via UART. Now that I've had some trial PCB's manufactured, I can't program a bootloader to any of them (with a USBASP). I have no problem burning it to a nano I have sitting here.

The error is:
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1

I know it's not the old issue of ATMEGA328 vs ATMEGA328P. It must be in my circuit somewhere.

I'm hoping someone with better knowledge than my beginner brain can identify where the issue is on my attached schematic.

15BayReceiver.pdf (35.5 KB)

Unlike a Nano, ATmega328P fresh from the factory come running at 1 MHz, which can cause this error when used with a USBasp programmer that's running the official firmware.

If your USBasp programmer has the official firmware, you must short the JP3 jumper to program chips that are running at <=1 MHz clock speed. The factory default clock configuration is running on the internal oscillator at 1 MHz. Many of the common Chinese USBasp clones come with a modified firmware that is able to work with chips running at the slower clock speeds without needing to set the jumper. There is also an alternate open source firmware provided by the community that has this functionality.

thanks for the assistance. I've bridged J3 but still no luck unfortunately.

Schematics should have component values.

Double check the value of R1, it should be 10K. Too low of a value there can prevent the Usbasp from asserting the reset line with the result being the no response message.

Yep no values displayed on the resistors is my laziness (I do have it nominated in the properties of each one). R1 is 10k

R1: Have you checked it with an ohmmeter? Have you rung out the ISP connections?

That’s about the only thing that will stop a bootloader attempt on a factory fresh chip. Get those six connections correct and it should just work.

Just tried with the ohmmeter and R1 shows up as 8.7k. Strange, but would that be enough to make a difference? all the ISP connections ring out fine.

8K shouldn’t make a difference but it would be easy to pop the atMega328 out the breadboard and recheck, just to be sure.

Do you have an Uno board that you can put the atMega328 into and try using that to prove out the Usbasp and the new ic?

the ATMEGA I'm using on the PCBs is unfortunately an SMD one, so no popping it out :frowning:

I'm starting to think my next option is to solder some wires onto the ic pins so that I can try connecting directly to it without the board's traces inbetween.

I did a bit more research noting that the IC I have is denoted as ATMEGA328P U-TH. I found some other forums where people were complaining about the 'TH' chips, being inconsistent and often not able to program them, so I went through all 5 boards I had ordered. I managed to get 2 boards that AVRDUDE was able to detect, so I attempted to burn the bootloader to them. It was able to successfully set the fuses, but then couldn't program. When I had another look at my board layout, I had one of those bitter sweet moments where I realised what I'd done. For the 4 pin crystal I'd used, I had mistaken the pin numbers. As a result I has the xtal pins connected to the gnd pins on the crystal. I removed the crystal from one of the boards and dodgy'd up a big crystal I had sitting around and viola. Programming heaven.

What I still don't know is what the deal is with those other boards that I couldn't even detect, since from the factory the IC is not set to even care about any externally connected crystal, that shouldn't be the issue.

hipsi:
Just tried with the ohmmeter and R1 shows up as 8.7k. Strange, but would that be enough to make a difference? all the ISP connections ring out fine.

If you are measuring R1 in circuit, 8.7k sounds fine as it will be a 10k resistor in parallel with other circuit components.
Tom.... :slight_smile: