Go Down

Topic: problem burning bootloader to a blank atmega328p (Read 457 times) previous topic - next topic

doni1

Hi, hope somebody can help me with this: I tried to burn bootloader on an empty 328p chip using an original Arduino Uno R3 board, but I couldn't even change the fuses. I was using Atmega_Hex_Uploader and Atmega_Board_Programmer (thanks to Nick Gammon), same results with external clock on pin9 or 16MHz crystal oscillator. Finally I want to use the chip with its internal 8MHz oscillator. Thank you!
Code: [Select]
Atmega chip programmer.
Written by Nick Gammon.
Version 1.37
Compiled on Feb 16 2020 at 17:40:18 with Arduino IDE 10810.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF
HFuse = 0xDF
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x8D
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: 0xFF  Expected: 0x11
Verification error at address 7E01. Got: 0xFF  Expected: 0x24
[...]
Verification error at address 7E64. Got: 0xFF  Expected: 0x61
Verification error at address 7E65. Got: 0xFF  Expected: 0xF4
496 verification error(s).
First 100 shown.
Programming mode off.
Type 'C' when ready to continue with another chip ...

Code: [Select]
Atmega hex file uploader.
Written by Nick Gammon.
Version 1.37
Compiled on Feb 16 2020 at 20:25:36 with Arduino IDE 10810.
Reading SD card ...
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X20,0X0

--------- Starting ---------

Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF
HFuse = 0xDF
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x8D
Actions:
 [E] erase flash
 [F] modify fuses
Enter action:
Programming mode off.
F
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
LFuse = 0xFF
HFuse = 0xDF
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x8D
Choose fuse (LOW/HIGH/EXT/LOCK) ...
LOW
Current value of low fuse = 0xFF
Enter new value for low fuse (2 hex digits) ...
62
WARNING: Fuse changes may make the processor unresponsive.
Confirm change low fuse from 0xFF to 0x62 . Type 'YES' to confirm ...
YES
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Changing low fuse ...
Fuse written.
LFuse = 0xFF
HFuse = 0xDF
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x8D

pert

Although Nick Gammon is great, I'm not a big fan of using those sketches for general burning the bootloader usage. Maybe they are useful if you want to make a standalone programmer that can be used to program boards where access to a computer is not convenient. For any other purposes though, the Arduino IDE's built-in Burn Bootloader feature is much more flexible and it works perfectly, so there's absolutely no reason to use the Nick Gammon sketches.

Try this:

Install MiniCore, following these instructions: https://github.com/MCUdude/MiniCore#boards-manager-installation

Make the following connections between the Arduino board you will be using as the programmer and the target chip:
Programmer | Target
-----------|-------
MISO | MISO
-----------|-------
VCC | VCC
-----------|-------
SCK | SCK
-----------|-------
MOSI | MOSI
-----------|-------
10 | RESET
-----------|-------
GND | GND

Connect the programmer board to your computer with a USB cable.

File > Examples > 11.ArduinoISP > Arduino ISP

Select the port of your board from the Tools > Port menu.

Sketch > Upload

Wait for the upload to finish.

Tools > Board > ATmega328

Tools > Clock > Internal 8 MHz

Tools > Programmer > Arduino as ISP

Tools > Burn Bootloader

Wait for the process to finish successfully.

doni1

Thank you for the quick reply. I didn't know about MiniCore, just tried it but almost the same result :( (I used "ATmega328 on a breadboard (8 MHz internal clock)" and got something similar):
Code: [Select]
avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\John\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.3/avrdude.conf"

         Using Port                    : COM2
         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.00s

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.00s

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

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

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

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

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

avrdude done.  Thank you.

Error while burning bootloader.

Is it possible that with actual fuse config to be mandatory to use a HV programmer?

pert

Do you get the same failure writing the efuse every time you try Burn Bootloader?

exiledyorkie

#4
Feb 17, 2020, 08:18 am Last Edit: Feb 17, 2020, 08:20 am by exiledyorkie
I had a similar problem. Is it a new chip? If so, I went with an AVRasp, which has a link which should be used for new chips. As new chips are sold with a 1MHz internal clock, the USBasp enables slower programming/bootloader install, which seems to work.
Not the most technical explanation but hopefully that makes sense.

have you made sure that you've tied the relevant pins to Vcc and Gnd? and a pull up resistor on reset?

doni1

Quote from: pert
Do you get the same failure writing the efuse every time you try Burn Bootloader?
Yes, same failure every time, only with this particular chip, no matter what I tried
Quote from: exiledyorkie
Is it a new chip?  ...  made sure that you've tied the relevant pins to Vcc and Gnd? and a pull up resistor on reset?
Got the chip from a friend, not sure if he already tried to burn bootloader on it. The connections are ok for sure (pullup resistor to Vcc also). Replacing the chip with others were a success every time, but still with this one the problem remains.

exiledyorkie

Did you try using 100nF caps between Vcc and Gnd and then AVcc and Gnd?

I had an odd experience trying to boot load a bare chip, had loads of issues and errors, changed the chip and it turned out what I was doing, was correct. I'm not sure if the chip was 'bricked' but I got bored of trying and swapped it. Not sure if it came like that or I had done some error.

Go Up