Skip to content

Lock bit values fail verification #436

Open
@rockstorm101

Description

@rockstorm101

ArduinoCore-avr Version: 1.8.3

It's not possible to update the fuse/lock bits with the included boards.txt and recent avrdude versions.

avrdude used to mask unused bits for some microcontrollers, but this was changed some time ago.

As a result, trying to write fuse bits into an Arduino Uno leads to the following error:

$ /usr/bin/avrdude -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x3f
avrdude: verification error; content mismatch

The two uppermost lock bits in the ATmega328P are unused and will always read as logic 1.

As a result, the following modification must be made to boards.txt:

diff --git boards.txt boards.txt
index 2dca915..d2b8dc4 100644
--- boards.txt
+++ boards.txt
@@ -67,8 +67,8 @@ uno.bootloader.tool=avrdude
 uno.bootloader.low_fuses=0xFF
 uno.bootloader.high_fuses=0xDE
 uno.bootloader.extended_fuses=0xFD
-uno.bootloader.unlock_bits=0x3F
-uno.bootloader.lock_bits=0x0F
+uno.bootloader.unlock_bits=0xFF
+uno.bootloader.lock_bits=0xCF
 uno.bootloader.file=optiboot/optiboot_atmega328.hex
 
 uno.build.mcu=atmega328p

This will make avrdude expect a logic 1 and prevent verification failure.

Originally reported by Gregor Riepl [1]. Suspected relation to #61. Please address and/or advice.

Thanks a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions