Suggestions / ideas on how to accomplish my project?

Applications, development tools, FPGA, C, WEB
mnordgard
Posts: 12
Joined: Mon Feb 13, 2017 10:18 am

Suggestions / ideas on how to accomplish my project?

Post by mnordgard » Mon Nov 27, 2017 2:48 pm

Hi all!
I am a little (okay, very) lost. I have been attempting to figure out how to do what I need to do with the RP but I always end up going on tangents thinking I am just about to figure something out but I never really end up with anything.

Basically, what I want to do is measure complex impedance in the range from 100Hz to 100kHz. Ideally I should be able to do sweeps, and I want the raw data to do the calculations myself and see if I can do other kinds of plots (like Cole plots). One of the RF inputs will be used to measure the voltage across my sample and the other to measure the current. I also need to know the phase offset.
I will need to do the measurements over different electrode pairs, so you could think different DUTs. I thought maybe I could output some control signal from the FPGA to the GPIO headers to use as a select signal for a multiplexer my PCB-front. Then I could for example do a measurement at 100Hz, repeat on all electrode pairs, go to the next frequency, and so forth.

I have very little experience coding software, but I am good at VHDL, and have some experience with Embedded Systems but I have only done so in with Altera-based evaluation boards.
Therefore I have tried the past months to figure out how to use the FPGA, because I thought this would be the easiest for me. I thought maybe I can do the calculations of complex impedance on the FPGA, and I would have to figure out a way to read the data out to the PC.
I have done and I am on board with all the examples made by Anton Potocknikhttp://antonpotocnik.com/?p=519284 (based on Pavel Demins work). Ive also built some of Pavels projects and looked at what he has done while trying to figure out the AXI bus and so on. I havent really been able to do anything but insert some trivial modules to existing projects and see that they compile and can be programmed to the FPGA. I have wanted to make a Vivado Project off of the official red pitaya image and maybe see if I can rather modify something in the Oscilloscope or insert some Signal Processing instead of the Oscilloscope but I have not succeded in this.

Otherwise I have looked at the SCPI approach but I think calling the SCPI functions from matlab will take too long per measurement cycle. I talked with a person that did a project similar to mine on the Red Pitaya, and what he did was recompile the SCPI server so that calculations where done in the embedded processor rather than outside it. I guess this could be an approach to take as well.

I have also considered just writing C-code to run from the command line / embedded processor. And then just dump the data to a text/csv file and manually move it to MATLAB and do plotting and so on. It would be little elegant and not very user-friendly but it could do the job. I dont know how I would manage changing the electrode pairs each time. I guess I would have to do each measurement manually and name stuff manually and it could potentially be a big mess but it would at least be something.

I only have 5 months from now to do this project and I am starting to get really afraid that I will not be able to do this. I guess this post is not really that much of a concrete question but more of a:
"What would you do if you were in my position sort of question". Or, maybe if you could ask me questions that I have not asked myself this would help me narrow down to a useful solution.

Any help would be appreciated.

JackTheRippchen
Posts: 12
Joined: Tue Sep 26, 2017 10:55 am

Re: Suggestions / ideas on how to accomplish my project?

Post by JackTheRippchen » Tue Nov 28, 2017 10:09 am

mnordgard wrote:I have also considered just writing C-code to run from the command line / embedded processor. And then just dump the data to a text/csv file and manually move it to MATLAB and do plotting and so on.
It is possible to trigger the execution of C code by MATLAB script and receiving the data into workspace. (Example for Bode Plotter)
In the next step, you might automatically change input parameters of the C code by MATLAB script.
Controlling the GPIO pins (respectively your measurement equipment) by MATLAB is also possible using SCPI commands.

P.S.: If you don't have a valid MATLAB license, you can use GNU Octave instead.

pavel
Posts: 789
Joined: Sat May 23, 2015 5:22 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by pavel » Tue Nov 28, 2017 12:51 pm

mnordgard wrote:Basically, what I want to do is measure complex impedance in the range from 100Hz to 100kHz.

I thought maybe I could output some control signal from the FPGA to the GPIO headers to use as a select signal for a multiplexer my PCB-front.

I've also built some of Pavel's projects and looked at what he has done while trying to figure out the AXI bus and so on.
Why not to use the VNA project as a starting point and to add the GPIO outputs to it?

The VNA project uses a simple control protocol that can be easily implemented in MATLAB using the TCP/IP library.

mnordgard
Posts: 12
Joined: Mon Feb 13, 2017 10:18 am

Re: Suggestions / ideas on how to accomplish my project?

Post by mnordgard » Tue Nov 28, 2017 2:56 pm

JackTheRippchen wrote: It is possible to trigger the execution of C code by MATLAB script and receiving the data into workspace. (Example for Bode Plotter)

P.S.: If you don't have a valid MATLAB license, you can use GNU Octave instead.

Hi Jack! I knew I had seen example codes like that before, I was looking for that yesterday actually but could not find it. I seem to recall there was a similar one for the impedance analyzer somewhere in the repo that I had tried to run before and could not. Then I didnt had putty installed in my development machine so I wanted to try that again.

And Pavel thanks for the suggestion! I had not looked at/built the VNA project. I had just seen the page and felt maybe this was too complex for me. (Though I was taking an RF circuit course so it would be cool to do it just to have the VNA :P)

That being said when I have looked at your projects I have only done it so I call to make the Vivado project and inspected the connections of the cores.

Code: Select all

