From 834de3607047aa5f6fbae4a7897c8ac8436371be Mon Sep 17 00:00:00 2001
From: Alexandre Kaspar <akaspar@mit.edu>
Date: Fri, 25 Oct 2019 13:39:26 -0400
Subject: [PATCH] To hexa

---
 index.html | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/index.html b/index.html
index c82841c..1480f02 100644
--- a/index.html
+++ b/index.html
@@ -247,7 +247,57 @@ The manual is slightly more verbose and tells us what's available for the memory
 
 <img src="images/avrdude_u.png" width="600">
 
+In our case, `program-usbtiny` uses the following update command:
+```bash
+-U flash:w:hello.ftdi.44.echo.c.hex
+```
+
+which means:
+
+* Updating the `flash` memory
+* **W**riting to it (not **r**eading nor **v**erifying)
+* Using the hex file `hello.ftdi.44.echo.c.hex` that got generated
+
+Why the `flash` memory?
+
+You should read this [memory part](https://en.wikibooks.org/wiki/Embedded_Systems/Atmel_AVR#Memory) of the Embedded Systems from Wikibooks.
+And you will definitely need to read the *datasheet* of your target micro-controller.
+
+As a summary, there are different types of memory available. For the simple AVR systems, there are:
+
+* **data** memory, I/O registers and SRAM - those are dynamic, changing during execution, and vanishing upon shutdown (aka *volatile* memory)
+* **flash** program memory - this is where your program goes
+* **[EEPFROM](https://en.wikipedia.org/wiki/EEPROM)** aka Electrically Eraseable Programmable Read-Only Memory, which allows you to store data that survives a restart / shutdown
+* **fuses** are special types of memory that cannot be modified by the program and must be programmed separately
+
+For interested readers:
+
+* [flash vs eeprom](https://electronics.stackexchange.com/questions/69234/what-is-the-difference-between-flash-memory-and-eeprom/69275)
+
+### avrdude and fuses
+
+Fuses are specific bits of the memory that specify low-level configurations.
+Thoses have to be programmed separately from the main program memory.
+
+In our previous example with the ATTiny44, the fuse programming was done with the `program-usbtiny-fuses` target:
+```bash
+program-usbtiny-fuses: $(PROJECT).hex
+	avrdude -p t44 -P usb -c usbtiny -U lfuse:w:0x5E:m
+```
+
+Here, the `-U` command targets the **low** bits of the fuse memory for the ATTiny44.
+The actual value is specified as a hex number: `0x5E`.
+
+### Hexadecimal Numbers
+
+Hex numbers are numbers in hexadecimal base (16) and are typically prefixed with `0x`.
+The symbols are:
+
+| Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+| Hexa | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+| Bin | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
 
+Looking at the individual bits (in groups of 4 since `2^4 = 16`) is typically the main reason for hexadecimal.
 
 </xmp>
 <script src="sd/strapdown.js"></script>
-- 
GitLab