2015-08-16

Introducing AutoISP - In-Circuit Reprogramming Made Simple

This week, I was honored to see my AutoISP family of boards being put into actual commercial production by Boxtec.


AutoISP is designed to help those among us ATtiny programmers who don't write perfect software on the first iteration. Previously, our alternatives were:

  • Pull the microcontroller from the board, plug it into a programmer, reprogram it, pull it from the programmer, and plug it back into the board.
  • Make the programming pins accessible on the board (e.g. with IC hooks or by adding an ICSP header to the board). This may limit the use to which those pins can be put otherwise (and sparing 4 data pins on an ATtiny85 for programming is rarely an attractive proposition).
AutoISP solves this problem by placing the microcontroller itself on a slave board which is plugged into a socket on the circuit to be developed. The AutoISP master board then employs an STMAV340TTR 4PDT "video switch" to switch between two states:
  • If the RESET pin on its ICSP header is HIGH (or not connected), all pins on the microcontroller are connected to the development circuit, as if the microcontroller were plugged into the circuit directly.
  • If the RESET pin goes LOW, the MOSI, MISO, RESET, and SCK pins on the microcontroller get disconnected from the development circuit and connected to the ICSP header on the master board instead, which allows the microcontroller to be reprogrammed.
This makes it possible to use AutoISP transparently with most ISP programmers (e.g. the ArduinoISP sketch or ScratchMonkey), as long as those programmers leave VCC turned on while not programming. With the exception of the RESET pin, all other pins of the microcontroller are available for unrestricted use.


All electronic are placed on the master board, while the slave boards merely have sockets and pin headers. At the moment, slave boards are available for the ATtinyX5 (25/45/85), ATtinyX4 (24/44/84) and ATmegaX8 (88,168,328) series, although the approach is applicable to any ATtiny or ATmega processor.

Detailed circuits are available on Github and in the AutoISP manual.


2015-04-20

Introducing ChipHeadBang

There are a number of widely used methods to connect microcontroller projects to USB, all of which are not entirely satisfactory:

  • The commonly used FTDI chips are somewhat expensive, and their manufacturer has made some unpopular decisions with their driver support (although technically, the FTDI drivers work quite well).
  • Atmel also offers microcontrollers with built in USB, but those also tend to be a bit expensive.
  • Software USB stacks use a considerable proportion of the microcontroller's processing power, and as not always as reliable as hardware solutions.
When I therefore heard about a very cheap (40 cents a piece) USB to serial converter IC, the WinChipHead CH340G, I was eager to try it, and bought a few (I bought mine on AliExpress, but they are now also available at Boxtec). A prototype I built on a breadboard worked reasonably well, so I decided to try my hand at a custom PCB design:


 

To a large part, this follows a reference design from the vendor datasheet, using an Eagle part made by blogger [Ian]. I added a few customizations:

  • Boxtec's Christoph Schneeberger successfully convinced me to include a fuse. Though one might suspect a nefarious plot to sell more fuses, he'd probably make a bigger profit selling replacement parts for melted down unprotected boards (not to speak of potentially frying the USB port of a laptop).
  • I added LEDs on the RX and TX lines. Since serial lines are high when quiescent, I made them active low.
  • I put an ICSP header on the board so it could easily also be used as a bitbang programmer.
In many ways, the resulting design was a bit more complex than what I had done before: It's my first design involving an USB connector, and it uses more SMD parts (12) than any of my previous designs. I was therefore quite pleased when I managed to assemble my first copy of it with relatively little drama, and the functionality worked as designed (As usual, my application of solder paste for the CH340 was somewhat uneven, so I had to fix some shorts and one flaky pin connection). The serial connection seems to work even at high rates, and the bitbang programming works at the stately pace of about 1.2KB per minute.

I should mention that the CH340 has its drawbacks: Documentation is hard to find, especially if you don't speak Chinese. Driver support is iffy: My understanding is that the Linux and BSD drivers are OK, but the Windows and Mac drivers are not properly signed, and the Mac drivers will actually cause kernel panics on the latest versions of OS X. I was quite satisfied with quality of the commercial third party OS X driver I ended up buying, and the price is very reasonable, but if building a cheap solution was the objective in the first place, even that reasonable price does of course spoil the economics (if not the hedonics) of the exercise.

UPDATE: Thanks to the codebender team, there is now a working free Mac driver for CH340 again, even a properly signed one.

Design files available on Github: https://github.com/microtherion/ChipHeadBang

2015-04-05

Introducing Quarantatre

I might as well retitle my blog "The Art of the Blink Sketch", but this one has a bit of a twist:


The Quarantatre is a breakout board for the ATtiny43U microcontroller (basically just an implementation of the reference design shown in the AVR188 application note, though I did not follow the component layout recommendations all that closely).

In addition to the typical features found in other ATtiny models, the ATtiny43U has a built in boost converter allowing it to not only run off a single AA or AAA battery, but even to generate a regulated 3V voltage. While this only allows for a small current draw (apparently the limit is around 30mA), this could potentially be interesting for some applications.

The boost converter needs a few external components to work, and some of them, especially the Schottky diode, are not really available in breadboard friendly variants, so to truly test the boost converter, I had to make this custom PCB (available for ordering at OSH Park, design files on Github).

As usual, I've made an Arduino-style core available on Github at https://github.com/microtherion/arduino-tiny1634-43u (migrating from Google Code, which is shutting down). The standard Arduino tool chain probably won't support it; as always, I recommend CrossPack-AVR for OS X.