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 211 forks source link

Connection issues when transferring large numbers of ADC samples #1153

Closed Yikai-Xia closed 1 month ago

Yikai-Xia commented 1 month ago

Description of the setup:

Description of the problem:

Like the way you do in adc_trigger_recorder project, after the FPGA recorded the ADC samples into RAM and the oscilloscope stopped, I was trying to send the data samples to the client. But the SSH and the connection broke after sending about 88MB of data. The data already sent to the client is as expected and without issue. The program completes successfully if the data size is below this threshold.

I have checked the RAM writer position from its sts port output, it is way above the breakpoint. Meanwhile, I have tried different sizes of sending data chunk, CPU sleep time and sending buffer size, but these changes did not resolve the issue.

image image

Steps to reproduce the problem:

  1. Rebuild the SD card image after changing the CMA sizes in dts/initrd.dts and rootfs.dts to 256M.
  2. I think what I have adapted in your adc_test project is basically equivalent to deleting the CIC related modules and changing the parameters in RAM_writer module. FIFO write depth to 8192, and cfg_data's constant value to 2097151, width to 21.
  3. You can take a look at the server.c file attached. server.zip

Thank you very much for your assistance in resolving this issue.

pavel-demin commented 1 month ago

I have looked at the server code and I do not see why it would freeze the system. I think that the problem is more likely in the FPGA configuration.

The main problem with your approach is that if you remove the CIC filter, some ADC samples will be lost because the throughput of the FPGA to RAM interface in the current version of the adc_test project is not sufficient to transfer the ADC samples at the full sample rate.

I am closing this issue because I do not think that this is the right place to discuss problems in your code. I think that these kinds of issues should be opened in a fork of this repository containing all your changes.