Odd behavior of ATMEGA328P - PC Dependent

Hello everyone,

I have some custom PCBs I've made up that are based around an SMT ATMEGA328P and feature both an ICSP header and a header for use with an FTDI programmer. The circuit design is not at issue here, but I'm curious about an issue I've encountered uploading sketches from the Arduino IDE.

Long story short, my process upon receiving the boards from JLCPCB is to:

  • Use AVRDUDESS with a USBasp to "read" the ATMEGA chip, then set the fuses as follows: 0xF7, 0xD6, 0xFD, 0xFF
  • Use the Arduino IDE with MiniCore board manager and the USBasp to load the ATMEGA328P bootloader
  • From here on, use an FTDI programmer and MiniCore in the Arduino IDE to program sketches onto the board.

This process has worked reliably for 50+ boards on my small windows laptop, and I ensure all boards can be programmed with a new sketch and function as expected before sending them off.

The problem is that the people I'm sending the boards to cannot program them. I thought this was user error, but I saw it myself today when a person using one of my boards, with all appropriate FTDI drivers and MiniCore installed, could not upload any sketch to the board. They get the usual stk500_getsync() error, even if they use my FTDI programmer and cable that I originally programmed the board with. In serial monitor you can see the board running and talking, but the Arduino IDE cannot write a sketch.

The solution seems to be to use a USBasp on their computer and load any sketch onto the board using "Upload using programmer" within the Arduino IDE. After doing that, the board can then be programmed with any FTDI programmer via the normal "Upload" button.

My question is why this is the case? What is it about using a USBasp and "Upload using programmer" that is making the board and Arduino IDE on a new computer suddenly cooperate? Why does the FTDI programmer work after this, but not beforehand? Does this have something to do with the way I am loading the bootloader or setting the fuses when I first get the boards from JLCPCB? Before you ask, I have confirmed that all chips are legitimate.

My goal here is for people to receive a board and be able to upload sketches via FTDI, like you would on a Pro Mini, without having to go through this extra step of using a USBasp beforehand. What am I missing?

Thanks in advance,
Austin

What is it about using a USBasp and "Upload using programmer" that is making the board and Arduino IDE on a new computer suddenly cooperate?

MiniCore, "Upload using programmer" within the Arduino IDE for some reason uses, for example:
v -patmega328p -cusbasp -Pusb -Uflash:w:/tmp/arduino_build_991610/Blink1.ino.with_bootloader.hex:i
Notice the Blink1.ino.with_bootloader.hex:i . I just ran into this and of course it loads the bootloader which goes against anything you read about "Upload using programmer" . I don't know why your chips aren't able to be programmed on a different PC, but I would try just burning the bootloader and fuses using MiniCore and the Arduino IDE just to see if it makes a difference.