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

Difference between revisions of "Setting up Software for B1"

From ChipWhisperer Wiki
Jump to: navigation, search
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
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.
 
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.
  
<h2> Programming the Example </h2>
+
<h4> Programming the Example </h4>
  
 
Note with the CW1173 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.
 
Note with the CW1173 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.
  
<h2> Communicating from CW-Capture Software </h2>
+
<h4> Communicating from CW-Capture Software </h4>
  
 
Next, open the CW-Capture software. Then perform the following steps:
 
Next, open the CW-Capture software. Then perform the following steps:
  
[[File:cwsetup_scriptselection.png]]
+
[[File:cwsetup_scriptselection.png|889x889px]]
  
 
# Switch to the ''Python Console'' tab.
 
# Switch to the ''Python Console'' tab.
Line 19: Line 19:
 
The window should change to indicate the connect succeeded:
 
The window should change to indicate the connect succeeded:
  
[[File:cwsetup_scriptselection_cwliterun.png]]
+
[[File:cwsetup_scriptselection_cwliterun.png|889x889px]]
  
 
<ol start="4" style="list-style-type: decimal;">
 
<ol start="4" style="list-style-type: decimal;">
Line 33: Line 33:
 
[[File:cwsetup_scriptselection_xmegaconfig_cwliterun.png]]
 
[[File:cwsetup_scriptselection_xmegaconfig_cwliterun.png]]
  
You'll nice the contents of the script contain the following setup:
+
You'll notice the contents of the script contain the following setup:<syntaxhighlight lang="python" line="1">
 +
scope.gain.gain = 45
 +
scope.adc.samples = 3000
 +
scope.adc.offset = 1250
 +
scope.adc.basic_mode = "rising_edge"
 +
scope.clock.clkgen_freq = 7370000
 +
scope.clock.adc_src = "clkgen_x4"
 +
scope.trigger.triggers = "tio4"
 +
scope.io.tio1 = "serial_rx"
 +
scope.io.tio2 = "serial_tx"
 +
scope.io.hs2 = "clkgen"
 +
</syntaxhighlight>This configuration block does the following (for lines 1 through 10):
  
TODO SCRIPT
+
Line 1: Sets the input ADC gain
 +
 
 +
Line 2: Sets the number of samples to record as 3000 samples long (this is normally used for the AES algorithm).
 +
 
 +
Line 3: Sets an offset of 1250 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 XMEGA target expects.
 +
 
 +
Line 9: Configures GPIO2 as the TX (Output). This is what the XMEGA target expects.
 +
 
 +
Line 10: Sets the "High-Speed 2" (HS2) pin as having the 7.37MHz clock output.
  
 
<ol start="14" style="list-style-type: decimal;">
 
<ol start="14" style="list-style-type: decimal;">
Line 42: Line 71:
 
<li><p>Hit the ''Check Signature'' button and confirm the device is detected. If not you may have issues with the clock setup.</p>
 
<li><p>Hit the ''Check Signature'' button and confirm the device is detected. If not you may have issues with the clock setup.</p>
 
<p>[[File:cw1173_xmegaprogb.png|image]]</p></li>
 
<p>[[File:cw1173_xmegaprogb.png|image]]</p></li>
<li><p>Using the ''Find'' button, navigate to the <code>simpleserial-base.hex</code> which you built earlier with the <code>make</code> command. You can then press the ''Erase/Program/Verify'' button, and confirm the file is programmed into the XMEGA device:</p>
+
<li><p>Using the ''Find'' button, navigate to the <code>simpleserial-base-cw303.hex</code> which you built earlier with the <code>make</code> command. You can then press the ''Erase/Program/Verify'' button, and confirm the file is programmed into the XMEGA device:</p>
 
<p>[[File:cw1173_xmegaprogc.png|image]]</p>
 
<p>[[File:cw1173_xmegaprogc.png|image]]</p>
 
<p>Note the programmer dialog not only shows the successful programming status, but also shows when the <code>.hex</code> file 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!</p>
 
<p>Note the programmer dialog not only shows the successful programming status, but also shows when the <code>.hex</code> file 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!</p>

Latest revision as of 06:25, 1 May 2018

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 CW1173 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:

Cwsetup scriptselection.png

  1. Switch to the Python Console tab.
  2. The script selection window (2) lists available example scripts. Scroll down to "connect_cwlite_simpleserial.py" and click on it.
  3. 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:

Cwsetup scriptselection cwliterun.png

  1. The console lists the exact script that is executed. Note you could have manually executed the script commands line-by-line in this console.
  2. The "Scope" and "Target" buttons will show as connected.
  3. 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_xmega_aes.py" file:

Cwsetup scriptselection xmegaconfig cwliterun.png

You'll notice the contents of the script contain the following setup:
 1 scope.gain.gain = 45
 2 scope.adc.samples = 3000
 3 scope.adc.offset = 1250
 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"
This configuration block does the following (for lines 1 through 10):

Line 1: Sets the input ADC gain

Line 2: Sets the number of samples to record as 3000 samples long (this is normally used for the AES algorithm).

Line 3: Sets an offset of 1250 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 XMEGA target expects.

Line 9: Configures GPIO2 as the TX (Output). This is what the XMEGA target expects.

Line 10: Sets the "High-Speed 2" (HS2) pin as having the 7.37MHz clock output.

  1. You can now program the XMEGA device! To do so, open the XMEGA Programmer from the Tools menu:

    image

  2. Hit the Check Signature button and confirm the device is detected. If not you may have issues with the clock setup.

    image

  3. Using the Find button, navigate to the simpleserial-base-cw303.hex which you built earlier with the make command. You can then press the Erase/Program/Verify button, and confirm the file is programmed into the XMEGA device:

    image

    Note the programmer dialog not only shows the successful programming status, but also shows when the .hex file 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!

    Finally we can check communications with the programmed file:

image

  1. Close the XMEGA programmer dialog.
  2. Open the status monitor under Tools > Encryption Status Monitor.
  3. Resize the monitor window. The monitor will show sent & received data to the target.
  4. Hit the Run 1 button (image). You may have to hit it a few times, as the very first serial data is often lost. You should see data populate in the Text Out field of the monitor window. Note that each byte of the Text In is incremented in the Text Out field.