Skip to content

Flashing Linux (Unix)

Maxie D. Schmidt edited this page May 22, 2018 · 17 revisions

How to flash a new firmware on the Chameleon on a linux-based OS? (Some Starting Points)

Configure UDEV to handle the USB devices:

Following from this #64 post on the RevG board issues forum, we need to configure the UDEV rules which most modern Linux boxes are going to be using to plug-and-play with these devices. Add the following lines to /etc/udev/rules.d/98-ChameleonMini.rules (or create the file if it does not already exist on your system):

# Rule for ChameleonMini RFID Research tool (RevG)
ATTRS{product}=="Chameleon-Mini", SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="04b2", GROUP="users", MODE="0666", SYMLINK+="chameleonG", ENV{ID_MM_DEVICE_IGNORE}="1"

# Rule for ChameleonMini RFID Research tool (RevE)
ATTRS{product}=="Chameleon-Mini", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2044", GROUP="users", MODE="0666", SYMLINK+="chameleonE", ENV{ID_MM_DEVICE_IGNORE}="1"

# DFU mode (i.e., flashing the devices)
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2fde", GROUP="users", MODE="0666"

Next, restart the UDEV service to make sure that these rules are getting parsed:

$ sudo service udev restart

Once you have this setup, plugging in the device over USB should create the DEV handler /dev/chameleonE. NOTE: I actually had trouble getting the RevE device recognized this way. To see what the device defaults are run

$ dmesg | tail | grep -i dev

to print the device name the RevE board is attached to. On my system this was something like `/dev/ttyACM0'. Now you can continue on as in RevG post #64 to configure a serial terminal to communicate with the Chameleon board, or continue on with the flashing procedure below.

Compiling dfu-programmer from source:

As numerous online forum posts indicate, if you have trouble flashing the Chameleon devices from within Linux, one thing to rule out is dependencies of the dfu-programmer utililty we will be using to do the chip programming. It's not too difficult to get this programmer compiled from its sources, so we will do just that below. Other under-documented (or at least under-acclaimed) utilities that might be useful to you include the following: dfu-tool and dfu-util (both can be installed by stock apt-get install commands on Debian variants).

To compile dfu-programmer from source execute the following commands in your home directory:

$ git clone https://github.com/dfu-programmer/dfu-programmer.git
$ ./bootstrap.sh
$ ./configure
$ make all
$ alias dfup="src/dfu-programmer" 

Flashing the device

Follow the instructions on this page to generate your binary Chameleon-Mini.eep and Chameleon-Mini.hex files which we will be flashing to the Chameleon device. Next, put the device in bootloader mode as described here: keep the black button pressed from off to plugging in the board over USB to your Linux box configured as above.

At this point you should have a working DFU device that can be recognized by the Linux box. Verify that this is the case by running:

$ lsusb            # locate your Chameleon device
$ dfu-tool -v list # verify it's recognized as a DFU-programmable device

Once the device is appropriately recognized by the software tools, we can proceed to flash the chip. In the RevG case, run the following commands (see here for reference):

$ sudo dfup atxmega128a4u get bootloader-version
$ sudo dfup atxmega128a4u flash --eeprom Chameleon-Mini.eep
$ sudo dfup atxmega128a4u flash Chameleon-Mini.hex
$ sudo dfup atxmega128a4u atxmega128a4u flash Chameleon-Mini.hex
$ sudo dfup atxmega128a4u launch

In the RevE case (slightly different chipset on the board), execute the following (TODO: untested):

$ sudo dfup atxmega32a4u get bootloader-version
$ sudo dfup atxmega32a4u flash --eeprom Chameleon-Mini.eep
$ sudo dfup atxmega32a4u flash Chameleon-Mini.hex
$ sudo dfup atxmega32a4u atxmega128a4u flash Chameleon-Mini.hex
$ sudo dfup atxmega32a4u reset

The terminal output should indicate whether the flashing operation was a success or not. If so, congratulations on your new Chameleon firmware!