2017 VNA Testing Software Setup

From Class Wiki
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. 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.

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;
fMax = 1e6;
nFreq = 1;

Sum = zeros(nFreq,2);
% 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.

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

Note: I haven't tested this yet, but this is what I intend to try:

  1. Install CCSv7 locally on my account. It worked on my Ubuntu Linux box to have both version 6 and 7 installed simultaneously.
  2. Octave is already installed, so I should be able to do the pkg install -forge instrument-control and it should be installed in my local directory.
  3. Get interceptty from its github repository, and build it from source following the README file, probably using ./configure, make, and make install. The install may not work because normally it is installed for all users and you need root access for that, but there is usually a way to get it to install in a local directory if you google, or you can simply skip that step and just put the executable, interceptty, in the directory you intend to run it from, and involk it with:
$ ./interceptty /dev/ttyACM0 /tmp/ttyDUMMY

The ./ means execute the file in this directory.