make name=adc_test tmp/adc_test.xpr
I am a little daunted by the whole build chain I guess but I am figuring things out little by little. I understand that for some projects it is necessary to do the whole build chain because you have made changes to the memory of the system, so that it is not enough to load a new FPGA image because that causes the bus to crash (?).

I will look at the VNA project now and probably will have some fundamentally basic questions later, but I just wanted to say thank you for the incredible amount of work and help you give! I've been lurking in the forum for a while while trying to figure things out and I am thoroughly impressed. :)

mnordgard
Posts: 12
Joined: Mon Feb 13, 2017 10:18 am

Re: Suggestions / ideas on how to accomplish my project?

Post by mnordgard » Tue Nov 28, 2017 5:47 pm

Hi Pavel! The first question that pops to mind is regarding control with the TCP/IP library.
pavel wrote: The VNA project uses a simple control protocol that can be easily implemented in MATLAB using the TCP/IP library.
I dont really know where to start figuring this out. I have spent some time now looking at the VNA.c file. Would using the TCP/IP library replace using this file as server? Or is rather the point to establish connection with this code to do the data manipulation in MATLAB? I havent seen any MATLAB files in your repo, but do you know maybe of an example where something similar is done? This is supposed to be unrelated to SCPI, right?

pavel
Posts: 789
Joined: Sat May 23, 2015 5:22 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by pavel » Tue Nov 28, 2017 10:16 pm

mnordgard wrote:The first question that pops to mind is regarding control with the TCP/IP library.
I dont really know where to start figuring this out. I have spent some time now looking at the VNA.c file. Would using the TCP/IP library replace using this file as server? Or is rather the point to establish connection with this code to do the data manipulation in MATLAB? I havent seen any MATLAB files in your repo, but do you know maybe of an example where something similar is done? This is supposed to be unrelated to SCPI, right?
The idea is to run the VNA project on Red Pitaya as it is and to communicate with the server (vna.c) via TCP/IP. It's unrelated to SCPI.

Here is an example of the MATLAB code:

Code: Select all

% connect to the VNA server
t = tcpclient('192.168.1.100', 1001);

% set start frequency in Hz
start = 100;
write(t, int32(0 * 2^28 + start));

% set stop frequency in Hz
stop = 100e3;
write(t, int32(1 * 2^28 + stop));

% set sweep size
size = 1000;
write(t, int32(2 * 2^28 + size));

% set decimation rate
rate = 1000;
write(t, int32(3 * 2^28 + rate));

% start sweep
write(t, int32(7 * 2^28));

% read the data
data = read(t, 4 * size, 'single');

% convert the data
data = reshape(data, 4, size);
re1 = data(1, 1:size);
im1 = data(2, 1:size);
re2 = data(3, 1:size);
im2 = data(4, 1:size);
in1 = complex(re1, im1);
in2 = complex(re2, im2);

% disconnect from the VNA server
delete(t);
clear t;

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by amin » Wed Nov 29, 2017 4:51 am

Pavel,

I have been trying copy the content of sd card image zip file from this site:
http://pavel-demin.github.io/red-pitaya-notes/alpine/
After that, i am trying to connect my redpitaya using this image via IP 192.168.42.1 as default IP according to your configuration.
notconnect.PNG
But it can not connect to my PC via Wi-Fi.
Also i have been trying to use rp-f0xxxx.local can not success.

regards,
You do not have the required permissions to view the files attached to this post.

pavel
Posts: 789
Joined: Sat May 23, 2015 5:22 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by pavel » Wed Nov 29, 2017 8:57 am

amin wrote:I have been trying copy the content of sd card image zip file from this site:
http://pavel-demin.github.io/red-pitaya-notes/alpine/
After that, i am trying to connect my redpitaya using this image via IP 192.168.42.1 as default IP according to your configuration.
Your description of the problem misses quite a few steps. What is your network setup? How do you start the VNA application on Red Pitaya? Looking at the information that you provide, I can only suggest to carefully follow all the steps from the instructions.

192.168.42.1 is the default IP only if you connect your PC wirelessly to the RedPitaya Wi-Fi hotspot.

pavel
Posts: 789
Joined: Sat May 23, 2015 5:22 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by pavel » Wed Nov 29, 2017 9:17 am

pavel wrote: Why not to use the VNA project as a starting point and to add the GPIO outputs to it?
I've just realized that the GPIO outputs were recently added to the VNA project:
https://github.com/pavel-demin/red-pita ... 7d7e91b08a

So, the FPGA configuration is already OK and only the VNA server (vna.c) should be slightly modified. Current version of the protocol doesn't have a command to control the GPIO pins.

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: Suggestions / ideas on how to accomplish my project?

Post by amin » Wed Nov 29, 2017 1:36 pm

Pavel,
Your description of the problem misses quite a few steps. What is your network setup? How do you start the VNA application on Red Pitaya? Looking at the information that you provide, I can only suggest to carefully follow all the steps from the instructions.

My network setup is " wifi laptop - wifi hotspot- wifi redpitaya ".
I download vna.exe from your site: http://pavel-demin.github.io/red-pitaya-notes/vna/
in this section:
Download and unpack the control program.
Run the vna.exe program.
Image file red-pitaya-debian-8.6-armhf-20161219.zip has .img extension, but image file red-pitaya-alpine-3.6-armhf-20171025.zip was already unpacked.
Is it correct if i just copy content of your SD card image zip file into my empty sd card.
Download SD card image zip file (more details about the SD card image can be found at this link).

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 19 guests