Giter VIP home page Giter VIP logo

updiprog's Introduction

updiprog

This is C version of UPDI interface utility with improvements, you could refer to the Python version: pyupdi

pyupdi is a Python utility for programming AVR devices with UPDI interface using a standard TTL serial port.

The main purpose is the possibility to use UPDI to flash the new TinyAVR at any PC. No external libraries were used, so no dependencies. I have some problems during pyupdi installation because of absence of the Internet connection, so I had to copy all necessary packages and wheels first and to install them manually. Yes, I know about the possibility to compile the executable from the Python script, but pyupdi has also some disadvantages like lackage of reading the flash content, slow speed of programming and probably no error handling at all. So I have decided to improve it and get it working with standard C language.

Code::Blocks IDE was used to write code and compile it.

I have tried to write it portable for Windows and Linux but can't really test it on Linux because of the driver bug for CH340 USB to serial converter, it can't work with parity bits.

I am using CH340 USB to TTL converter to program Atmel Tiny devices, you just need to connect TX and RX lines, they are actually already have a 1.5k output resistor on my connector, so just connect them and don't forget to connect GND of the converter with GND of the PCB with Tiny MCU. There is also a possibility to supply Tiny with the voltage from the CH340 converter, so this adapter seems to be a good choice to start with programming of AVR devices.

                        Vcc                     Vcc
                        +-+                     +-+
                         |                       |
 +---------------------+ |                       | +--------------------+
 | CH340 converter     +-+                       +-+  AVR Tiny device   |
 |                     |                           |                    |
 |                  TX +---+-----------------------+ UPDI               |
 |                     |   |                       |                    |
 |                     |   |                       |                    |
 |                  RX +---+                       |                    |
 |                     |                           |                    |
 |                     +---+-----------------------+                    |
 +---------------------+   |                       +--------------------+
                          +-+
                         GND

Warning!!! If you don't have any output resistors on your CH340 board, please mount them!

Additional features were added:

- reading content of the flash memory from the MCU
- reading fuses
- different levels of logging
- faster programming/reading (about 6 seconds for the whole Tiny1616)
- many additional error messages

A brief description of all available options.

-b BAUDRATE - set COM baudrate (default=115200)
-d DEVICE   - target device (tinyXXX)
-c COM_PORT - COM port to use (Win: COMx | *nix: /dev/ttyX)
-e          - erase device
-fw X:0xYY  - write fuses (X - fuse number, 0xYY - hex value)
-fr         - read all fuses
-h          - show this help screen
-mX         - set logging level (0-all/1-warnings/2-errors)
-r FILE.HEX - Hex file to read MCU flash into
-p          - use DTR line to power device
-w FILE.HEX - Hex file to write to MCU flash

Examples:

Erase Flash memory:
    updiprog.exe -c COM10 -d tiny81x -e

Program Flash memory from file tiny_fw.hex:
    updiprog.exe -c COM10 -d tiny81x -w tiny_fw.hex
	
Read Flash memory to file tiny_fw.hex:
    updiprog.exe -c COM10 -d tiny81x -r tiny_fw.hex
	
Read all fuses:
	updiprog.exe -c COM10 -d tiny81x -fr
	
Write 0x04 to fuse number 1 and 0x1b to fuse number 5:
	updiprog.exe -c COM10 -d tiny81x -fw 1:0x04 5:0x1b

updiprog's People

Contributors

polarisru avatar brain5lug avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.