Can No Longer Program ATmega chip with Arduino ISP

I have run into an issue with the ArduinoISP sketch recently. I have not been able to upload an Arduino sketch to a standalone ATmega328p-au since I last tried maybe 6 months ago. I have been working on two projects that use the chip in a custom PCB, and had been programming them with no problem. I probably programmed them over 100 times each with my Arduino Nano and the ArduinoISP sketch. Just recently, I wanted to program the same board again. My ArduinoIDE crashed on startup (I'm on a Mac) so I deleted it and updated it. Now I can't upload the sketch anymore. This happened before when I got a new computer, I guess I updated from a very old version of ArduinoIDE to a now year old one. I was able to get it working again, I think I had to add the 10uF reset capacitor between pin 10 and GND. It seems like every time I update ArduinoIDE it stops me from uploading sketches to the custom boards. I am 95% sure this is an issue with my IDE setup, or my ArduinoISP (capacitor, no capacitor etc.) since I only ever have a problem when I update the IDE or I switch to a new computer or something.

I am using ArduinoIDE v2.3.3 and have Arduino AVR Boards 1.8.6 installed. Does anyone know why my Arduino Nano as an ISP can't communicate with my custom boards all of a sudden? And yes I triple checked the wiring was correct. And again, I know this was all working because it had been working perfectly for so long, the only thing that is different is that I got a new version of the IDE.

This is the error message:

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
         Hardware Version: 36066619
         Firmware Version: 142363200.3
         Topcard         : STK502
         Vtarget         : 1.8 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1

Also, I tried burning the bootloader to the boards, but get the same issue. If anyone has any thoughts, or knows of anything that changed recently (like the adding the reset capacitor requirement from a year or two ago) please let me know. Thanks

you can try AvrDude or AvrDudess software to check fuses. if at all readable.

I used avrdude through the command line to read the fuses, all 0x0. I got the correct device signature though, so I tried to flash the program directly with avrdude and that worked. I am relieved that I can program my boards again, but confused as to why it doesn't work with Arduino IDE I went back and tried again and I got the

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

error. So programming works fine, just not through ArduinoIDE which is odd. Thanks for your help though, I'm just glad to be programming my boards again.

did you flashed bootloader first?

Yes, both boards had the bootloader flashed to them long ago. Also side note, whenever I try to upload through ArduinoIDE I have to change USB ports for the programmer to come back, or else I get the not in sync error above. This happens every time I try through the IDE, I get the out of sync error and then I have to switch ports. When programming through command line, I haven't run into this

it is not normal, you can try to erase chip and write correct fuses, and check if it reads correct now.

I am not able to write the fuse bits, I get

Processing -U lfuse:w:0xFF:m
Reading 1 byte for lfuse from input file 0xFF
Writing 1 byte (0xFF) to lfuse *** failed
Error: unable to write lfuse (rc = -1)

Even still, when I program, it writes and reads back the flash, doesn't this mean it's communicating ok? If it can read and verify the flash?

ISP plug turn 180°?

I wish that was it.

Also I was wrong, I can't program the boards, I was actually flashing the programmer Arduino. I flashed the simple blink program and the programmer started blinking at the delay I set.

Have you uploaded the ArduinoISP sketch to the programmer Arduino from IDE v2 - in case it's different from the v1 version?

Also, did you select "Arduino as ISP" (not "Arduino ISP") as the programmer in the IDE?

Actually, I don't know. If I updated the IDE, does this update the ArduinoISP sketch? If not I am not sure how to get the latest version. And yes I am using Arduino as ISP

I don't know if the sketch changed from v1 to v2. But it might have. Anyway, you could just flash the example ArduinoISP from v2 just as you did back in the day in v1.

Do you still have v1 installed? Maybe it still works there.

when you hit "program" button. for programming some target thru programer you need press

Yes, I was always using the "Upload Using Programmer" button. It somehow programmed the programmer Arduino instead of the target or just didn't work at all. Unless I accidentally hit the regular program button, but I tried to be pretty careful about that since I've done it so many times it's a mistake I used to make a lot. Regardless, it still won't program my target

Show a circuit diagram (not fritzing) of how everything is connected including power supplies.
Then step by step on how you proceed to program.

You are correct. if all fuses read 0x0, that also means that external reset disable has been set, which means you can no longer pragram the chip. Unfortunately a simple HV programmer won't do on an Atmega328p, you need a parallel programmer for that.

Again this is the thing to check, The ArduinoISP sketch won't have changed, but this setting is relevant and will not be selected anymore after re-installing the IDE.

Couldn't the all 0x0's also just mean it's not communicating with the board properly? And it's just not reading any signal coming back from the target? If not and the external reset has been disabled, is there any way to get it back?

Also, I always used the Arduino as ISP in the Programming menu and use the Upload Using Programmer instead of the upload button. I think I might have hit the wrong button one time, and using avrdude through the command line, I was probably programming the programmer not the target because I don't really know how it works. But of the 100 times I have tried to upload to the target with ArduinoIDE with the correct programmer and upload button, it hasn't worked.

I got a second Arduino to try it out, and still no luck. I even tried to program one Arduino with another, and that didn't work. Still got device signature = 0x00000 from the second Arduino. Uploading the blink sketch to a second Arduino with one as the programmer and one as the target did not work. So I think that rules my custom hardware out. And my custom hardware is still running my program, I know it's working because it blinks an LED on startup like I programmed it to 6 months ago.

If I were to look with an oscilloscope, is there something that I should look for?

Weren't you getting a device signature ? If there is a device signature, there is communication.

There is, you have to built/create a parallel programmer. It can be done on a breadboard using an Arduino, there is some info in the link i posted, and if you google, you will find more. I have never done it, never thought that i would need that extra pin, and when i saw about the parallel programmer decided it was a bit more work then i was after.
On an ATtiny you can set any fuse using a simple HV programmer, which only requires +12v on the Reset pin. I did built one because i do a lot with those and sometimes the extra pin is useful (rarely though but for educational purposes it was still ok)

So it doesn't work, i trust you.

Ah that means there maybe a connection issue. Verify all connections, that is check from the pin on the DIP28 package to where it connects to the programmer. Wires can be broken ! There may also be something wrong with your programmer. So if you have an extra UNO, upload the ArduinoISP and set this a programmer and try.

And if you would try to do that to a third Arduino. I mean, 1 as the ISP, that works and has accepted the sketch. And one with a chip that has not been used on the other programmer and of which the fuses are set correctly still (if that is the issue)

You can rule that out once you succeed finding the actual issue.

You should also be able to use an Arduino to read the fuse settings of the ATmega, regardless of their settings.
If you get a device signature and it is correct, you can get the fuse settings.
I haven't actually tried on an ATMega 328p, at least i'm not sure i did.
Again if you have a working MCU, use that to read the fuses, and once that is successful switch the chip. I think for reading the fuses only a HV-programmer will do even if reset has been disabled,
The HV programmer switches the Vcc of the Atmega and the device signature and fuses are being spat out regardless.

while this, which schematic you use as guide to connect them?

I was getting a device signature, but only with the avrdude command line tool, which I suspect was only communicating with the programmer Arduino, hence why it programmed it with the blink sketch, not the target.

I am going to try the parallel programmer and see what happens. The problem though, is that on my target board, I only have the ISP pins exposed in the programming header. I also have RX and TX

Also, I did try with a second Arduino UNO and got the same results, unexpected response error