As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.

V4:CW1173 ChipWhisperer-Lite/AVR Programmer

From ChipWhisperer Wiki
Jump to: navigation, search

The CW1173 and CW1200 have built-in support for programming either Atmel AVR or Atmel XMEGA device. This is designed to allow you to program our target boards (including the built-in XMEGA target).

Note this programmer is fairly simple, and does not provide all the features of a stand-alone programmer.

The AVR device programmer requires four connections to the target: RESET, MOSI, MISO, SCK. See #20-Pin_Connector for details of AVR programming pin connections.

Accessing the Programming

To access the AVR Programmer, select the "CW-Lite AVR Programmer" from the pull-down Tools menu:

image

Which should give you the AVR Programmer Window.

Clock Source Selection

Note to use the AVR programmer you may require a valid clock source for the AVR. It is suggested to select one of the setup scripts (such as ChipWhisperer-Lite: AES Simple-Serial on ATMega328P) which will generate a 7.37 MHz clock.

Check if the device is found by pressing the "Check Signature" button. The status window will show the detected device based on the signature.

image

If this fails, double-check connections, and ensure the clock source to the AVR is suitable. Note some errors will appear as part of the main window log:

image

The default SPI data rate for the programmer is too fast for devices which are running slower than 2 MHz. If programming a device with a clock source slower than 2 MHz, you will need to enable the "Slow Clock Mode". In "Slow Clock Mode" the entire SAM3U and FPGA clock is changed from 96 MHz to 12 MHz. Note the default fuse bytes for a virgin ATMega328P result in a 1 MHz clock, so you will need to use "slow clock mode" to program the correct fuse bytes, after which point you will not need to use "slow clock mode".

note

The 'slow clock mode' is used to provide a slower SPI clock than would otherwise be possible. When switching into 'slow clock mode' it will cause all DCM blocks in the FPGA to become unlocked. You will need to reset the DCM blocks, or simply restart the CW-Capture software and run the setup script.

Programming the Fuses

By default the AVR programmer allows you to modify the LOW fuse byte only, as this byte controls the clock source selection. To change the value of the fuse byte:

  1. Press the "Read Fuses" button, and the values should be populated
  2. Specify the new low fuse value
  3. Hit "Write Fuses"

See an Online Fuse Calculator to better understand what the values mean.

tip
If programming a virgin ATMega328P device, the default low-fuse value of 62 results in the internal 8 MHz oscillator being divided down to 1 MHz. Any external clock is ignored.

The low fuse byte must be changed to D0 to use the external clock provided by the ChipWhisperer toolchain.

Programming the Flash

Programming the flash is accomplished by selecting the new .hex file in the "Find" menu, and pressing the "Erase/Program/Verify FLASH" button. The "Status" line will show the following information:

  • File programmed into device
  • Time file was last modified (very useful to confirm you are using changed file when doing development)
  • Status of verification, and number of bytes programmed/verified

image