libssh and reading sys_rdata values

Applications, development tools, FPGA, C, WEB
Post Reply
sbenjamin
Posts: 10
Joined: Sun Apr 09, 2023 7:22 am

libssh and reading sys_rdata values

Post by sbenjamin » Mon Jan 08, 2024 4:40 pm

Hello,

I'm trying to read sys_rdata content from a simple led module I've created. The module also receives an index passed using the "monitor" command, and blinks the LED of that index.
Below is the bit of code in my led.sv module, that reads (from sys_wdata) and writes (to sys_rdata):

Code: Select all

always_ff @(posedge clk_i) begin
    if (~rstn_i) begin
      // Reset logic here
    end else if (sys_wen) begin
      // Decode address and write registers here
      // if (sys_addr[19:0] == 20'h00054) begin
      //   // Write logic for the specific address
      // end
      if (sys_addr[31:0] == 32'h40300058) begin
         // Write logic for the specific address
         led_index <= sys_wdata[31:29];
      end
    end
  end

  always_comb begin
    case (sys_addr[31:0])
      32'h40300050: sys_rdata <= 32'hFEEDBACC; // ID
      default: sys_rdata <= 32'h00000000;
    endcase
  end
I have created a simple C++ console app, which uses libssh library for connecting and communicating to my Red Pitaya via SSH. The "monitor" command for sending the index of the LED works fine, but I haven't managed to read data from the sys_addr address which should hold the value I was hoping to read.

I did managed to receive the ID value (0xfeedbacc) when executing the "monitor 0x40300050" command using PuTTY.

Here is the code I'm using to send the Index value to the FPGA from my console app:

Code: Select all

// Execute the "monitor" command to set LED 3'hA00 => 5
    std::string monitorCommand = "/opt/redpitaya/bin/monitor 0x40300058 0xA0000000\n";
    rc = ssh_channel_write(channel, monitorCommand.c_str(), monitorCommand.length());
    if (rc < 0) {
        std::cout << "Error writing to channel: " << ssh_get_error(my_ssh_session) << std::endl;
        return 1;
    }
Can anyone please advise as for my options for communicating remotely via SSH, without the need of a third party app like PuTTY? Also If anyone has any experience with the libssh library, and has managed to read and write to system addresses please let me know.

Thanks!

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

Re: libssh and reading sys_rdata values

Post by redpitaya » Tue Jan 09, 2024 2:43 pm

Hello Benjamin,

I am not familiar with the sshlib, but as a general note, please make sure that the FPGA image is correctly loaded.
Upon reboot, the FPGA image automatically changes to the default v0.94 image (unless the default image setting is replaced with your custom FPGA image). Which means that if you followed the standard Red Pitaya instructions for changing the FPGA image, then the image is reset on reboot.

On the other hand, if you are sure that your FPGA image is loaded (for example using LEDs as indicators), you can safely ignore the above.

Here is the library tutorial and it includes remotely executing commands (check the "Doing something" section):
https://api.libssh.org/stable/libssh_tu ... _tour.html
https://api.libssh.org/stable/libssh_tutorial.html

Good luck with your project.

javed49
Posts: 1
Joined: Tue Jan 09, 2024 2:50 pm

I need to put static IP in the new OS version

Post by javed49 » Tue Jan 09, 2024 3:14 pm

I have Installed redpitaya os version 2.00-18 using windows pc in my sd card. Now when I go for wifi adapter to connect to my homenetwork, it is searching with the ip of 169.254.196.173 which is out of my home private ip. For that reason I can not connect the redpitaya to the internet. I have established ssh connection by putting eth0 means ethernet port to 192.168.128.1 but I need internet access through wireless lan port which is a usb Edimax EW-7811Un and with Realtek RTL8188CUS cheapset. I need to make the ip address static and later also need to make static IP for other purposes. Now all given solution I searched is saying to go to /etc/systemd/network/ and cahnge networkd conf. But how and what is the format. I have file in network folder 25-wireless.link wireless.network wireless.network.client wired.network wireless.network.ap
which file to configure wireless ip as static with default gateway and DNS servers. Can anyone help?

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

Re: libssh and reading sys_rdata values

Post by redpitaya » Mon Feb 12, 2024 12:58 pm

Hello javed49,

Thank you for the update. We fixed some Wi-Fi issues in the latest Nightly Builds (2.00-232 and higher - https://downloads.redpitaya.com/downloa ... ly_builds/).

I would suggest accessing Red Pitaya through the computer (with a Wi-fi dongle connected) and configuring the IP through the Network Manager application.

I will ask the team, where and how you can manually modify the static IP address.

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: Google [Bot] and 87 guests