Register interaction in v0.94

dedicated to the FPGA topics for all Red Pitaya programmers
Post Reply
sslerose
Posts: 36
Joined: Sat Nov 26, 2022 12:43 am

Register interaction in v0.94

Post by sslerose » Wed Mar 27, 2024 3:39 am

Hello all

I am working on a project based on the v0.94 build that requires user-defined parameters in my custom Verilog module. I achieved a proof-of-concept model a few months ago that used a barebones approach similar to the Stopwatch or Frequency Counter lessons in which I used a memory-mapped GPIO core to define the necessary parameters. However, I would like to use the v0.94 build to take advantage of the API commands to make acquisition and analysis easier. My intended solution was to write to the free register spaces in the v0.94 project (i.e., 0x4600000 to 0x46FFFFF) from the Linux or JupyerLab side and read the registers from my Verilog module. However, I do not know how to do this. I have tried to find two possible solutions, please give me suggestions or pointers:
  1. Is it reasonably possible to run a C file that writes to the free register spaces using the I2C protocol and then use Python for the acquisition? If not, does the team intend to add I2C functionality through Python scripts?
  2. As another option, could I memory map the free register spaces in v0.94 (in the same way that the GPIOs were mapped in the frequency counter lesson, but without a GPIO core) and read these from my Verilog modules?
A plan B if using v0.94 in this manner is not possible is to create another barebones project and use Pavel's AXI4 Hub. With this, JupyterLab needs access to the corresponding Python package. Is the addition of Python packages possible in the JupyterLab application of the Red Pitaya?

Thank you in advance for any suggestions!

User avatar
redpitaya
Site Admin
Posts: 912
Joined: Wed Mar 26, 2014 7:04 pm

Re: Register interaction in v0.94

Post by redpitaya » Thu Mar 28, 2024 3:29 pm

Hello sslerose,

We will add the I2C control through Python API in the future.

For the second part, that is possible and you can find examples of how to do this in FPGA by combining these two tutorials:
- How to link the processing system (add custom component to the base project): https://redpitaya-knowledge-base.readth ... ed-counter
- How to configure the addresses: https://lniv.fe.uni-lj.si/redpitaya/ (the oscilloscope project deals with creating registers and then configuring them through a C program)

From the C program point of view, you need to remap the memory, then you can access the registers with the "monitor" command.

Please note that there might be better ways to address this from the FPGA side. This is a simplified approach.

I hope this helps.

sslerose
Posts: 36
Joined: Sat Nov 26, 2022 12:43 am

Re: Register interaction in v0.94

Post by sslerose » Fri Apr 26, 2024 7:10 pm

Hello again,

Thank you for the information! My plan at this point is to pass ADC1 data from the PS to my module and then to channel 1 of the oscilloscope module while routing ADC2 data directly to channel 2 of the oscilloscope.

I do have a small follow-up question: can I run both JuptyerLab and the oscilloscope application simultaneously? I would like to use the Python API to generate a test signal and then use the oscilloscope app to interactively view the outputs.

Thank you in advance!

sslerose
Posts: 36
Joined: Sat Nov 26, 2022 12:43 am

Re: Register interaction in v0.94

Post by sslerose » Sat Apr 27, 2024 10:18 pm

Update,

I tried running a continuous generation script in Jupyter and found that I could operate the oscilloscope application alongside it. I was disconnected from my STEMlab 125-14 a few times while I was doing this and I had to re-run my Python code, but it more or less worked out.

I also realized that I can simply use the signal generator app within the oscilloscope app, so Jupyer is not necessary and I have answered my own question.

However, I found that when I used the arbitrary signal generation in Jupyter to generate an exponentially decaying pulse that I pass to OUT1, my baseline hovers around -0.015V as recorded on IN1. I have my pulse coded as

Code: Select all

ampl = 1.0
N = 16384
exp_pulse = rp.arbBuffer(N)

tau = 500
lead_samples = 5000

for i in range(0, N, 1):
    if i < lead_samples:
        exp_pulse[i] = float(0)
    else:
        exp_pulse[i] = float(ampl * np.exp(-(i - lead_samples) / tau))
which should yield a baseline of zero. Is this expected?

Also, when I specify that my exp. decaying pulse should have a time constant of 500, the direct frequency command changes this time constant. How does the direct frequency command work when it comes to arbitrary signal generation?

Thank you in advance.

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