arduino / arduino/ArduinoCore-avr

Lock bit values fail verification

Open
#436 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985579

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with boards.txt and the Uno bootloader fuse and lock-bit settings described in the issue. Reproduce the verification failure with avrdude on an ATmega328P if hardware is available, then confirm that the settings make fuse writes verify successfully without changing unrelated board configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.