bootloader ATmega328PB chip using Minicore.

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

Hi all.

I am getting problem burning the bootloader on an ATmega328PB chip using Minicore.
I am using a 16 MHz crystal as my clock source and following the steps as mentioned on, https://github.com/MCUdude/MiniCore
I am using 'Arduino as ISP' as my programmer. When hitting the 'Burn bootloader' option, i am getting the following error,

Arduino: 1.8.12 (Windows 10), Board: "ATmega328, Yes (UART0), 328PB, BOD 1.8V, LTO disabled, External 16 MHz"

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf -v -patmega328pb -cstk500v1 -PCOM8 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0b11110110:m -Uhfuse:w:0xd6:m -Ulfuse:w:0b11111111: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\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328PB
         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
           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
           efuse          0     0     0    0 no          1    0      0  4500  4500 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.03s

avrdude: Device signature = 0x1e9516 (probably m328pb)
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 "0b11110110"
avrdude: writing efuse (1 bytes):

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

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

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

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

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

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

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

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0b11111111"
avrdude: writing lfuse (1 bytes):

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

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

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

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf -v -patmega328pb -cstk500v1 -PCOM8 -b19200 -Uflash:w:C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex:i -Ulock:w:0x0f: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\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328PB
         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
           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
           efuse          0     0     0    0 no          1    0      0  4500  4500 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.03s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex"
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex:
avrdude: load data flash data from input file C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex:
avrdude: input file C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex contains 32768 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7e00
         0x00 != 0x01
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Error while burning bootloader.

I have tried things like, changing the baud rate in the boards.txt file, using the internal oscillator ( 8MHz as well as 1 MHz), reopening the IDE, etc. but getting the same error.
Also, tried to burn the fuse bits (as mentioned in the boards.txt file for the 16MHz crystal), getting error saying, 'programmer not responding'
Any help would be appreciated. Thank you in advance!

Last Edited: Wed. May 27, 2020 - 12:01 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks like the first "burn" sets the fuses to use an 16MHz xtal, the second fails most likely because you don't have an external xtal attached (with caps), with no valid clock source, the chip will not program.

Correct this, by adding an external 16MHz xtal and two 15pf caps (anything from 12pf to 18pf should work).  And try burning again.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

ki0bk wrote:

It looks like the first "burn" sets the fuses to use an 16MHz xtal, the second fails most likely because you don't have an external xtal attached (with caps), with no valid clock source, the chip will not program.

Correct this, by adding an external 16MHz xtal and two 15pf caps (anything from 12pf to 18pf should work).  And try burning again.

 

Jim

 

Hi Jim,

I am using a 16MHz crystal with two 22pF capacitors attached, but it gives the same error. I wrote it in my previous post also that the clock source i am using is a 16 MHz crystal.

Thanks.

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

If the clock was bad, the 2nd program step wouldn’t get as far as reading the signature.

so something else is wrong.

 

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

Are you flashing on the wrong order. Surely the fuses should be the final step, especially if you use lock-bits.

 

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

The Arduino IDE always writes the fuses before the flash (neither MiniCore, nor any other Arduino core that I know of, actually sets the lockbits to lock the chip- 0x3F simply sets all the used lockbits to 1, ie, nothing is locked). I can't say I see a compelling reason for writing fuses or flash first, though... (assuming not using lockbits to lock the chip, of course). 

 

We periodically see reports of this exact issue on the Arduino forums - but I can't say I know a cause or solution...

Arduino Cores: megaTinyCore - github.com/SpenceKonde/megaTinyCore (all tinyAVR 0-series and 1-series) and ATtinyCore - github.com/SpenceKonde/ATTinyCore (all classic ATtiny with part in family with at least 4k flash)... and another one coming soon!
I sell breakout boards for tinyAVR parts, prototyping board, and MOSFET boards in my Tindie store: tindie.com/stores/drazzy

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

avenger31 wrote:

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/avrdude.conf -v -patmega328pb -cstk500v1 -PCOM8 -b19200 -Uflash:w:C:\Users\hp\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.5/bootloaders/optiboot_flash/bootloaders/atmega328pb/16000000L/optiboot_flash_atmega328pb_UART0_115200_16000000L_B5.hex:i -Ulock:w:0x0f:m 

 

The last lock may be wrong "-Ulock:w:0x0f:m"

 

http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p&LOW=FF&HIGH=D6&EXTENDED=05&LOCKBIT=0F

 

On a 328p that would prohibit both Load Program Memory (LPM) and Store Program Memory (SPM) in boot loader section. I've been setting 0x2F but maybe that is also wrong.

 

http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p&LOW=FF&HIGH=D6&EXTENDED=05&LOCKBIT=2F

 

The calculator does not have a 328pb.

 

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-0856-AVR-Instruction-Set-Manual.pdf

 

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

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

That's not the problem... though I disagree with disabling LPM of bootloader section... 

Arduino Cores: megaTinyCore - github.com/SpenceKonde/megaTinyCore (all tinyAVR 0-series and 1-series) and ATtinyCore - github.com/SpenceKonde/ATTinyCore (all classic ATtiny with part in family with at least 4k flash)... and another one coming soon!
I sell breakout boards for tinyAVR parts, prototyping board, and MOSFET boards in my Tindie store: tindie.com/stores/drazzy

Last Edited: Fri. May 29, 2020 - 09:27 AM