Skip to content

Commit

Permalink
Added more detail about the convertHexToByteArray.py module
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Aug 31, 2016
1 parent 557840f commit 9692625
Showing 1 changed file with 54 additions and 48 deletions.
102 changes: 54 additions & 48 deletions README.md
Expand Up @@ -60,34 +60,34 @@ Written by Nick Gammon.
Version 1.11
Compiled on Nov 4 2014 at 11:10:33
Entered programming mode OK.
Signature = 1E 95 0F
Signature = 1E 95 0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = FF
HFuse = DE
EFuse = FD
Lock byte = CF
Clock calibration = 8D
LFuse = FF
HFuse = DE
EFuse = FD
Lock byte = CF
Clock calibration = 8D
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 512 bytes starting at 7E00
Bootloader:
7E00: 11 24 84 B7 14 BE 81 FF F0 D0 85 E0 80 93 81 00
7E10: 82 E0 80 93 C0 00 88 E1 80 93 C1 00 86 E0 80 93
...
7FE0: 11 50 E9 F7 F2 DF 1F 91 08 95 80 E0 E8 DF EE 27
7FF0: FF 27 09 94 FF FF FF FF FF FF FF FF FF FF 04 04
7E00: 11 24 84 B7 14 BE 81 FF F0 D0 85 E0 80 93 81 00
7E10: 82 E0 80 93 C0 00 88 E1 80 93 C1 00 86 E0 80 93
...
7FE0: 11 50 E9 F7 F2 DF 1F 91 08 95 80 E0 E8 DF EE 27
7FF0: FF 27 09 94 FF FF FF FF FF FF FF FF FF FF 04 04
MD5 sum of bootloader = FB F4 9B 7B 59 73 7F 65 E8 D0 F8 A5 08 12 E7 9F
MD5 sum of bootloader = FB F4 9B 7B 59 73 7F 65 E8 D0 F8 A5 08 12 E7 9F
Bootloader name: optiboot_atmega328
First 256 bytes of program memory:
0: 0C 94 52 05 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05
10: 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05
0: 0C 94 52 05 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05
10: 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05 0C 94 7A 05
...
```

Expand Down Expand Up @@ -124,9 +124,9 @@ Example of use:
Signature detector.
Written by Nick Gammon.
Signature = 1E 95 0F
Signature = 1E 95 0F
Fuses
Low = FF High = D6 Ext = FD Lock = CF
Low = FF High = D6 Ext = FD Lock = CF
Processor = ATmega328P
Flash memory size = 32768
Expand Down Expand Up @@ -174,14 +174,14 @@ Written by Nick Gammon.
Version 1.25
Compiled on Nov 4 2014 at 07:33:18
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xCF
Clock calibration = 0x8D
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xCF
Clock calibration = 0x8D
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'L' to use Lilypad (8 MHz) loader, or 'U' for Uno (16 MHz) loader ...
Expand Down Expand Up @@ -210,14 +210,14 @@ Example of use:
```
Attempting to enter programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xCF
Clock calibration = 0x8D
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xCF
Clock calibration = 0x8D
Actions:
[E] erase flash
[F] modify fuses
Expand All @@ -234,12 +234,12 @@ Wiring for the Atmega\_Hex\_Uploader sketch:
```
Arduino SD Card
--------------------------------
SS CS (chip select)
MOSI DI (data in)
MISO DO (data out)
SCK CLK (clock)
+5V 5V
Gnd Gnd
SS CS (chip select)
MOSI DI (data in)
MISO DO (data out)
SCK CLK (clock)
+5V 5V
Gnd Gnd
Arduino Target chip/board
-------------------------------------
Expand All @@ -248,8 +248,8 @@ D7 MOSI
D4 SCK
D5 Reset
D9 Clock of target (if required)
+5V 5V
Gnd Gnd
+5V 5V
Gnd Gnd
```

This sketch uses "bit banged" SPI for programming the target chip, which is why it uses pins D4, D5, D6, D7 instead of the hardware SPI pins.
Expand All @@ -271,12 +271,12 @@ Wiring for the Atmega\_Hex\_Uploader\_Fixed\_Filename sketch:
```
Arduino SD Card
--------------------------------
SS CS (chip select)
MOSI DI (data in)
MISO DO (data out)
SCK CLK (clock)
+5V 5V
Gnd Gnd
SS CS (chip select)
MOSI DI (data in)
MISO DO (data out)
SCK CLK (clock)
+5V 5V
Gnd Gnd
Arduino Target chip/board
-------------------------------------
Expand All @@ -285,13 +285,13 @@ D7 MOSI
D4 SCK
D5 Reset
D9 Clock of target (if required)
+5V 5V
Gnd Gnd
+5V 5V
Gnd Gnd
Arduino Switch and LEDs
--------------------------------
D2 Start-programming switch (normally open, other end to Gnd)
A0 Error LED (red)
D2 Start-programming switch (normally open, other end to Gnd)
A0 Error LED (red)
A1 Ready LED (green)
A2 Working LED (yellow)
```
Expand Down Expand Up @@ -365,8 +365,14 @@ convertHexToByteArray.py
------------------------

The `convertHexToByteArray.py` tool allows you to easily convert `.hex` files
into a c array that you can use inside the tools above. Its an alternative to
the lua script and easier to setup in most cases.
into a C array that you can use inside the Atmega\_Board\_Programmer code. It's an alternative to
the Lua script and easier to setup in most cases.

To run the script you need `python2` and the `intelhex` python library which can
be downloaded [here](https://github.com/bialix/intelhex) or via `pip`.

Example of use:

```
python convertHexToByteArray.py ATmegaBOOT_168_atmega328_pro_8MHz.hex > bootloader_lilypad328.h
```

0 comments on commit 9692625

Please sign in to comment.