libssh and reading sys_rdata values
Posted: 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):
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:
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!
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 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;
}
Thanks!