On the next try i got:
avrdude: error: program enable: target doesn’t answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
avrdude done. Thank you.
*** [upload] Error 1
What do you mean by “swing crystal”? There are ‘standard’ two pin crystal oscillators, and then there are three pin ceramic resonators. 328p16m just expects a to a 16Mhz oscilator… whether it be a crystal with load capacitors, or a three pin ceramic resonator.
A minimum, your circuit should have a 10K pullup to V+. Something like a 100nF capacitor on V+ and GND near the atmega328 pins would be good, but not critical. Also, don’t forget to put load capacitors between the crystal and ground! And probably a good idea to also connect the analog V+ and GND pins also…
Your fuse settings haven’t been set properly from the looks of that… that combination is for the Internal 8Mhz RC oscillator, not for the crystal. Pull the crystal out, and try programming it again, but use the ‘Upload with programmer’ setting, and see if the fuses are set to
E:05, H:DE, L:FF
which are the Arduino defaults for the atmega328p. You can find out what the settings mean if you put them into the fuse calculator here, but it basically instructs the chip to use a crystal oscillator of 8Mhz or greater, instead of the internal clock.
Depending on what platform you are on, you can use avrdude natively, or use this nice GUI for it to set the fuse settings. You made also need to fiddle with the bit clock speed for your programmer to get the chip to respond. You’ll know if it’ll work if it auto-detects the chip when you click the ‘detect’ button
after some more testing nothing Workes. I buyed a other usbasp, with a Low clock speed jumper (instand of Automatic).
With this new Programmer i got the Chip to respond more often. After Some more trying i found out that the Socket i was using for the Chip didnt connect good in the Breadbord, so i trow it out and got more often responds from the chip (old programmer still nothing).
With PlatformIO i mostly get avrdude: verification error, first mismatch at byte XXXX
with the AVRDUDESS (& extra installed avrdude, not the one that comes with platformIO) it works 98% of the times.
So thanks for you help i got it working :))
Can i just replace Avrdudes files in platformIO with the extra installed ?
I have got similar problem.I have a USPasp and tried to Programm my Atmega328p while uploading i got:
avrdude: verification error, first mismatch at byte XXXXX
But when I put in terminal pio run -t program it works well.
Additionally, when i try to upload this same hex file, it pass the verification. But when I change the code, another hex file gives verification error.
What is going on ? What is the difference between uploading with icon and the ‘program’ command?
Did you try using the ‘upload with programmer’ option - there are two separate menu options.
As Ivan pointed out in another thread where you mentioned this, for this target the primary difference is the use of the erase flag. For this target the Upload option/command primarily adds the -D for “don’t auto erase” parameter to the programming command, which is the same as is used by the Arduino IDE. This is because when you’re uploading, with some boards this could result in the bootloader being erase… which makes life a bit hard if you try to erase the bootloader WHILE IT IS RUNNING, especially when the upload fails and means you needed a ISCP to reflash the bootloader/program the board. The Upload with Programmer option / program target has no qualms about letting auto-erase occur, as since you’re using a programmer, the whole chip can be erased.