|As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.|
It is assumed that you've already followed the guide in Installing_ChipWhisperer. Thus it is assumed you are able to communicate with the ChipWhisperer CW1173 hardware (or whatever capture hardware you are using). Note in particular you must have configured the FPGA bitstream in the ChipWhisperer-Capture software, all part of the description in the Installing_ChipWhisperer guide.
Assuming this setup is complete, you can confirm you are able to communicate with the hardware by running the example capture of traces given in the CW1173_ChipWhisperer-Lite quick-start.
Programming the Example
Note with the CW303 Arm target, you need to configure a clock before programming of the device will succeed. Programming of the target device will be done as part of the CW-Capture software setup, discussed next.
Communicating from CW-Capture Software
Next, open the CW-Capture software. Then perform the following steps:
- Switch to the Python Console tab.
- The script selection window (2) lists available example scripts. Scroll down to "connect_cwlite_simpleserial.py" and click on it.
- You will see the script contents appear in the "Script Preview" window (3). You can either hit the "Run" button or double-click the filename of the script to execute it. Do either of those now.
The window should change to indicate the connect succeeded:
- The console lists the exact script that is executed. Note you could have manually executed the script commands line-by-line in this console.
- The "Scope" and "Target" buttons will show as connected.
- The Status Bar will show a connection.
Note in previous software versions, this tutorial took you through manual setup. This can still be done (using the GUI), but instead now the API has been made more powerful, so the example configuration script will be used instead.
To do so, simply scroll down and select the "setup_cwlite_stm32f_aes.py" file:
1 scope.gain.gain = 45 2 scope.adc.samples = 5000 3 scope.adc.offset = 0 4 scope.adc.basic_mode = "rising_edge" 5 scope.clock.clkgen_freq = 7370000 6 scope.clock.adc_src = "clkgen_x4" 7 scope.trigger.triggers = "tio4" 8 scope.io.tio1 = "serial_rx" 9 scope.io.tio2 = "serial_tx" 10 scope.io.hs2 = "clkgen" 11 12 target.baud=38400
Line 1: Sets the input ADC gain
Line 2: Sets the number of samples to record as 5000 samples long (this is normally used for the AES algorithm).
Line 3: Sets an offset of 0 samples from the trigger to when we start recording samples.
Line 4: Sets the trigger as being a "rising edge" trigger.
Line 5: Sets the internal clock generator to 7.37MHz
Line 6: Sets the ADC as running at 4x that clock (so 29.48MHz)
Line 7: Sets the trigger pin as GPIO4 (we previously set the trigger condition as rising edge, so this pin will be the one a rising edge is expected on).
Line 8: Configures GPIO1 as the RX (Input). This is what the ARM target expects.
Line 9: Configures GPIO2 as the TX (Output). This is what the ARM target expects.
Line 10: Sets the "High-Speed 2" (HS2) pin as having the 7.37MHz clock output.Line 12: Sets the serial communication speed with the target at 38400 baud.
You can now program the ARM device! To do so, open the STM32F Programmer from the Tools menu:
Hit the Check Signature button and confirm the device is detected. If not you may have issues with the clock setup.
Using the Find button, navigate to the
simpleserial-base-CWLITEARM.hex(or whatever your binary is called), which you built earlier with the
makecommand. You can then press the Erase/Program/Verify button, and confirm the file is programmed into the XMEGA device:
If the software freezes and the verification fails after a long period of time, set the Read Block Size to 64 instead of 256.
Note the programmer dialog not only shows the successful programming status, but also shows when the
.hexfile was last modified. Always confirm this matches with when you last remember compiling the program -- if it is widely different this suggests you have selected the wrong file!
If you'd like, you can close the STM32F programmer dialog. If you frequently reprogram the target, you may want to leave it open.