Bootloader Upload Verification Errors

Hi everyone,

I'm working on a custom board for some IC testing and have an ATmega328p to control it all. I've been trying to install the arduino bootloader to simplify the programming steps however after a day of trying I can't get it working.

I'm using the ArduinoISP method wit;

Arduino Mega 2560 with the ICSP pins going to MISO, MOSI, SCK, GND, 5V and Reset going to pin 10.

But the error i get is

avrdude: stk500_getsync(): not in sync: resp=0x00

.

Verbose outputs gives

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM13
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing |  ***failed;  
################################################## | 100% 0.07s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Error while burning bootloader.
Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xfe != 0xfd
avrdude: verification error; content mismatch

avrdude done.  Thank you.

I have also tried the Gammon Programming Tool with the same setup, getting the following results

Atmega chip programmer.
Written by Nick Gammon.
Version 1.38
Compiled on May  2 2018 at 17:28:53 with Arduino IDE 10805.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F 
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF 
HFuse = 0xD9 
EFuse = 0xFD 
Lock byte = 0xFF 
Clock calibration = 0xA9 
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...
Using Uno Optiboot 16 MHz loader.
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'Q' to quit, 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
Verifying ...
Verification error at address 7E00. Got: 0x00  Expected: 0x11 
Verification error at address 7E01. Got: 0x00  Expected: 0x24 
Verification error at address 7E02. Got: 0x01  Expected: 0x84 
Verification error at address 7E03. Got: 0x3F  Expected: 0xB7 
Verification error at address 7E04. Got: 0x02  Expected: 0x14 
Verification error at address 7E05. Got: 0x3F  Expected: 0xBE 
Verification error at address 7E06. Got: 0x03  Expected: 0x81 
Verification error at address 7E07. Got: 0x3F  Expected: 0xFF 
Verification error at address 7E08. Got: 0x04  Expected: 0xF0 
Verification error at address 7E09. Got: 0x3F  Expected: 0xD0 
Verification error at address 7E0A. Got: 0x05  Expected: 0x85 
Verification error at address 7E0B. Got: 0x3F  Expected: 0xE0 
Verification error at address 7E0C. Got: 0x06  Expected: 0x80 
Verification error at address 7E0D. Got: 0x3F  Expected: 0x93 
Verification error at address 7E0E. Got: 0x07  Expected: 0x81 
Verification error at address 7E0F. Got: 0x3F  Expected: 0x00 
Verification error at address 7E10. Got: 0x08  Expected: 0x82 
Verification error at address 7E11. Got: 0x3F  Expected: 0xE0 
Verification error at address 7E12. Got: 0x09  Expected: 0x80 
Verification error at address 7E13. Got: 0x3F  Expected: 0x93 
Verification error at address 7E14. Got: 0x0A  Expected: 0xC0 
.......

The options pressed were U for Uno and G for program.

If this is run multiple times in succession then the device signature changes every so often, becoming an unrecognized device. I have two custom boards, and have the same errors on both of them.

I had thought the 328p's were burnt in the assembly but if the signature is read correctly (most of the time) then I'm not sure what the problem is.

Anyone seen this before? Got any solutions?

Cheers

Do you have an 8MHz External Crystal attached to the atmega328p?

Your fuse bits seem (to me) to be pointing to an 8MHz Ext crystal.

if you do have an 8MHz, you should try the L option on Gammon's programming tool.

One board has a 16 MHz crystal, and one has it removed. The one with the crystal has the errors shown above, the one without can't enter programming mode. I'll try simulating an 8 MHz crystal using another Arduino to see if that helps

You should be able to program the one with the crystal as 16MHz or 8MHz. I had no problems using Gammons Board Programmer going back and forth between 8 and 16 MHz using a 16MHz crystal and 328P-PU chip. Of course you want it set for the correct crystal. :slight_smile:
Double check your wiring.

Sometimes I can just hold the crystal across the two pins long enough to program as internal if it expects a crystal.

hajihosseinlu:
Hello Everyone!

I am probably posting in a wrong category.

I have a project that I need help with and I am willing to PAY WELL for it. Where can I find help?

Thanks,
A

And you're hijacking a thread.

You can ask for paid help in the gigs and collaboration section.

Please give a proper description of your project.

I will ask a moderator to split this of and move it to the above section.