Skip to content
Snippets Groups Projects
Commit 15939bed authored by Alexandre Kaspar's avatar Alexandre Kaspar
Browse files

CKSEL fuses

parent f3224bf0
Branches
No related tags found
No related merge requests found
Pipeline #4514 passed
images/att44_cksel.png

109 KiB

images/att44_cksel2.png

206 KiB

images/att44_cksel3.png

260 KiB

images/att44_feb.png

129 KiB

images/att44_fhb.png

242 KiB

images/att44_flb.png

196 KiB

......@@ -300,6 +300,57 @@ The symbols are:
Looking at the individual bits (in groups of 4 since `2^4 = 16`) is typically the main reason for hexadecimal.
### Fuse meanings
Fuse bits describe low-level configurations.
There are tools available to figure out what fuses to write, notably Atmel Studio allows you to set those interactively during the programming step with help for each individual fuse of each device they support.
There are also [fuse calculators](http://www.engbedded.com/fusecalc) online.
But before you jump and set fuses, you should understand what they do, since they can make your micro-controller stay silent forever by disabling programming capabilities or changing the basic clock frequency while expecting a sepcific clock (that may not exist, and then you may need to change the hardware to make it work again).
Long story short - these are bits you should write carefully because some options are not reversible (or hard to reverse).
The first part is reading the datasheet about your micro-controller and its section related to fuses (e.g. page 192 of the att44 [datasheet](http://fab.cba.mit.edu/classes/863.09/people/ryan/week5/ATtiny44%20Data%20Sheet.pdf#page=159)).
In our ATTiny44 case, it mentions three different fuse bytes:
* **Fuse Extended Byte** (extra for self-programming)
* **Fuse High Byte**
* **Fuse Low Byte**
Let's have a look at the tables:
<img src="images/att44_feb.png" width="400">
<img src="images/att44_fhb.png" width="400">
<img src="images/att44_flb.png" width="400">
In our setup, we're just modifying the low byte and choosing value `0x5E`.
Let's deconstruct that:
`0x5E` is, in binary `01011110`, and the bits start (0-indexed) from the right (least significant bit).
The last four bits are about the clock selection, and their default `0010` stands for the 8MHz internal RC oscillator as source of the clock.
In our program above, we're using `1110`, which we can understand by looking at the section on the clock (chapter 6, notably [page 24](http://fab.cba.mit.edu/classes/863.09/people/ryan/week5/ATtiny44%20Data%20Sheet.pdf#page=24)):
<img src="images/att44_cksel.png" width="400">
We're in the last row case (`111` external crystal or resonator), which means we need to go look farther at page 27:
<img src="images/att44_cksel2.png" width="500">
And there we find that we're assuming an external crystal/resonator, with frequency from 8MHz and above.
The last bit `CKSEL0` requires looking a bit further:
<img src="images/att44_cksel3.png" width="400">
Since we have `CKSEL0=0`, it means we assume a ceramic resonator.
Given the additional `SUT1..0=01` (3rd and 4th bits from the left in `01011110`, we know that we have BOD (**B**rown-**o**ut **D**etector) enabled.
You can read about that [there](https://microchipdeveloper.com/8avr:bod).
The `CKSEL` fuses are the fuses you are the most likely to every change, whereas the other ones are typically very specific.
</xmp>
<script src="sd/strapdown.js"></script>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment