The BlueberryE Uno335 Firmware & Bootloaders
This post is about compiling firmware and bootloaders for the Uno335 a specialized variant of the wellknown Arduino/Genuino Uno board. The most significant changes are an onboard 512kbit serial SRAM and levelshifters to 5V to 3.3V for SPI and I2C, but this is not what this post is about.
As BlueberryE is an independent company/project we cannot use the Arduino USB VendorID for the onboard ATmega16U2 chip that is used as a USB2UART translator. So we got our own USB VendorID forcing us to recompile bootloaders/firmware for the onboard ATmega16U2 and ATmega328.
On the Uno board the 16U2 translates the UART output of the ATmega328 (main mcu where the user code runs) to USB and vice versa (usbserial software). In addition there is the DFU (Device Firmware Update) software, that enables a firmware update on the 16U2.
To compile and combine the two pieces (using Windows) the following steps are required:
- Get the LUFA library. LUFA (Lightweight USB Framework for AVRs, formerly known as MyUSB) is an open-source complete USB stack for the USB-enabled Atmel AVR8 and (some of the) AVR32 microcontroller series, released under the permissive MIT License. For the purpose of compiling the usbserial and usbdfu we need exactly version LUFA100807.
- Go to the installation directory of the Arduino IDE. Here you should find the following subfolder hardware>arduino>avr>firmwares>atmegaxxu2 below this folder you see two further folders arduino-usbserial and arduino-usbdfu
- Copy the two directories arduino-usbserial and arduino-usbdfu into the bootloaders directory of your LUFA library.
- Now you need to install the right AVR-gcc toolchain AVR Toolchain 3.4.2-1573 (86.6 MB, avr-gcc 4.7.2, AVR-Libc 1.8.0, updated 2013/04).
- The makefiles used to compile the two programs need a shell (sh.exe) not present in the above download. A quick and easy fix is to install the latest version of WinAVR. But you need to make sure that in your PATH you have the Atmel toolchain before WinAVR, otherwise the system will use the wrong compiler etc.
- Now run make in each directory and you should be done!!!
- Last step is to combine the two .hex files and burn it onto the ATmega16U2 using the ISP header. You can combine the two hex files using srec_cat.exe (I used srecord-1.63). You need to specifiy for each hex file(inputs, output) -intel to get the right format.