pavel-demin / red-pitaya-notes

Notes on the Red Pitaya Open Source Instrument
http://pavel-demin.github.io/red-pitaya-notes/
MIT License
339 stars 212 forks source link

Error when 'source .../block_design.tcl' #1106

Closed marcomeixner closed 1 year ago

marcomeixner commented 1 year ago

Hallo,

Description of the setup:

Description of the problem:

Vivado is running smoothly for the LED blinker project - so that should be fine. I can open the files and make the Red Pitaya blink.

However, when I want to open the block_design.tcl file the following happens:

source C:/redPitaya/pulsed_nmr_122_88/block_design.tcl
# cell xilinx.com:ip:clk_wiz pll_0 {
#   PRIMITIVE PLL
#   PRIM_IN_FREQ.VALUE_SRC USER
#   PRIM_IN_FREQ 122.88
#   PRIM_SOURCE Differential_clock_capable_pin
#   CLKOUT1_USED true
#   CLKOUT1_REQUESTED_OUT_FREQ 122.88
#   CLKOUT2_USED true
#   CLKOUT2_REQUESTED_OUT_FREQ 245.76
#   CLKOUT2_REQUESTED_PHASE 157.5
#   CLKOUT3_USED true
#   CLKOUT3_REQUESTED_OUT_FREQ 245.76
#   CLKOUT3_REQUESTED_PHASE 202.5
#   USE_RESET false
# } {
#   clk_in1_p adc_clk_p_i
#   clk_in1_n adc_clk_n_i
# }
invalid command name "cell"
    while executing
"cell xilinx.com:ip:clk_wiz pll_0 {
  PRIMITIVE PLL
  PRIM_IN_FREQ.VALUE_SRC USER
  PRIM_IN_FREQ 122.88
  PRIM_SOURCE Differential_clock_capable_pin
  ..."
    (file "C:/redPitaya/pulsed_nmr_122_88/block_design.tcl" line 2)

Thanks a bunch!

Marco

pavel-demin commented 1 year ago

My scripts were never meant to work the way you use them. So it is normal that they do not work that way.

If you really need to use Vivado on Windows and run my scripts without using Makefile, then here is how it could be done:

a) Open Vivado, and in the Tcl console, paste this code:

cd C:/redPitaya
source helpers/build-cores.tcl

This will generate the cores in the tmp directory.

b) Build the project:

set argv [list pulsed_nmr_122_88 xc7z020clg400-1]
source scripts/project.tcl

If these commands do not work for you, then I can only recommend using WSL (Windows Subsystem for Linux), installing Ubuntu 22.04 from Microsoft Store and installing Xilinx tools for Linux. This way you can use all the scripts in this repository and follow the examples in the notes.

pavel-demin commented 1 year ago

I have just noticed that your board is STEMlab 125-10.

The correct project for this board is pulsed_nmr and the commands to build the project are

set argv [list pulsed_nmr xc7z010clg400-1]
source scripts/project.tcl
marcomeixner commented 1 year ago

Thank you so much for your quick reply!!

I now ended up here:

start_gui
cd C:/redPitaya/red-pitaya-notes-master/
set argv [list pulsed_nmr xc7z010clg400-1]
pulsed_nmr xc7z010clg400-1
source C:/redPitaya/red-pitaya-notes-master/scripts/project.tcl

Then it runs quite far and even the Diagram is created, until the following errors:

ERROR: [BD 5-390] IP definition not found for VLNV: pavel-demin:user:axis_red_pitaya_adc:* 
ERROR: [Common 17-39] 'create_bd_cell' failed due to earlier errors.

    while executing
"create_bd_cell -type ip -vlnv $cell_vlnv $cell_name"
    (procedure "cell" line 2)
    invoked from within
