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 "MATLAB Control of CW-Lite"

From ChipWhisperer Wiki
Jump to: navigation, search
(Created page with "The following is designed to demonstrate how to control the CW-Lite directly from MATLAB. == About MATLAB to Python Interface == This system relies on the Mathworks Python i...")
 
(MATLAB Setup)
Line 25: Line 25:
  
 
== MATLAB Setup ==
 
== MATLAB Setup ==
 +
 +
MATLAB will need to be told about your Python location most likely. You can check this by seeing the value of the pyversion variable at the MATLAB command prompt:
 +
 +
  >> pyversion
 +
 +
        version: ''
 +
      executable: ''
 +
        library: ''
 +
            home: ''
 +
        isloaded: 0
 +
 +
This indicates it does not have a valid Python environment. Simply point to your Python binary:
 +
 +
  >> pyversion 'C:\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe'
 +
 +
Where you will need to adjust the path for your local version/install. You can confirm with pyversion this worked. You shouldn't need to do any more setup now, it should remember this Python environment.

Revision as of 17:37, 28 November 2016

The following is designed to demonstrate how to control the CW-Lite directly from MATLAB.

About MATLAB to Python Interface

This system relies on the Mathworks Python interface, which is built in as of R2014B. See MathWorks Reference Page for more details.

The code is currently held in a separate repository at [1]. You'll have to clone that repository (or use the download link inside of GITHub) to copy the files into your own local working directory.

Python/ChipWhisperer Setup

You will need to first install Python 2.7 + ChipWhisperer. Note you'll need match the type of Python to your MATLAB install (i.e., 64-bit Python if using 64-bit MATLAB). Specific steps follow:

  1. Download WinPython 2.7.10.3, most likely you will require the 64-bit version (most recent MATLAB installs will be 64-bit).
  2. Run the installer - it will actually just extract this somewhere, I suggest to use a location such as c:\WinPython-64bit-2.7.10.3 rather than the default which will just install in a subdirectory of whereever you downloaded the installer to.
  3. Run the 'WinPython Command Prompt' - this will be in the directory you installed WinPython to.
  4. Run pip install chipwhisperer in the WinPython prompt which should install ChipWhisperer.
  5. Plug in CW-Lite, when prompted for drivers you'll have to download the driver zip-file and extract that somewhere, then point the installer to this location.
  6. Once drivers are installed, you should be able to run the examples from the WinPython command prompt. To do run the command python to start Python interpreter, then run:
  >>> import chipwhisperer
  >>> chipwhisperer.capture_gui()
  1. This should open the capture GUI. From the 'Project' and 'Example Scripts' menu, select 'ChipWhisperer-Lite: AES SimpleSerial on XMEGA'.
  2. Hopefully you see some waveforms show up on the screen!

MATLAB Setup

MATLAB will need to be told about your Python location most likely. You can check this by seeing the value of the pyversion variable at the MATLAB command prompt:

 >> pyversion
        version: 
     executable: 
        library: 
           home: 
       isloaded: 0

This indicates it does not have a valid Python environment. Simply point to your Python binary:

 >> pyversion 'C:\WinPython-64bit-2.7.9.5\python-2.7.9.amd64\python.exe'

Where you will need to adjust the path for your local version/install. You can confirm with pyversion this worked. You shouldn't need to do any more setup now, it should remember this Python environment.