I want a simple SG and sampler standalone without web

Applications, development tools, FPGA, C, WEB
Post Reply
dzonesasaki
Posts: 2
Joined: Tue Jan 31, 2017 6:21 am

I want a simple SG and sampler standalone without web

Post by dzonesasaki » Wed Feb 08, 2017 9:14 am

I want a simple Signal Generator (SG) and a Signal Sampler using a standalone Red-Pitaya broad without web.
But I can not solve 2 problems.

(Problem 1) There is no output signal.
I got a clone of "Test/generate" from github.
https://github.com/RedPitaya/RedPitaya/ ... t/generate
I made a executable file "generate" and run it from command-line via terminal on PC like this.

Code: Select all

 ./generate 1 1.99 100000 sine 0
But there is no signal from ch1.
Then , I tried accessing a web page from PC to board and just once turn on generate application.
After this procedure, the board can output signal from command-line.

I want to run it without web access.


(Problem 2) Can not sample signal.
I got a clone of "apps-free/spectrum" from github.
https://github.com/RedPitaya/RedPitaya/ ... e/spectrum
I modified main.c to add main function that calls rp_app_init() and rp_get_signals() like this.

Code: Select all

void main(void){
 float ***s;
 s = malloc(sizeof(float *)*SPECTR_OUT_SIG_NUM);
 for(int i=0;i<SPECTR_OUT_SIG_NUM;i++)
 {
  s[i]=malloc(sizeof(float *)*1);
  s[i][0]=malloc(sizeof(float *)*SPECTR_OUT_SIG_LEN);
 }
 int sig_num=0;
 int sig_len=0;
 float freq_cha=0;

 rp_app_init();
 rp_get_signals( s, &sig_num, &sig_len, &freq_cha);

 printf("peak freq= %1.6f\n",freq_cha);
}
The function rp_get_signals was also added argument for output "result.peak_cha".
A Makefile was also modified to remove "-shared" flag and change a executable file name to "spectrum".
I connected a SG and ch1 of RX. The signal is 100KHz 1Vpp CW.
I tried run this program like this,

Code: Select all

 ./spectrum
But the result was "peak freq= 0.000000".

I want to know how to sample signal using only C code.

Can anyone help me?
Thanks

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

Re: I want a simple SG and sampler standalone without web

Post by Nils Roos » Sat Feb 11, 2017 7:56 pm

The Red Pitaya nowadays boots into the logic analyzer FPGA configuration, which is not compatible with the scope-related functions.

When the bazaar starts a web app, it automatically loads the required FPGA bitstream. The generate program does not do that, so in order to use generate completely stand-alone, you need to do "cat /opt/redpitaya/fpga/fpga_0.94.bit >/dev/xdevcfg" once.
I modified main.c to add main function that calls rp_app_init() and rp_get_signals() like this.
You should examine the return value of rp_app_init(). I guess initializing the fpga failed (for the same reasons generate did not work), and rp_app_init terminated prematurely with -1. Try the cat /opt/... before executing your modified spectrum program.

dzonesasaki
Posts: 2
Joined: Tue Jan 31, 2017 6:21 am

Re: I want a simple SG and sampler standalone without web

Post by dzonesasaki » Wed Feb 15, 2017 9:16 am

Thanks a lot for your reply.
The FPGA configuration was succeeded and the board outputs signal !! :D
But the sampler was failed that shows zero even after configuration.
The return value of rp_app_init() was 0 .

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