"cell pavel-demin:user:axis_red_pitaya_adc adc_0 {
  ADC_DATA_WIDTH 14
} {
  aclk pll_0/clk_out1
  adc_dat_a adc_dat_a_i
  adc_dat_b adc_dat_b_i
  adc_..."
    (file "projects/pulsed_nmr/block_design.tcl" line 71)

    while executing
"source projects/$project_name/block_design.tcl"
    (file "C:/redPitaya/red-pitaya-notes-master/scripts/project.tcl" line 68)
update_compile_order -fileset sources_1

I do have WSL running. You think I need to switch to that now?

Thank you so much!!

pavel-demin commented 1 year ago

It looks like you are still missing the first step of running the build-cores.tcl script.

marcomeixner commented 1 year ago

Ah ok thank you!

When I run this command:

source C:/redPitaya/red-pitaya-notes-master/helpers/build-cores.tcl

and emtpy this folder before:

C:\redPitaya\red-pitaya-notes-master\tmp

Vivado jumps back an forth until I get this error:

ERROR: [Common 17-53] User Exception: Project already exists on disk, please use '-force' option to overwrite: 
     C:/redPitaya/red-pitaya-notes-master/tmp/cores/axis_fifo.sim

I made a video in case you are interested in the details: https://cloudstore.zih.tu-dresden.de/index.php/s/DyNmdEAZBgbJBrr

If this gets too annoying just let me know and I will switch to WSL.

In any case - thanks a lot for your help!

pavel-demin commented 1 year ago

Thank you for the video.

I have just checked that there are indeed two axis_fifo entries in the version of the build-cores.tcl script that you are using. It seems that Vivado on Windows creates additional .sim directories for cores but it does not create them on Linux.

I have just added the .sim directory to the delete command in the core.tcl script. I have also changed the build-cores.tcl script last week. The current version does not contain the two axis_fifo entries.

Could you try updating your version of red-pitaya-notes? I think the latest version should work better for you.

marcomeixner commented 1 year ago

Great, thank you!

Now this command runs through:

source C:/redPitaya/red-pitaya-notes-master/helpers/build-cores.tcl

But then when I run this command:

source C:/redPitaya/red-pitaya-notes-master/scripts/project.tcl

This happens:

couldn't read file "projects/xadc_bram/block_design.tcl": no such file or directory
    while executing
"source projects/$project_name/block_design.tcl"
    (file "C:/redPitaya/red-pitaya-notes-master/scripts/project.tcl" line 68)

I put

Thank you!

pavel-demin commented 1 year ago

I think that you are almost there.

The order of the commands is important. The set argv ... command must be run before running the project.tcl script:

set argv [list pulsed_nmr xc7z010clg400-1]
source C:/redPitaya/red-pitaya-notes-master/scripts/project.tcl

See this comment for more details.

The build-cores.tcl script only needs to be run once to build the cores in the tmp directory. After that, the project.tcl script can be run multiple times if multiple projects need to be generated.

marcomeixner commented 1 year ago

Great, in that order everything now seems to work, thank you!

I now without error did this:

However, how do I know if it works - meaning if it acually runs on the Pitaya without error?

And: Is there a documentation of how to connect the Pitaya to the other components?

Thank you!

pavel-demin commented 1 year ago

However, how do I know if it works - meaning if it acually runs on the Pitaya without error?

When I test it, I connect OUT1 to IN1 and try to get the signal envelope plot as shown in the screenshot in the notes. Maybe you could try something similar.

And: Is there a documentation of how to connect the Pitaya to the other components?

For me, it is still an "in progress" project that I have never tested with real NMR hardware. So I do not have any documentation about the connection to other components and the software is still very basic.

I know that Dr. Beau Webber uses the part of the code that runs on the Red Pitaya with his hardware and software. The article at the following link contains information about this system: https://www.mdpi.com/2673-8023/3/2/28

Figure 6 in this article shows the hardware and software modules, with the connections between them.

marcomeixner commented 1 year ago

Ok nice, I will try that and take a look at the paper, thanks!

My goal would be to finde out to what degree it is possible to replace the Kea2 Spectrometer in this project, which was part of my PhD: https://www.sciencedirect.com/science/article/pii/S109078072030197X

But for me it is also a side project - at least at the moment.

I will keep you updated.

marcomeixner commented 1 year ago

I finally found the time to try out the build you were so kind to help me make.

Here is a screenvideo of me trying to connect the client to the server: 'Server-to-Pitaya_03-10-2023_19-02-15.mp4' https://datashare.tu-dresden.de/s/DyNmdEAZBgbJBrr

Somehow the connection is refused. I also tried starting ' pulsed_nmr.py' with sudo rights, but no luck.

Do you have any clue what might be the problem?

Thank you so much for any input on this!

pavel-demin commented 1 year ago

In the video you configure the FPGA but you do not start the server (pulsed-nmr.c). Since the server is not running, the client cannot connect to it.

marcomeixner commented 1 year ago

Ah ok thank you!

It has been a while since I used c, but here is what happens when I try to compile the file on the Pitaya: https://datashare.tu-dresden.de/s/DyNmdEAZBgbJBrr start_nmr_server_on_pitaya_ScreenVideo_09-10-2023_21-54-40.mp4

pavel-demin commented 1 year ago

Try to compile the server code using the make command. This is what I use.

Out of curiosity. What is the reason behind using this most complicated way of running this application? Would not it be quicker and easier to follow the getting started instructions and have the pulsed NMR application running in minutes?

Today is the two months anniversary of this issue.

marcomeixner commented 1 year ago

Sorry to bother you so much with this.

I thought I am trying the most straightforward way to start the server. I get the same error with 'make' btw.

pavel-demin commented 1 year ago

I think that the most straightforward way to start the server is described in the getting started instructions at this link. Here is a copy of the part of instructions related to the server:

marcomeixner commented 1 year ago

Ok. Thanks a lot for all your help!