Introduction: ATTiny HV Programmer

This instructable is for a ATTiny programming utility using an ESP8266 and a browser based user interface.It follows on from a previous instructable Fuse editor for reading and setting the fuses but now supports erasing, reading and writing the flash and EEPROM memories.

The fuse support allows making changes to the settings controlled by the 2 fuse bytes a very simple activity.

The memory supports allows backing up and restoring the contents of flash and EEPROM. New content from hex files may also be written. This makes restoring or writing new micronucleus bootloaders very simple.

The device has the following features.

  • Web server supporting reading and writing fuse data and an editor page giving easy access to fuse options
  • Erasing chip (needed before writing new material)
  • Reading and writing Flash program data from hex files
  • Reading and writing EEPROM data from hex files
  • Support for ATTiny 25,45, and 85 variants
  • USB powered with internal 12V generator for high voltage programming
  • Wifi network configuration using wifiManager Access pointBrowser access to the ESP8266 SPIFFS filing system for uploading and downloading files
  • OTA update of the ESP8266 firmware

Step 1: Components and Tools

Components

  • ESP-12F module
  • 5V to 12V boost module
  • micro USB socket with solderable connector
  • 220uF Tantalum capacitor
  • xc6203 3.3V LDO regulator
  • MOSFET transistors 3x n channel AO3400 1 x p-channel AO3401
  • Resistors 2 x 4k7 1x 100k 1x 1K 1x470R 1x 1R27
  • pin header block
  • Small piece of breadboard for support circuitry
  • hook up wireEnclosure ( I used a 3D printed box at https://www.thingiverse.com/thing:4208709)

Tools

  • Fine point soldering iron
  • Tweezers
  • Wire cutters

Step 2: Electronics

The schematic shows all the power is derived from a 5V USB connection. A regulator provides 3.3V to the ESP-12F module. A small boost module produces the 12V needed for high voltage programming.

The ESP GPIO gives the 4 logic signals used in high voltage programming (clock, data in, data out and command in).

One GPIO is used to turn on and off a MOSFET transistor fed by the 12V rail via a 1K resistor. When the GPIO is high the tMOSFET is on and its drain is at 0V. When the GPIO is set low the drain rises to 12V needed to set the high voltage programming mode. A second GPIO can be used to lower the 12V high down to 4V so that it could be used as a conventional reset signal. This facility is currently unused but could be used to support SPI programming rather than high voltage programming.

One GPIO is used to turn on and off a MOSFET 2 stage driver for the 5V supply to the ATTiny. This arrangement is used to meet the specification that when the 5V is turned on it has a fast rise time. This is not met driving the supply direct from a GPIO particularly with the 4u7 decoupling capacitor present on most ATTiny modules. A low value resistor is used to dampen the current spike caused by the rapid turn on of the MOSFET transistors. It may not be needed but is used here to avoid any glitches which could be caused by this turn on spike.

Note that the schematic differs a little bit from the previous fuse editor version. The GPIO pins are re-assigned to make SPI programming possible although the software doesn't use this at the moment.The pins reading signals from the ATTiny have additional protection for the 5V signals used.

Step 3: Assembly

The picture shows the components assembled into a small enclosure. A small breadboard sits on top of the ESP-12F module and contains the 3.3V regulator and the 2 voltage drive circuits.

The 12V boost module is on the left getting its input power from the USB. The enclosure has a slot for the 7 pin header block to allow connections to the ATTiny. After wiring up and testing the USB and header block are secured onto the enclosure with resin glue.

A label may be printed from the image to stick to the box to help hooking up the signals.

Step 4: Software and Installation

The software for the programmer is in an Arduino sketch ATTinyHVProgrammer.ino available at https://github.com/roberttidey/ATTinyHVProgrammer

It uses a library containing basic web functions, wifi set up support, OTA updates and browser based filing system access. This is available at https://github.com/roberttidey/BaseSupport

Configuration of the software is in a header file BaseConfig.h. The 2 items to change here are passwords for the wifi set up access point and a password for OTA updates.

Compile and upload to the ESP8266 from an Arduino IDE. The IDE config should allow for an SPIFFS partion e.g using 2M/2M will allow OTA and a large filing system. Further updates may then be done using OTA

When first run the module will not know how to connect to the local wifi so will set up a configuration AP network. Use a phone or tablet to connect to this network and then browse to 192.168.4.1. A wifi configuration screen will appear and you should select the appropriate network and enter its password. The module will reboot and connect using this password from now on. If moving to a different network or changing the network password the AP will be activated again so follow the same procedure. When entering the main software after connecting to wifi then upload the files in the data folder by browsing to the modules ip/upload. This allow a file to be uploaded. After all the files are uploaded then further filing system access can be done using ip/edit. If the ip/ is accessed then the index.htm is used and brings up the main programmer screen. This allows fuse data to be seen, edited and written, the chip to be erased and flashh and EEPROM memory to be read and written.

There are a number of web calls used to achieve this

  • ip/readFuses gets current fuse data
  • ip/writeFuses writes new fuse data
  • ip/erasechip.erases the chip
  • ip/dataOp supports read and write memory functions it supplies the following parameters
    • dataOp (0=read, 1=write)
    • dataFile (name of hex file)
    • eeprom (0= Flash, 1 = eeprom)
    • version (0= 25, 1=45, 2=85)

in addition an AP_AUTHID parameter may defined in the sketch before compiling. If defined then it must be entered in the web page to allow operations.

ip/edit gives access to the files; ip/firmware gives access to OTA updates.

The hex file format is intel style records compatible with those produced by Arduino IDE. If a start address record is present then will trigger the insertion of an RJMP instruction at location 0. This allows micronucleus boot loader files to be programmed into an erased chip and to function. For convenience plain Hex files consisting of a 4 character hex address followed by 16 hex data bytes may also be read and used.