I am doing a project that requires miniaturization and due to the shortage of semiconductors I thought it would be a good idea to buy some Arduino Pro mini and remove their microcontroller.
The problem is that every time I re-burn the Bootloader I get a bunch of errors until I can't use the avr anymore. At this point I probably already bricked 3 atmega328p
The original Arduino Pro mini works at 5V, and 16MHz, Aliexpress description said that it already has the bootloader.
This is the out of the box log when uploading a sketch using an USBasp (it's succesfull)
Sketch uses 5994 bytes (19%) of program storage space. Maximum is 30720 bytes.
Global variables use 232 bytes (11%) of dynamic memory, leaving 1816 bytes for local variables. Maximum is 2048 bytes.
/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:i
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 "/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/Users/vn532oi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
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 : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
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: auto set sck period (because given equals null)
avrdude: reading input file "/var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex"
avrdude: writing flash (5994 bytes):
Writing | ################################################## | 100% 4.25s
avrdude: 5994 bytes of flash written
avrdude: verifying flash memory against /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:
avrdude: load data flash data from input file /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:
avrdude: input file /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex contains 5994 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 3.81s
avrdude: verifying ...
avrdude: 5994 bytes of flash verified
avrdude done. Thank you.
The target setup is 3.3V and 8Mhz (internal), so I've been trying to use MiniCore with the next settings:
- Board: Atmega328
*Clock: Internal 8 Mhz - BOD: BOD 2.7V
- EEPROM: EEPROM retained
- Compiler LTO: LTO disabled
- Variant: 328P / 328PA
*Bootloeader: Yes (UART0)
And this is what I get when try to burn the boot loader:
/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf -v -patmega328p -cusbasp -Pusb -e -Ulock:w:0x3f:m -Uefuse:w:0b11111101:m -Uhfuse:w:0b11010110:m -Ulfuse:w:0xe2:m
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf"
User configuration file is "/Users/vn532oi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
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 : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):
/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/bootloaders/optiboot_flash/bootloaders/atmega328p/8000000L/optiboot_flash_atmega328p_UART0_38400_8000000L_B5.hex:i -Ulock:w:0x0f:m
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/avrdude.conf"
User configuration file is "/Users/vn532oi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
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 : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null)
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 | ################################################## | 100% 0.00s
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.00s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0b11010110"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0b11010110:
avrdude: load data hfuse data from input file 0b11010110:
avrdude: input file 0b11010110 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xe2"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xe2:
avrdude: load data lfuse data from input file 0xe2:
avrdude: input file 0xe2 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude done. Thank you.
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
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: auto set sck period (because given equals null)
avrdude: reading input file "/Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/bootloaders/optiboot_flash/bootloaders/atmega328p/8000000L/optiboot_flash_atmega328p_UART0_38400_8000000L_B5.hex"
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against /Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/bootloaders/optiboot_flash/bootloaders/atmega328p/8000000L/optiboot_flash_atmega328p_UART0_38400_8000000L_B5.hex:
avrdude: load data flash data from input file /Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/bootloaders/optiboot_flash/bootloaders/atmega328p/8000000L/optiboot_flash_atmega328p_UART0_38400_8000000L_B5.hex:
avrdude: input file /Users/vn532oi/Library/Arduino15/packages/MiniCore/hardware/avr/2.1.3/bootloaders/optiboot_flash/bootloaders/atmega328p/8000000L/optiboot_flash_atmega328p_UART0_38400_8000000L_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.
Since I see that it failed in verification step (not sure if boot loader is there), I proceed to remove the 16 MHz crystal an capacitors and give it a try
Sketch uses 6100 bytes (18%) of program storage space. Maximum is 32256 bytes.
Global variables use 230 bytes (11%) of dynamic memory, leaving 1818 bytes for local variables. Maximum is 2048 bytes.
/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:i
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/vn532oi/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino18/etc/avrdude.conf"
User configuration file is "/Users/vn532oi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
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 : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
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: auto set sck period (because given equals null)
avrdude: reading input file "/var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex"
avrdude: writing flash (6100 bytes):
Writing | ################################################## | 100% 4.22s
avrdude: 6100 bytes of flash written
avrdude: verifying flash memory against /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:
avrdude: load data flash data from input file /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex:
avrdude: input file /var/folders/wy/ztppc8wn7ms7fmb0gxjzv21w0000gp/T/arduino_build_569259/watch.ino.hex contains 6100 bytes
avrdude: reading on-chip flash data:
Reading | ###############################################An error occurred while uploading the sketch
### | 100% 3.89s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x0c
avrdude: verification error; content mismatch
avrdude done. Thank you.
If I try to use a USB/TTL I get
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
If I try to burn the boot loader without crystal I get the same error
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7e00
0x00 != 0x01
avrdude: verification error; content mismatch
From here the errors only get worse to the point where the device signature is 0x00000000 and I officially declare that avr dead (or just bricked)
Any suggestions?