MicroPython learns a new trick – ISP for AVRs

One of the reasons why the Arduino became so popular was the ability to program it with ease. It meant the end of big parallel programmers that would cost an arm and a leg. The latest installment of CircuitPython from [Lady Ada] and the team over at Adafruit is a library for programming AVR microcontrollers without a dedicated PC.

For the uninitiated, in-system programming or ISP for AVR controllers employ the SPI bus to write the compiled binary to the flash memory of the controller. The discount on the number of pins used itself is a benefit though getting the timings right was a bit tricky in the good old days. Most dedicated ISPs handle this nicely, though they are normally slaves to a host PC where an ‘upload’ button initiates the process.

With CircuitPython (a derivative of MicroPython), programming microcontrollers does not require going through the code-compile-flash cycle. It can be run on a number of processors, however, AVRs are not among them so this neat little library offers the next best thing. Wire-up an Atmega328P or ATmega2560 to a board like the ESP8266 that does run CircuitPython, and you can write firmware on the fly.

There is a complete tutorial on the subject thanks to [Phillip Torrone] and [Lady Ada] which includes some demo files for testing out the functionality. This opens up a lot of possibilities where OTA firmware updates for an AVR co-processor. We expect to see some keychain AVR programmers in the near future taking a hint from the ESP8266 based Two-Factor Authentication featured previously.

12 thoughts on “MicroPython learns a new trick – ISP for AVRs

  1. Awesome, someone else has done this. I have been working on an OTA programmer on the ESP since November as there is no trace of a true stand alone ESP AVR programmer anywhere, which sucks. Its not as feature rich in code but is able to download over the internet and program its target AVR. The room on the ESP’s ram restricts you from buffering an entire hex file. https://youtu.be/GowAiRquWdc

  2. I guess this is cool… certainly as a stand-alone field programmer… but I can’t really see how being in the field with an Arduino, a proto-board, and a power supply is more convenient than just bringing a laptop and a USB programmer or adaptor.

    “One of the reasons why the Arduino became so popular was the ability to program it with ease. It meant the end of big parallel programmers that would cost an arm and a leg.”

    Arduino made a lot of things easy at once, certainly that includes programming. But even in the darkest pre-Arduino, pre-USB days it was cheap to hand-roll a basic parallel-port-based programmer (at least for PICs and some others). And I believe the PICkit 2 could function as a stand-alone field ISP programmer.

    Nowadays a USB AVR programmer is $7, a USB-serial adaptor is $3… programming adaptors aren’t really a barrier to entry.

  3. This is a very cool project but I question the practicality. It seems if you are already using a pretty powerful ESP8266 or the newer ESP32 you could completely replace the Arduino board and still have all the functionality and remote ISP capability…

  4. The AVR programming protocol is open. So there’s nothing special about this other than some ESPxxx example code (which is Good IMO). But any wireless programming of an AVR part with a device in the middle is not too complicated (be it power hungry WiFi or power efficient on-demand infrared), especially if you limit yourself to ISP. HVSP programming is also doable, but on the AVR target you need to get creative; something like a GPIO toggled charge-pump supply that you can turn on/off for the higher voltage. Don’t think that programming fuses via wireless via HVSP is a strange idea. For very power sensitive sensor applications you get a wireless way to control/change the clock source from faster (for development) back to slower (for data gathering).

    1. Clarification: I said: “HVSP programming is also doable, but on the AVR target you need to get creative; something like a GPIO toggled charge-pump supply that you can turn on/off for the higher voltage.”

      An AVR on-board backup supply would be required IMO. Chicken and Egg problem?

  5. Darn, I was thinking this was going to be about Circuitpython / Micropython ported to an AVR..

    Is it even possible to build micropython on a non-gcc compiler? I’d love to see it on either on an 8-bit PIC / AVR (some of which have 128K flash / 16K Ram!) or in an fpga running a soft-cpu (z80, LatticeLM32, PicoRV32, nios) where you can customize the ram/flash and peripherals.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s