|
| 1 | +# updiprog |
| 2 | + |
| 3 | +This is UPDI programming software for AVR microcontrollers. It was based on the |
| 4 | +code at https://github.com/Polarisru/updiprog but has undergone a lot of |
| 5 | +restructuring and has speed and reliability improvements and additional features. |
| 6 | +However, this version does not work on Windows. |
| 7 | + |
| 8 | +``` |
| 9 | + Vcc Vcc |
| 10 | + +-+ +-+ |
| 11 | + | | |
| 12 | + +---------------------+ | | +--------------------+ |
| 13 | + | Serial port +-+ +-+ AVR device | |
| 14 | + | | +----------+ | | |
| 15 | + | TX +------+ 1k +---------+ UPDI | |
| 16 | + | | +----------+ | | | |
| 17 | + | | | | | |
| 18 | + | RX +----------------------+ | | |
| 19 | + | | | | |
| 20 | + | +--+ +--+ | |
| 21 | + +---------------------+ | | +--------------------+ |
| 22 | + +-+ +-+ |
| 23 | + GND GND |
| 24 | +``` |
| 25 | + |
| 26 | +# Features |
| 27 | + - Read/write flash memory |
| 28 | + - Read/write fuses |
| 29 | + - Chip erase |
| 30 | + - Chip reset |
| 31 | + - Read/write up to 1Gbps |
| 32 | + - CRC checking |
| 33 | + |
| 34 | +## CRC Check |
| 35 | +You can enable CRC checking with the ``-x`` option. With this option enabled |
| 36 | +during a FLASH write updiprog will do the following: |
| 37 | + |
| 38 | + * Read the HEX file |
| 39 | + * Compute a CRC-16-CCITT |
| 40 | + * Read the last 2-bytes of FLASH |
| 41 | + * If the last 2-bytes match the CRC, stop |
| 42 | + * Otherwise program the FLASH |
| 43 | + * Write the CRC to the last 2-bytes of FLASH |
| 44 | + |
| 45 | +The end result is that with the ``-x`` option updiprog will not reprogram the |
| 46 | +chip if the CRC indicates that the programmed firmware is the same. |
| 47 | + |
| 48 | +The programmed CRC can also be used with the AVR's CRCSCAN feature. With |
| 49 | +CRCSCAN enabled, the chip will not run if the CRC at the end of FLASH does not |
| 50 | +match the contents of FLASH memory. |
| 51 | + |
| 52 | +# Options |
| 53 | +``` |
| 54 | +updiprog [OPTIONS] |
| 55 | +
|
| 56 | +OPTIONS: |
| 57 | + -b BAUDRATE - Serial port speed (default=115200) |
| 58 | + -d DEVICE - Target device (e.g. tiny321x) |
| 59 | + -c PORT - Serial port (e.g. /dev/ttyUSB0) |
| 60 | + -e - Chip erase |
| 61 | + -R - Chip reset |
| 62 | + -F - Read all fuses |
| 63 | + -f FUSE VALUE - Write fuse |
| 64 | + -r FILE.HEX - Hex file to read FLASH into |
| 65 | + -w FILE.HEX - Hex file to write to FLASH |
| 66 | + -x - Enable CRC checks |
| 67 | + -v - Increase log level. Errors -> Warnings -> All |
| 68 | + -h - Show this help screen and exit |
| 69 | +``` |
| 70 | + |
| 71 | +# Supported devices |
| 72 | + |
| 73 | +``` |
| 74 | +mega480x mega320x mega160x mega80x |
| 75 | +tiny321x tiny160x tiny161x tiny80x |
| 76 | +tiny81x tiny40x tiny41x tiny20x |
| 77 | +tiny21x |
| 78 | +``` |
| 79 | + |
| 80 | +# Examples |
| 81 | + |
| 82 | +## Chip Erase |
| 83 | + updiprog -c /dev/ttyUSB0 -d tiny321x -e |
| 84 | + |
| 85 | +## Program FLASH from HEX file |
| 86 | + updiprog -c /dev/ttyUSB0 -d tiny321x -w firmware.hex |
| 87 | + |
| 88 | +## Program FLASH from HEX file at 1G BAUD |
| 89 | + updiprog -c /dev/ttyUSB0 -d tiny321x -w firmware.hex -b 1000000 |
| 90 | + |
| 91 | +## Read FLASH to HEX file |
| 92 | + updiprog -c /dev/ttyUSB0 -d tiny321x -r tiny_fw.hex |
| 93 | + |
| 94 | +## Read all fuses: |
| 95 | + updiprog -c /dev/ttyUSB0 -d tiny321x -F |
| 96 | + |
| 97 | +## Write 0x04 to fuse number 1 and 0x1b to fuse number 5 |
| 98 | + updiprog -c /dev/ttyUSB0 -d tiny321x -f 1 0x04 -f 5 0x1b |
| 99 | + |
| 100 | +## Program FLASH from HEX file at 1G BAUD with CRC check |
| 101 | + updiprog -c /dev/ttyUSB0 -d tiny321x -w firmware.hex -b 1000000 -x |
| 102 | + |
| 103 | +## Erase the chip then program FLASH from HEX file at 1G BAUD |
| 104 | + updiprog -c /dev/ttyUSB0 -d tiny321x -e -w firmware.hex -b 1000000 |
| 105 | + |
| 106 | +## Chip Reset |
| 107 | + updiprog -c /dev/ttyUSB0 -d tiny321x -R |
0 commit comments