Sunday, 27 November 2016

Quark One Bootloader

In 2015 I decided to try out the ESP8266 line of WiFi modules. I did a lot of reading and I determined that I didn't like they normal way people used them. I decided that the ESP modules needed an additional microcontroller to be truly useful in terms on analog to digital conversion and other IO features.

The Quark One was born. I will write about the hardware details in another post. Suffice to say, I wanted to try out the Atmel Xmega microcontroller due to it's relatively low cost and great feature set. I also wanted everything to work with the Arduino IDE!

Typically, when people connect an ESP module to a microcontroller, they flash it separately and then integrate everything. I didn't like this way of doing things and so I hacked together and then polished a new bootloader for the Xmega which presents two separate USB devices to the computer it is connected to: the first device is the CDC Xmega bootloader, as one would expect. The second device is a CDC that passes through the chip to the ESP module! You probably guessed it by now, but I used the USB device built into the micro and then one of the hardware serial ports to interface to an ESP-01 module.

The Quark One bootloader deals with the reset signals to enable the ESP to be programmed from the Arduino IDE as if it was simply connected to a USB to Serial converter! To write code and flash the ESP, you do so in the usual way. To write code for the Xmega, I had to extend the xmega-arduino library to include the Quark One pin mapping. Otherwise, this is also standard!

To activate the bootloader I took some inspiration from the Arduino Lilypad type devices. A quick "double click" of the reset button on the edge of the Quark One puts it into bootloader mode.

Check out the source code on GitHub:

The bootloader should work on any Xmega chip that has quite a bit of bootloader flash... I used the Xmega128A4U.

Let me know what you think!

No comments:

Post a Comment

Home Assistant + Node-RED with BTRFS on Arch

After using Home Assistant for a few months and having set it up to use external MySQL databases, etc. I have decided to re-install in a rob...