Fuse settings

Contents

Introduction

Fuses are a few special configuration bytes that are stored on the atmega328 microcontroller. Their role is to configure low level settings of the microcontroller such as the type of crystal oscillator connected to it, the brown-out detector level, the bootloader size etc.

When you buy an OrangeRX or Wolfbox module, the fuses are preconfigured to certain values.

It’s however possible to change their values under certain circumstances. Just an FTDI cable isn’t sufficient to modify the fuses values, this can only be done with a programmer such as the USBasp programmer.

Why modify the fuses values ?

There can be several reasons, but for ULRS project the most obvious one is to activate the brown-out detector on OrangeRX modules.

The brown-out detector

The brown-out detector (BOD) is a simple feature of the microcontroller that will inactivate it whenever its supply voltage is below a configurable limit.

This is advisable for any project, because if the microcontroller operates in undervoltage it can lead to unexpected behaviours : it can for example randomly jump to any memory location and execute the code.

One consequence of this is that it can jump into the bootloader code and execute randomly sequences of code that will modify the flash memory. In this case the firmware itself can be corrupted and even after resetting the microcontroller and powering correctly it won’t work. Until the firmware is flashed again.

Similar examples can be found in other projects (for example here).

For this to happen the module supply voltage has to be very low, under 3.39V (remember that because of the switching regulator the supply voltage of the microcontroller is lower). This shouldn’t happen in normal use with the module connected directly to the battery, but it happened already to a user with an almost empty battery and full throttle.

It’s not clear why Hobbyking doesn’t activate the BOD by default, but anyways for maximum safety it’s recommended to do it.

Only required for OrangeRX modules ?

Yes, because the Arduino Mini (ULRS Mini modules) have a factory setting of 4.3V BOD, which is fine as these boards run at 5V. So all the ULRS Mini modules based on arduino mini have already a good BOD.

And for the Wolfbox modules this should still be checked.

Modifying the fuses

About the fuse values

The fuses are represented by 3 bytes : the high fuse, the low fuse and the extended fuse. Every bit of every byte has a specific meaning, please refer to the atmega328 datasheet for a description of all the bits (or to this article).

Be careful that the high, low and extended fuses are sometimes presented in a different order.

Factory fuse values for OrangeRX

Factory settings on the OrangeRX modules :

Extended fuse : 0xFF (the 0x means that it’s an hexadecimal value)
High fuse : 0xD8
Low fuse : 0xF7

Factory fuse values for Arduino pro mini 5V 16MHz used in ULRS Minis

This is just for information, as explained above the Arduino pro mini has a factory setting of 4.3V BOD, which is fine as it runs at 5V. So no real need to change it.

Factory settings on the Arduino pro mini 5V 16MHz :

Extended fuse : 0xF8
High fuse : 0xDA
Low fuse : 0xFF

Recommended fuse values

The fuse values have a difference for the brown-out detector, which is then configured for 2.7V.

Notice that the atmega328 only allows 3 different BOD values, and 2.7V is the only value that will work for this project. (Don’t try to set it at 4.3V, because the microcontroller is powered at 3.3V, and don’t set it at 1.8V because it won’t provide any improvement.)

Extended fuse : 0xFD
High fuse : 0xD8
Low fuse : 0xF7

A word of caution

It should be noted that modifying the fuses in a wrong way can make the board unusable. For example if Debugwire and SPI are deactivated at the same time it won’t be possible to program the part again, including impossible to modify the fuses again. Basically you’ll have to buy a new part in this case.

Modifying the fuses

Without going into the detail of avrdude installation, the command to run to set the fuses with USBasp is the following :

avrdude -Cavrdude.conf -patmega328p -c usbasp -V -D -U efuse:w:0xFD:m -u -U hfuse:w:0xD8:m -U lfuse:w:0xF7:m

Latest Posts

    Pages

    Categories

    • No categories

    Archives

      Posts by Category