myriadrf / LimeSuite

Driver and GUI for LMS7002M-based SDR platforms
https://myriadrf.org/projects/lime-suite/
Apache License 2.0
468 stars 185 forks source link

Timestamp issue #228

Open lryindra opened 5 years ago

lryindra commented 5 years ago

Issue #219 was closed because SYNCH_DIS (bit 9) in DIQ interface control (0x0008) should always be 0 (Enable packets synchronization using timestamps).

Because the FPGA must always use the time stamp, LMS_RecvStream and LMS_SendStream should return an error if meta is ever NULL because metadata.timestamp = 0 is not a valid condition. As found in src/API/lms7_api.cpp.

IgnasJarusevicius commented 5 years ago

Passing NULL as metadata gives the same result as passing metadata with: .timestamp=0; .waitForTimestamp=false; .flushPartialPacket=false; As I said in the previous issue, timestamp synchronization is controlled by waitForTimestamp flag. Timestamp is ignored if 'waitForTimestamp=false', so passing NULL is valid.

lryindra commented 5 years ago

Given the following conditions:

I make a call to LMS_StopStream, then I make some changes to the data source, then I call LMS_StartStream.

What I observe is that data is only transmitted when I perform the LMS_StopStream & LMS_StartStream twice.

Issue #219 was the first workaround I found that made data transmit after every call to LMS_StartStream instead of every other.

IgnasJarusevicius commented 5 years ago

Could you provide a more detailed explanation of your problem? What board are you using (LimeSDR-Mini or LimeSDR-USB)? Are you using Tx only or both Tx and Rx? I have tried replicating the problem by modifying basicTX example and I did not notice any problems with LimeSDR-USB or LimeSDR-Mini. The streaming sequence in my test was basically:

  1. LMS_SetupStream()
  2. LMS_StartStream()
  3. Stream for 10s (using LMS_SendStream())
  4. LMS_StopStream()
  5. Sleep for some time (tried 100ms, 500ms and 1000ms)
  6. LMS_StartStream()
  7. Stream for 10s (using LMS_SendStream())
  8. LMS_StopStream()
  9. LMS_DestroyStream()
lryindra commented 5 years ago

I updated LimeSuite to gitrev: 18d2fa (this is LimeSuite 18.10), and I got the same results as I did with the older version of LimeSuite.

I should also say that I tested with a LimeSDR-Mini.

IgnasJarusevicius commented 5 years ago

So the issue only appears on Raspberry Pi 3 and it works fine on PC with Intel i5 CPU? RPi 3 only has USB2, did you use also USB2 on i5 PC? Are you using the latest FPGA gateware for LimeSDR-Mini? I think some USB2 issue was addressed in recent FPGA update for LimeSDR-Mini. It is also possible that LimeSDR-Mini is not getting enough power from RPi via USB2 and is not working stably because of that.

lryindra commented 5 years ago

1) yes the Raspberry Pi 3 only has USB 2.0 ports. The LimeSDR-Mini is (sometimes) shipped with a splitter cable that should draw voltage from two USB 2.0 ports. I have not found the splitter to be necessary. 2) I tested the code in timestamp.tar.zip on the Raspberry Pi 3 with LimeSuite version 18.06 (gitrev: ddae8b9) and with LimeSuite version 18.10 (gitrev: 18d2fa), and I get the same behavior with both versions. 3) my Intel i5 computer has a USB 3.0 port which is handy because I know that LimeSuite 18.06's gateway FPGA for the LimeSDR-USB is unable to transfer data over USB 2.0. 4) I can get the results I want by either destroying and creating as in limesdr_stopchannel from https://github.com/emvivre/limesdr_toolbox, or by setting SYNCH_DIS (bit 9) in DIQ interface control (0x0008) to 1 (Disable packets synchronization using timestamps). 5) it sounds like you don't spend a lot of time reading discourse.myriadrf.org. Maybe Andrew Back can assist?

lryindra commented 5 years ago

I updated, so I'm posted the updated software: Hardware: Raspberry Pi 3 Model B+ OS: ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img.xz from https://www.ubuntu.com/download/iot/raspberry-pi-2-3 attached software required GnuRadio (version 3.7.13.5), LimeSuite (gui version 19.04.0-gdd83c404) and gr-limesdr (commit 4125e1f4f60a9c17698253c180911199bed657d1) LimeSDR Mini [USB 2.0] FW:6 HW:1 Protocol:1 GW:1.30 Ref Clk: 40 MHz

timestamp_test.tar.zip

lryindra commented 5 years ago

Do you have any idea how this issue will be resolved for the limenet-micro?

lryindra commented 5 years ago

https://discourse.myriadrf.org/t/rx-tx-timestamp-and-soapysdr/2459/8