Changes

Tutorial B2 Viewing Instruction Power Differences

339 bytes added, 15:33, 28 September 2018
Modifying the Target
== Setting Up the Example ==
 <p>Like with the previous tutorial, you'll need to have a copy of the firmware you want to modify and be able to build for your platform. The instructions are repeated in the drop down menus below, but if you're comfortable with the previous example, feel free to skip them. Alternatively, if you're not too attached to your code, you can just modify your firmware from [[Tutorial B1 Building a SimpleSerial Project]].</p>
{{CollapsibleSection
|intro = === Building for CWLite with XMEGA Target ===
********************************/</source></li>
<li><p>Change the terminal to the directory with your source, and run the same <code>make</code> command you did earlier to build the system. Remember you can press the up arrow on the keyboard to get recently typed commands in most OSes:</p>
<li>Following the instructions given in [[Tutorial_B1_Building_a_SimpleSerial_Project]], program the AVR, XMEGA, or STM32 (ARM) target with your new code. Note you __do not__ need to close the programming window. If you will be doing frequent modifications to the source code, this can simplify your life since you only need to hit the '''Program''' button in AVRStudio to download new code.</li>
<li>Ensure the hardware is setup as in [[Tutorial_B1_Building_a_SimpleSerial_Project]]. If using the CW1002, ensure the SMA cable is also connected as described in the previous tutorial.</li></ol>
<li>Under the ''Python Console'' tab, find the ''connect_cwlite_simpleserial.py'' script and double-click.</li>
<li>Check there are no errors on the connection.</li>
<li>Under the ''Python Console'' tab, find the ''relevant setup script for your target (such as setup_cwlite_xmega.py'' script ) and double-click.</li>
<li>Both the Target &amp; Scope should switch to ''CON'' and be green circles.</li>
<li>Open the status monitor (<i>Tools > Encryption Status Monitor</i>).</li>
<ol start="8" style="list-style-type: decimal;">
<li>The ''ADC Freq'' should show 4x the clock speed of your device (typically 29.5 MHz (which is 4x 7.37 MHz5MHz), and the ''DCM Locked'' checkbox __MUST__ be checked. If the ''DCM Locked'' checkbox is NOT checked, try hitting the ''Reset ADC DCM'' button again.</li>
<li><p>At this point you can hit the ''Capture 1'' button, and see if the system works! You should end up with a window looking like this:</p>
<p>[[File:05_Low_Gain.PNG|image|1250px]]</p>
<ol start="16" style="list-style-type: decimal;">
<li>Under ''Gain Setting'' set the ''Mode'' to ''high''. Increase the ''Gain Setting'' to about 25. You'll be able to adjust this further during experimentations, experimentation; you may need to increase this depending on your hardware and target device.</li>
<li>Under ''Trigger Setup'' set the ''Total Samples'' to ''500''.</li>
<li>Try a few more ''Capture 1'' traces, and you should see a 'zoomed-in' waveform.</li></ol>
=== Background on Setup ===
This While this tutorial is using either an AtMega328p can be performed on any supported target, results will vary between targets. Arm targets, for example, have pipelining, which is an Atmel AVR devicecomplicates how long instructions take and when they happen. The sample concepts apply, or but the specifics will be different. The rest of this tutorial will focus on AtXMEGA128D4 which is an Atmel (the CW303 XMEGA devicetarget), since correlating instructions to power consumption is typically simpler on it. We are comparing the power consumption of two different instructions, the <code>MUL</code> (multiply) instruction and the <code>NOP</code> (no operation) instruction. Some information on these two instructions:
; mul
Approved_users, administrator
366
edits