2017 VNA Testing Software Setup

From Class Wiki
Revision as of 16:46, 5 June 2017 by Frohro (talk | contribs) (→‎Possible Problems)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page describes how to set up an environment for testing the 2017 VNA Electronics II class project.

Fresh Start from Windows, OS X, or Linux

Code Composer Studio

Download Code Composer Studio version 7.1 (CCSv7) or later. Install that and make sure you check the box for Simplelink MSP432 when given the opportunity. Version 6.2 doesn't work with Energia version 18, which is what the software uses. Install CCSv7. Then download and install Energia. Then open the energia application, and go to the Tools-Board->Boards Manager menu. Download the code for the red MSP432 Launchpad. In CCSv7 use the menu Projects->New Energia Sketch to make a new Energia project. You will have to tell it where you installed the energia program. You can then add the files: from github to your project. They are: vna_2017.ino, MultiTaskSerial.ino, adc14vna.c, adc14vna.h, DynamicCommandParser.c, DynamicCommandParser.h, si5351.cpp, si5351.h, quadrature.cpp and quadrature.h by right clicking on the project, and selecting the Add Files pop up menu. You also need to go the Build Settings->General and select the Products Tab. In this tab select SimpleLink MSP432 SDK. You will also likely have to go to the Directories, and add the directories that contain the driverlib header files. Mine looks like this: Ccsv7 directories.png You should now be able to compile and flash the program. You may be able to just take the whole zip of my project from github and just import into CCSv7, which might be easier, but you learn less about using CCSv7.

Code Composer Studio Cloud

This is the quick and easy route toward being able to work with the 2017 VNA software It should work in Windows, Linux and OS X (unfortunately not ChromeOS). Go to CCS Cloud, and click on the menu tab that says CCS Cloud. In a minute CCS Cloud will open in a new tab. In another tab go to the github repository, download the zip, and unzip it. Then in the CCS Cloud, use File->Import CCS Project to import the 2017 VNA project. It should download the files from your computer to the cloud and when it is done, it should build.

Alternatively, you can go to the CCS Cloud Git->Clone a Repo and enter:

https://github.com/frohro/2017-VNA.git

into the popup window for the address. Then CCS Cloud will import it into your workspace, and you can then right click on the 2017 VNA folder, and select Import CCS Project, and it will import it into CCS Cloud as a project. Then you should be able to select the hammer and build it.

Possible Problems

  • There are some settings in Chrome and Firefox that make it so the menus when clicked on in CCS Cloud do not drop down. I haven't figured out how to make them work, short of downloading another browser and starting fresh with it. It worked fine with Opera, when it wouldn't work in my usual chrome. It worked in chrome on another account as well, so it is something to do with my settings in chrome, and in firefox.

Gnu Octave

Download Gnu Octave. Then fire up octave, and in the octave command window execute:

>> pkg install -forge instrument-control

This will download and install the instrument-control package which contains the serial port software. Here is a program that will use the "TIME" command to get a 128 point sample of what the analog to digital converters are measuring at a frequency, fMin.

% VNA 2017 test script.
% This script tests the TIME command, which is meant to get the analyzer
% to make a measurement at one frequency, and instead of downsampling to DC,
% it just sends the data back in the variable, "voltage".
% Rob Frohne, May 2017.

clc; clear;

fMin = 1e6;

% Load the package
pkg load instrument-control
% Check if serial support exists
if (exist("serial") != 3)
  disp("No Serial Support");
endif
% Instantiate the Serial Port
% Naturally, set the COM port # to match your device
% Use this crazy notation for any COM port number: 1 - 255
%s1 = serial("/dev/pts/2");
s1 = serial("/tmp/ttyDUMMY"); % $ interceptty /dev/ttyACM0 /tmp/ttyDUMMY
pause(1); % Wait a second as it takes some ports a while to wake up
% Set the port parameters
set(s1,'baudrate', 115200);
set(s1,'bytesize', 8);
set(s1,'parity', 'n');
set(s1,'stopbits', 1);
set(s1,'timeout', 255); % 12.3 Seconds as an example here
% Optional commands, these can be 'on' or 'off'
%set(s1, 'requesttosend', 'on');
 % Sets the RTS line
%set(s1, 'dataterminalready', 'on'); % Sets the DTR line
% Optional - Flush input and output buffers
srl_flush(s1);
string_to_send = strcat("Testing! ^TIME,",num2str(uint64(fMin)),"$\n")
srl_write(s1,string_to_send);
for i=1:128
  voltage(i,:) = str2num(ReadToTermination(s1, 10));
  %String = ReadToTermination(s1,10)
endfor
voltage
% Finally, Close the port
fclose(s1);

Note: you need to modify this for your COM or serial port identifier.

Serial Port Monitor

On Linux, I use interceptty. This program connects between the host program (octave in this case) and the MSP432. It allows you to monitor all the traffic each way between the two. You invoke it with:

$ interceptty /dev/ttyACM0 /tmp/ttyDUMMY

On OS X, I found this serial port tool that looks like it should work in a similar way. On Windows, Google pointed to to Free Serial Analyzer. I don't know how well these work, but I'm sure you will find others if they don't work well.

CuteCom

Cutecom is a handy terminal program that connects to serial ports on a Linux box. I installed it with:

$ sudo apt-get install cutecom

Software Development

You will doubtless want to write some testing code of your own. The software uses two libraries that should help make that easier. The first is for the Si5351, and the second is for parsing commands from Octave (or your terminal if you prefer). The .ino files provide examples you can follow, and I can also answer your questions.

From a Lab Linux Machine

Until the Linux Lab machines have upgraded versions of Linux, I suspect the method below will work. So this is just there in case Greg can update glibc. In which case, I will delete this comment. This assumes you have read the above notes on a fresh install, and highlights the differences between that and installing on the Linux Lab machines.

  1. Install CCSv7 locally on your account. There will be updates. Install them with the menu Help->Check for Updates. You can start it using the desktop icon it makes. This insures you are running the correct version.
  2. Install Energia locally, by uncompressing it where you wish it to reside. Use it to install the MSP432 red Launchpad using the board manager, and described above.
  3. Octave is already installed, so start octave and from it do pkg install -forge instrument-control and it will be installed in your local directory.
  4. CuteCom is already installed on the Linux Lab machines.
  5. Clone interceptty from its github repository, and build it from source by using:
$ git clone https://github.com/nochkin/interceptty.git interceptty
$ cd interceptty
$ ./configure
$ make -j4
$ cp interceptty ~/bin
 

Invoke it with:

$ interceptty /dev/ttyACM0 /tmp/ttyDUMMY 

I am assuming that you all have a local bin directory. If the last line has problems, because you don't have one, just run interceptty from the interceptty directory where you built it. Invoke it with:

$ ./interceptty /dev/ttyACM0 /tmp/ttyDUMMY

The ./ means execute the file in this directory.