Skip to content

Firmware compiling and installing instructions

Shadow Cipher edited this page Mar 5, 2024 · 7 revisions

Most of the core firmware functionality is contained within Software/firmware_main/VMETER.c. If you want to change the structure of the settings that are stored in eeprom (memory that survives power loss), you may also need to change files in Software/firmware_eeprom_writer. The eeprom writer is typically only needed to pre-load settings on a blank VMeter.

Pre-reqs (the versions of these are important):

Install the AVR Toolchain and add its bin directory to your system's path. On Windows 7, you do this by clicking start, right-clicking Computer, select properties, choose advanced system settings, and then add or prepend the Path System Variable with the bin directory. Check by opening a command prompt and typing avr-gcc -v.

Install LUFA so that it's parallel with the firmware directory:

  • Software/LUFA-110528/Bootloaders
  • Software/firmware_main

Open a command prompt and type make and that should be it!

To load the firmware on a VMeter, follow the instruction for firmware upgrading. This entails sending a special command to the VMeter so it resets in bootloader mode as a HID USB device.

If you're starting from a completely blank chip, you'll need to set the FUSE bytes (configuration bytes) on the Atmel chip and install the bootloader using something like Atmel's Dragon (can re-write the chip after it's already soldered) along with AVR Studio. The one tricky setting in AVR Studio is to make sure the bootloader is 2kB or 1024 words. The bootloader is the HID one inside LUFA. (This bootloader was one of the smallest ones we could find for this chip, using 2kB or 12.5% of the chip's total space).

Full AVR Studio Fuse settings:

To program the Atmel chip after it's already soldered, we rigged up a jig to connect to the exposed ISP pads:

Also note the pad D7 near the right edge which if connected to GND will reset the VMeter into its bootloader if a firmware upgrade is faulty. It's possible to do this even when the entire device is glued together, although we typically test new firmware on an unassembled version.

As an alternative to installing the bootloader and then using that to install the firmware, you can also just use the ELF file to load in the fuse settings, eeprom default settings and firmware in one operation within AVR studio. This is what we use in production to program the chips before soldering to the board (using the superpro 501s and TQFP32 adapter).

Returning again to the eeprom-writer, this program simply writes some values off to the eeprom and resets to the bootloader. We use this since the bootloader we're using doesn't write to the eeprom. Changing the eeprom-writer is somewhat involved, as the EEPROM .hex output from the main program is first converted from binary to hex using hex2bin, and then to a .h header file (using bin2h), and the .h file finally gets included in the eeprom-writer. An alternative approach would be to have the main firmware detect the underlying version and write default values to the eeprom if needed.

Clone this wiki locally