Skip to content

How to program with AVRISP mkII

Secure Chicken edited this page Feb 23, 2020 · 4 revisions

The AVRISPmkII can be used to flash the ChameleonMini RevE Rebooted without going through bootloader embedded flash code. This is useful if you bricked your ChameleonMini, or if you want to unlock the ChameleonMini RevE with a custom compiled bootloader (bootloader code provided in this repo).

Setup

Beyond the AVRISPmkII, you will need:

  • either an adaptor (sold on the Rfxsecure for instance) to connect AVRISPmkII to ChameleonMini or a custom wiring (see below);
  • Atmel Studio. Alternatively, you can use avrdude command-line utility .

AVRISP mkII - ChameleonMini RevE custom wiring PIN layout

Here is the overall pin you need to connect together. The pins are written in little characters on the back of the ChameleonMini.

AVR Chameleon
VCC VCC
GND GND
MISO DAT
RST(SCK) CLK

Here is an example of wiring without a special adapter. Disregard the LED, which is here for convenience.

wiring

Programming with Atmel Studio 7

Open Atmel 7, and to Tools->Device Programming

You should have the following:

AtmelStudio

You can then choose .hex program files to upload to ChameleonMini memory.

Programming with avrdude

You can upload a full flash image (e.g. "Full.hex") like this: avrdude -p x32a4u -P usb -c avrispmkII -U flash:w:Full.hex

Beware the fuses!

The fuses should be set in a particular way due to the fact the ChameleonMini RevE Rebooted version lacks the power switch present in the original ChameleonMini.

Using these correct fuse settings, battery power is automatically detected while. Otherwise the device wouldn't start due to too low voltage (< 2.2V) or flash memory read and write operations wouldn't be stable, leading to memory corruptions.

Atmel Studio correct fuses settings

Avrdude correct fuse settings

avrdude -p x32a4u -P usb -c avrispmkII -U fuse1:w:0x00:m -U fuse2:w:0xBE:m -U fuse4:w:0xFE:m -U fuse5:w:0xEC:m

Troubleshooting the brick

This is when your ChameleonMini RevE Rebooted does not respond, light, and/or appear in OS devices lists, even after the steps described in "no more lights".

Most of the time, this is due to a memory overlap issue, where original Windows tools will have overwritten firmware application/bootloader on flash memory, without successfully writing all of your firmware image, resulting in a corrupted firmware/bootloader.

The brick issue will appear with this output from original BOOT_LOADER_EXE or flash.bat Windows tools:

Flashing the files onto the "ChameleonMini Rev-E Rebooted"...
old_driver_bootloader
Erasing flash...  Success
Checking memory from 0x0 to 0x6FFF...  Empty.
0%                            100%  Programming 0x40 bytes...
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]  Success
0%                            100%  Reading 0x400 bytes...
Bootloader and code overlap.
Use --suppress-bootloader-mem to ignore

Using AVRISPmkII:

  • flash this repo-provided ChameleonMiniRDV2.0_ATxmega32A4U.hex (in Firmware/Original-Compiled folder) and your Chameleon will then work again in bootloader mode;
  • follow the steps in the "no more lights" troubleshot to get a (factory reset) working ChameleonMini RevE Rebooted.