Skip to content

RAVA Firmware ‐ Installation

Gabriel Guerrer edited this page Jan 20, 2024 · 3 revisions

Compiling

The RAVA's firmware is developed and compiled using Visual Studio Code (VSCode) in conjunction with the PlatformIO plugin.

Instructions to install VS Code in different OS.

Instructions to install PlatformIO

  • In Linux, python3-venv is required. Install it with sudo apt install python3-venv

To compile the RAVA's firmware

  • Download the intended version from this repository
  • Launch VS Code and navigate to File -> Open Folder. Select the directory containing the platformio.ini file
  • If opening the project for the first time, PlatformIO will download the required dependencies
  • Click on the PlatformIO icon in the left-hand toolbar of VS Code and choose the "Build" option

Upon successful completion, the compilation generates a firmware.hex file, found within the .pio/build/micro/ directory situated within the RAVA's version folder.

As an alternative to compiling the firmware source code, users can directly download the pre-compiled firmware.hex file from this repository.

Uploading

The RAVA's bootloader code must be initiated to enable a firmware update via the USB port. The bootloader is evoked upon a MCU's hardware reset, which involves delivering a 0V pulse to the RST port. A simple method to achieve this is by utilizing a metallic tool to establish a momentary connection between the GND and RST pins on a powered device. If successful, the bootloader initialization results in the operational system detecting a new device named "ATm32U4DFU".

Instructions for uploading the firmware binary on various OS are detailed below. They all assume a RAVA device connected to the USB port running the bootloader code.

Linux and macOs

To upload the firmware, we rely on AVRDUDE, an open-source software designed to manipulate on-chip memories.

  • On a Debian based Linux OS, AVRDUDE can be installed with sudo apt install avrdude
    Depending on your distribution, you may need to grant permission to utilize the USB port. For instance, in Ubuntu, this can be accomplished by including your user in the dialout group with sudo usermod -a -G dialout $USER
  • On a macOs, start by installing the package management system Homebrew, which also installs the Xcode command line tools (xcode-select). Then, get AVRDUDE with brew install avrdude

The AVRDUDE command to upload the firmware to a RAVA device connected to the USB port is
avrdude -v -u -c flip1 -p m32u4 -P usb -U flash:w:/path_to_the/firmware.hex

Once AVRDUDE is installed, it is also possible to upload the firmware using VS Code in conjunction with the PlatformIO plugin. To achieve this, open the firmware's folder in VS Code, click on the PlatformIO icon, and choose the "Upload" option.

Windows

Despite multiple attempts, I haven't managed using AVRDUDE with flip1 programmer to upload the RAVA's firmware on Windows. If you know how to, please let me know.

An alternative approach is to use Microchip's Flip software and its Java GUI interface. Download FLIP (with JRE included if you don't have the Java runtime yet) and install it. Next, update the Atm32U4DFU driver by

  • Opening the Device Manager and locating the Atm32U4DFU device under the "Other Devices" category
  • Right-click on the Atm32U4DFU device and choose "Update". In the subsequent window, opt for "Browse my computer"
  • Select the folder C:\Program Files (x86)\Atmel\Flip 3.4.7\usb and click "Next"

Within the FLIP program, proceed as follows

  • Click on Device -> Select and choose "ATMega32u4"
  • Navigate to Settings -> Communication -> USB. In the new window, click on the "Open" button.
    A message "AtLibUsbDfu.dll not found" indicates that the Atm32U4DFU driver wasn't properly installed
  • Click on File -> Load HEX File and choose the firmware.hex file to be uploaded
  • Click the "Run" button inside the "Operations Flow" frame
  • A successful upload is indicated by the appearance of green circles next to the Erase, Blank Check, Program, and Verify labels.
Clone this wiki locally