0xffffff error on bootloader burn - ATMEGA328P-AU

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone, I'm new to ATMEGA MCUs and I'm trying to burn the bootloader for an ATMEGA328P-AU MCU with Arduino UNO.

 

I have already read similar threads like this one or this one but I couldn't find any solution.

 

I have a custom PCB with:

  • ATMEGA328P-AU;
  • 3.3V operating voltage;
  • 8MHz crystal.

 

Obviously I can load the ISP code to Arduino UNO without any problem.

 

When trying to burn the bootloader to the custom PCB I get the following error:

 

C:\Users\giaco\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\giaco\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m 

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\giaco\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM4
         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 = 0xffffff (probably .avr8x_mega) (retrying)

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

avrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)

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

avrdude: Device signature = 0xffffff (probably .avr8x_mega)
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Errore durante la scrittura del bootloader

As you can see the detected device signature is 0xffffff and if I'm not wrong this should be related to a generic hardware issue.

 

I'm stuck with this problem because I really can't understand if it's a software or hardware issue.

 

Could you please help me?

 

Thank you in advance

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Until the signature can be read there is no point attempting any other action in avrdude (and don't just over-ride with -F). Usually FFFFFF means "the wires are not connected right"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson, thank you for your reply.

 

I believe that problem is not caused by the wires because:

  • I've tested the new PCB connections with digital multimeter and everything was ok;
  • I've been able to burn the same bootloader and the final firmware on a previous and very similar PCB (this old PCB has a 5V operating voltage and a 16MHz crystal, instead the new problematic one has 3.3V and 8MHz as already stated).

 

So I really don't know what to think...

 

If these further details could be helpful to find a solution, I'll be very happy to know :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using the default Arduino Uno core, i.e. you haven't installed any other hardware cores, burning the bootloader will set the fuses for 16Mhz. Clearly, this won't work if the crystal is actually 8MHz.

 

To work with an ATmega328P running at 8MHz, you need to select Pro or Pro Mini as the board type, and then the 3.3V 8MHz processor menu option. However, that may mess with the mapping of IO pins to Arduino pin numbers, so you'll need to work that out later.

 

There are other (arguably better) cores that support this configuration, e.g. MCUdude's MiniCore. This is also what you'd need if you wanted to use the chip's onboard oscillator.

 

 

 

 

Last Edited: Fri. Jun 26, 2020 - 06:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using an UNO as a programmer may also be a problem as it runs at 5v, so may have a problem talking to a 3.3v device!

Try putting a 1k resistor in series with your miso/mosi/sck lines and see if that helps with the voltage translation, no guarantees.

Other wise you may need a real programmer that does proper voltage translation.

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The processor will happily program at 5V and 8MHz (and then subsequently run at 3V3), but I'd worry about any 3V3 parts on the board which may not be tolerant.

 

I do wonder why people jump through all these hoops when a Chinese USBasp costs a couple of £/$/€ (and most can be jumpered to 5V or 3V3).

Last Edited: Fri. Jun 26, 2020 - 08:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

burning the bootloader will set the fuses for 16Mhz. Clearly, this won't work if the crystal is actually 8MHz.

 I'm pretty sure the fuse settings for an 8MHz crystal are the same as for a 16MHz crystal...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

burning the bootloader will set the fuses for 16Mhz. Clearly, this won't work if the crystal is actually 8MHz.

 I'm pretty sure the fuse settings for an 8MHz crystal are the same as for a 16MHz crystal...

 

 

Yup, you're correct. It's a different bootloader file though, but it's probably not getting that far.

 

## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328P
## --------------------------------------------------
pro.menu.cpu.16MHzatmega328=ATmega328P (5V, 16 MHz)

pro.menu.cpu.16MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.16MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.16MHzatmega328.upload.speed=57600

pro.menu.cpu.16MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.16MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.16MHzatmega328.bootloader.extended_fuses=0xFD
pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex

pro.menu.cpu.16MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.16MHzatmega328.build.f_cpu=16000000L

 

## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328P
## ---------------------------------------------------
pro.menu.cpu.8MHzatmega328=ATmega328P (3.3V, 8 MHz)

pro.menu.cpu.8MHzatmega328.upload.maximum_size=30720
pro.menu.cpu.8MHzatmega328.upload.maximum_data_size=2048
pro.menu.cpu.8MHzatmega328.upload.speed=57600

pro.menu.cpu.8MHzatmega328.bootloader.low_fuses=0xFF
pro.menu.cpu.8MHzatmega328.bootloader.high_fuses=0xDA
pro.menu.cpu.8MHzatmega328.bootloader.extended_fuses=0xFD
pro.menu.cpu.8MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex

pro.menu.cpu.8MHzatmega328.build.mcu=atmega328p
pro.menu.cpu.8MHzatmega328.build.f_cpu=8000000L

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks to all for the replies.

After various attempts with MiniCore etc. I thoroughly checked the hardware of the custom PCB where there is ATMEGA328P-AU and I saw that the manufacturer was wrong to place a component, so the problem is an hardware problem.

 

Thank you again to all.