I was pulling my hair out as I had received 20 Atmega328P's and the first one I was able to get programmed with my USBasp Programmer, but swapping the processors I was not able to program on breadboard or within an UNO.
Thanks to some posts I felt confident it was a fuse setting where it was speaking too fast. I have an external 16MHz crystal in my setup so I used:
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -P usb -v -C /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -B 10 -c usbasp -p m328p -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m
I found most of this command in other forums but the magic I needed was the "-B 10
" to get it to only speak at a 10us clock rate. Once I did this command line command on my Mac, I was able to use the Arduino GUI to do a Burn Bootloader or Upload Using Programmer without issue.
The problem seems to be the USBasp board/sw did not auto clock down to find a happy setting. I am using the Amazon HiLetgo which claims "USBASP V2.0" but has very back-level firmware as well, so I needed to update that with the latest (2011) usbasp from Thomas Fischl named: usbasp.2011-05-28 that was a pain also but it's a one time deal though I am waiting on a second programmer to arrive and I will have to re-flash it also.