POST /data

Applications, development tools, FPGA, C, WEB
Post Reply
amalagon
Posts: 17
Joined: Thu Jan 15, 2015 9:34 pm

POST /data

Post by amalagon » Mon Feb 23, 2015 8:53 pm

I was looking at this very helpful thread (viewtopic.php?f=14&t=428) in trying to post parameters to the spectrum application; it doesn't seem that my post changes any of the parameters though, and I'm not sure why.

Here's what I'm doing (using the requests and json libraries for python):

Code: Select all

requests.get('http://<red_pitaya_ip_address>/bazaar?start=spectrum')
this returns an OK status

Code: Select all

requests.post(''http://<red_pitaya_ip_address>/data', data=json.dumps({'datasets':{'params': {'xmin': 20000}}}))
returns the same parameters I started out with. Is there some syntax I'm doing wrong in the POST request?

Thanks,

amalagon

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: POST /data

Post by Nils Roos » Tue Feb 24, 2015 11:37 pm

Hi amalagon,

There is nothing wrong with the syntax, but you picked the wrong parameter for your chosen app.

Most parameters for the spectrum app are read-only (see the parameter definition in Applications/spectrum/src/main.c). In fact, only the "freq_range" parameter can be changed.

amalagon
Posts: 17
Joined: Thu Jan 15, 2015 9:34 pm

Re: POST /data

Post by amalagon » Wed Feb 25, 2015 5:53 am

Thanks, Nils! That explains a lot. I do wonder, can I change other parameters to be write-able easily? I tried changing the fpga_update and read_only values of several other parameters to 1 and 0, respectively, in main.c (function block after L30), but when I recompile the application and load it onto the redpitaya I can still only change "freq_range", so my changes don't seem to be enough to successfully write to these other parameters.

So I guess, either a) changing the values of fpga_update/read_only for different parameters is the right way to do this and I'm just not updating the code correctly, or b) I need to change something else in the code in addition to those settings.

If it's a), this is how I'm updating the code:
I make my changes to the file on my local computer and save them. I cd to the RedPitaya directory and do

Code: Select all

source /opt/Xilinx/Vivado/2013.3/settings64.sh
export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
make -C Applications
I then zip the spectrum directory

Code: Select all

zip -r spectrum_modified spectrum
and load it onto the redpitaya:

Code: Select all

scp spectrum_modified.zip root@<red_pitaya_ip_address>
ssh onto the redpitaya and do

Code: Select all

rw
cd /opt/www/apps
unzip spectrum_modified.zip
killall nginx
ro
nginx -p /opt/www
if this all looks right, do you have any suggestions for things I might need to do in addition to be able to write to these other parameters? I'd like to add some fprintf statements to debug, but I'm not sure where I could see that output - does it get piped to the HTTP response (which is what I would see) or does it get lost somewhere before then?

Thanks,

amalagon

amalagon
Posts: 17
Joined: Thu Jan 15, 2015 9:34 pm

Re: POST /data

Post by amalagon » Thu Feb 26, 2015 4:00 am

Resolved - I was running make in the wrong directory. Re-ran make in the spectrum directory and now my changes are reflected in the application!

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: POST /data

Post by Nils Roos » Thu Feb 26, 2015 8:26 pm

For the record:

Calling "make -C Applications" from the RedPitaya home directory builds and packages all stock apps. You will find the zips ready to use in the Applications subfolder.

The Applications/spectrum directory contains only the sources. If you execute the make command in the RedPitaya directory, the binary output is generated into the "target" folder, which is removed after the zips are ready.

amalagon
Posts: 17
Joined: Thu Jan 15, 2015 9:34 pm

Re: POST /data

Post by amalagon » Tue Mar 03, 2015 11:23 pm

Hey Nils,

Thanks for the clarification - I guess I'm confused because it seems that when I do

Code: Select all

 make -C Applications
from the RedPitaya directory and then take the spectrum-0.92-0-devbuild.zip file and unzip it in the redpitaya /opt/www/apps directory, that nothing changes when I run the application again. However, if I run make from the Applications/spectrum directory, it seems that copying over the controller.so binary file to the redpitaya is enough to upload all new changes. But I checked after building from the main RedPitaya directory, and it seems that the binary file controller.so is no longer in the spectrum directory, so I'm not sure what to do to get my changes implemented when building from the main directory if the default zip file is not enough?

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 60 guests