pgreenland / plutosdr-fw

PlutoSDR Firmware
Other
9 stars 1 forks source link

srsENB spamming time-stamping enabled but no timestamp provided #1

Open LunaWuna opened 1 year ago

LunaWuna commented 1 year ago

Hello, I followed everything you did in the blog post however apon launching srsENB it initialises the device and puts out a single spike on the transmitted frequency and spams the console.

I'm running ubuntu 23.04 and a pluto plus (compatible with the normal pluto and can run the stock pluto firmware but has ethernet built in and a TCXO so im almost certain this isn't the issue). I would love to get this working and hope you can help.

pgreenland commented 1 year ago

Hi LunaWuna,

I suspect (hope) that you've got the PRB setting and timestamp_every setting out of step.

In enb.conf, the highest performance configuration I managed with Analog's Pluto was:

[enb]
n_prb = 15

...

[rf]
tx_gain = 89
rx_gain = 20

device_name = soapy
device_args = driver=plutosdr,usb_direct=1,timestamp_every=3840,loopback=0
time_adv_nsamples = 40

15 resource blocks requires a sample rate of 3.84Mhz. srsRAN deals in 1 millisecond samples when it transmits and receives. So expects a timestamp every 3840000 / 1000 = 3840 samples.

I took a bit of a shortcut while updating soapysdr, such that every transmit call expects a timestamp. The no timestamp message is printed when srsRAN is forced to make multiple calls to complete its transmission. It only provides the timestamp on the first call and each additional transmit call generates a warning.

Let me know how you get on!

Thanks,

Phil

LunaWuna commented 1 year ago

Hello, Sadly I have confirmed all the things are correct and even tried the 15PRB setup but the same error keeps happening. One thing of note is when I use the pluto with a different piece of SDR software it just returns bugged samples nor does it transmit anything with that firmware.

image

No idea if this is expected but its a shame that wasn't the problem. One thing to note is that I am running it via a VM although on quite powerful hardware with 8 cores allocated (r9 5900x).

pgreenland commented 1 year ago

Hi,

Nuts - that was going to be the easy fix.

Running from a VM could well be part of your problem. I tried this originally hoping to host everything in a VM but the USB latency (I suspect) was too high. Closest I've come with proxmox is running everything in an LXC container. Isolated but still close enough to the hardware to meet the timing.

Debugging wise, you could look to enable tx and rx debugging with soapy, updating the following in https://github.com/srsran/srsRAN_4G/blob/master/lib/src/phy/rf/rf_soapy_imp.c

#define PRINT_RX_STATS 1
#define PRINT_TX_STATS 1

Then just capture a second or so of output and drop the output here.

Which other SDR software did you try it with? - I was careful to attempt to maintain compatibility in soapysdr with all the original functionality but haven't tested outside of srsRAN yet. Were you trying to transmit with the timestamping feature? I can already see a route through the code where timestamping may get left enabled after running srsRAN, leading to regular SDR applications which don't make use of timestamping to fail any transmissions.

Thanks,

Phil

ArielRFF commented 1 year ago

Hi @pgreenland I am running srsRAN with your firmware version on a Pluto+. I have set: [enb] n_prb = 6

[rf] tx_gain = 89 rx_gain = 20

device_name = soapy device_args = driver=plutosdr,usb_direct=1,timestamp_every=3840,loopback=0 time_adv_nsamples = 40

as you suggested, but tried 6 prb.

My console for srsenb shows:

==== eNodeB started === Type to view trace [INFO] Auto setting Buffer Size: 32768 [INFO] Set MTU Size: 32768 Setting manual TX/RX offset to 40 samples Setting frequency: DL=2150.0 Mhz, UL=1750.0 MHz for cc_idx=0 nof_prb=6 [INFO] Has direct RX copy: 1

I am checking to see the eNB with a cellphone using a programmed SIM card. The eNB doesn´t show on the phone.

Any clue on how to continue debugging ? Thank you.

pgreenland commented 1 year ago

@ArielRFF That's all looking pretty good. Could you post the complete enb startup log?

As an example, here's what I see with the same settings:

Started Software Radio System's LTE eNB implementation.
Active RF plugins: libsrsran_rf_soapy.so
Inactive RF plugins:
---  Software Radio Systems LTE eNodeB  ---
Reading configuration file /etc/srsran/enb.conf...
WARNING: cpu0 scaling governor is not set to performance mode. Realtime processing could be compromised. Consider setting it to performance mode before running the application.
Built in Release mode using commit 921f17484 on branch HEAD.
Opening 1 channels in RF device=soapy with args=driver=plutosdr,usb_direct=1,timestamp_every=3840,loopback=0
[WARNING] Unable to scan ip: -19

[INFO] Opening PlutoSDR #0 usb:5.12.5...
[INFO] Using format CF32.
[INFO] USB direct mode enabled!
[INFO] RX timestamping enabled, every 3840 samples
[INFO] Has direct RX copy: 1
[INFO] Using format CF32.
[INFO] TX timestamping enabled, every 3840 samples
[INFO] Has direct TX copy: 1
Supported RF device list: soapy file
Soapy has found device #0: device=PlutoSDR, driver=plutosdr, label=PlutoSDR #0 usb:5.12.5, uri=usb:5.12.5,
Selecting Soapy device: 0
Setting up Rx stream with 1 channel(s)
Setting up Tx stream with 1 channel(s)
Available device sensors:
 - xadc_temp0
 - xadc_voltage0
 - xadc_voltage1
 - xadc_voltage2
 - xadc_voltage3
 - xadc_voltage4
 - xadc_voltage5
 - xadc_voltage6
 - xadc_voltage7
 - xadc_voltage8
 - adm1177_current0
 - adm1177_voltage0
 - ad9361-phy_temp0
 - ad9361-phy_voltage2
Available sensors for Rx channel 0:
State of gain elements for Rx channel 0 (AGC supported):
 - PGA: 20.00 dB
State of gain elements for Tx channel 0 (AGC not supported):
 - PGA: 89.00 dB
Rx antenna set to A_BALANCED
Tx antenna set to A
==== eNodeB started ===
Type <t> to view trace
Closing stdin thread.
Setting manual TX/RX offset to 40 samples
Setting frequency: DL=2150.0 Mhz, UL=1750.0 MHz for cc_idx=0 nof_prb=6
RACH:  tti=1901, cc=0, pci=1, preamble=4, offset=40, temp_crnti=0x46
User 0x46 connected

Also what sort of system are you running it on? Physical machine or VM / what sort of specs?

Thanks,

Phil

pgreenland commented 1 year ago

Have just spotted one issue with your config, having just made the same mistake myself.

For PRB 6 the timestamp_every setting wants to be 1920. The higher value 3840 is for PRB 15.

It was working in my log above, but was pretty unstable.

ArielRFF commented 1 year ago

Hi Phil. Thanks for your answer.
I am running on a Ubuntu 22.4 physical machine, with 6 PRB and timestamp_every=1920. I still can´t see the eNB on the phone. This is my log:

Active RF plugins: libsrsran_rf_soapy.so libsrsran_rf_blade.so libsrsran_rf_zmq.so Inactive RF plugins: --- Software Radio Systems LTE eNodeB ---

Couldn't open , trying /root/.config/srsran/enb.conf Reading configuration file /root/.config/srsran/enb.conf... Couldn't open sib.conf, trying /root/.config/srsran/sib.conf Couldn't open rr.conf, trying /root/.config/srsran/rr.conf Couldn't open rb.conf, trying /root/.config/srsran/rb.conf WARNING: cpu0 scaling governor is not set to performance mode. Realtime processing could be compromised. Consider setting it to performance mode before running the application.

Built in Release mode using 22.04.0.

/home/ariel/github/srsRAN/srsenb/src/enb_cfg_parser.cc:1507: Force DL EARFCN for cell PCI=1 to 2350 ERROR: Invalid PRACH configuration - prach=(4, 10) does not fit into the eNB PRBs=(0, 6). Consider changing the "prach_freq_offset" value to 0 in the sib.conf file when using 6 PRBs. Opening 1 channels in RF device=soapy with args=driver=plutosdr,usb_direct=1,timestamp_every=1920,loopback=0 Supported RF device list: soapy bladeRF zmq file Soapy has found device #0: device=PlutoSDR, driver=plutosdr, label=PlutoSDR #0 usb:1.11.5, uri=usb:1.11.5, Soapy has found device #1: device=PlutoSDR, driver=plutosdr, label=PlutoSDR #0 ip:pluto.local, uri=ip:pluto.local, Selecting Soapy device: 0 [INFO] Opening PlutoSDR #0 usb:1.11.5... Setting up Rx stream with 1 channel(s) [INFO] Using format CF32. [INFO] Auto setting Buffer Size: 262144 [INFO] Set MTU Size: 262144 Setting up Tx stream with 1 channel(s) [INFO] Using format CF32. [INFO] Has direct TX copy: 1 [INFO] Auto setting Buffer Size: 32768 [INFO] Set MTU Size: 32768 Available device sensors:

==== eNodeB started === Type to view trace [INFO] Auto setting Buffer Size: 32768 [INFO] Set MTU Size: 32768 Setting manual TX/RX offset to 40 samples Setting frequency: DL=2150.0 Mhz, UL=1750.0 MHz for cc_idx=0 nof_prb=6 [INFO] Has direct RX copy: 1

pgreenland commented 1 year ago

@ArielRFF

Did you build and install my customised version of the soapy plugin for the pluto as well as the customised firmware?

Comparing your log output and mine, yours is missing the lines

[INFO] USB direct mode enabled!
[INFO] RX timestamping enabled, every 3840 samples
[INFO] Has direct RX copy: 1
[INFO] Using format CF32.
[INFO] TX timestamping enabled, every 3840 samples
[INFO] Has direct TX copy: 1

Thanks,

Phil

ArielRFF commented 1 year ago

Thank you Phil. I wasn´t using your version of soapy plugin indeed. I built it but unfortunately my phone still doesn't connect, and it cannot see the eNB. This is my log:

Active RF plugins: libsrsran_rf_soapy.so libsrsran_rf_blade.so libsrsran_rf_zmq.so Inactive RF plugins: --- Software Radio Systems LTE eNodeB ---

Couldn't open , trying /root/.config/srsran/enb.conf Reading configuration file /root/.config/srsran/enb.conf... Couldn't open sib.conf, trying /root/.config/srsran/sib.conf Couldn't open rr.conf, trying /root/.config/srsran/rr.conf Couldn't open rb.conf, trying /root/.config/srsran/rb.conf WARNING: cpu0 scaling governor is not set to performance mode. Realtime processing could be compromised. Consider setting it to performance mode before running the application.

Built in Release mode using commit fa56836b1 on branch master.

/home/ariel/github/srsRAN_4G/srsenb/src/enb_cfg_parser.cc:1881: Force DL EARFCN for cell PCI=1 to 2350 Opening 1 channels in RF device=soapy with args=driver=plutosdr,usb_direct=1,timestamp_every=1920,loopback=0 Supported RF device list: soapy bladeRF zmq file Soapy has found device #0: device=PlutoSDR, driver=plutosdr, label=PlutoSDR #0 usb:1.17.5, uri=usb:1.17.5, Soapy has found device #1: device=PlutoSDR, driver=plutosdr, label=PlutoSDR #0 ip:pluto.local, uri=ip:pluto.local, Selecting Soapy device: 0 [INFO] Opening PlutoSDR #0 usb:1.17.5... Setting up Rx stream with 1 channel(s) [INFO] Using format CF32. [INFO] USB direct mode enabled! [INFO] RX timestamping enabled, every 1920 samples [INFO] Has direct RX copy: 1 Setting up Tx stream with 1 channel(s) [INFO] Using format CF32. [INFO] TX timestamping enabled, every 1920 samples [INFO] Has direct TX copy: 1 Available device sensors:

==== eNodeB started === Type to view trace Setting manual TX/RX offset to 40 samples Setting frequency: DL=2150.0 Mhz, UL=1750.0 MHz for cc_idx=0 nof_prb=6

Regards, Ariel.

pgreenland commented 1 year ago

@ArielRFF

That's looking better :-).

It's looking pretty much the same as my output now. I tried the EARFCN you were using (2350?) on my setup the other day and got connected up ok.

What sort of spec machine is it? - I completed all my testing on a Ryzen 5600. I'm not sure how much of a difference it makes though tbh, I've had it running in the background on a Ryzen 4800 mini-pc too.

Have you got access to a spectrum analyser, to see if the unit's transmitting?

I've not tried it with a phone myself as I've not got one with an external RF connection.

I've tested with a couple of different modems though. I found that the Pluto's clock accuracy, at least as far as one modem was concerned was an issue. One can see the network and connects quite happily, the other refused until the pluto was configured to use an external GPS reference clock.

I'd hope that wasn't your issue but with only one working and one non-working modem to go by, I couldn't say for sure how picky devices are.

Thanks,

Phil

ArielRFF commented 1 year ago

Hi Phil thanks for your feedback.
Yes, I am using EARFCN 2350 because that band is clean in my area and the phone supports it (it is LTE Band 4). I also tried other values of EARFCN but with the same results. I am running on an Intel i7, so I think that wouldn´t be an issue. Unfortunately I don´t have a spectrum analyzer available. That would at least clear part of the mistery ;-)

Regards, Ariel.

pgreenland commented 1 year ago

Hi @ArielRFF,

I'm not sure of what else to suggest trying at the moment.

There's a trace option - hit "t" in the enodeb main window, where you should see any devices that attempt to register with the network.

When you say the phone can't see the network, I'm guessing you see the classic no bars / no signal sort of icon? Have you tried going into the advanced menus on the phone for network selection? See if its listed with the other local operators?

I take it you've prepared a sim card for your phone and added it to the user database? Although I believe the phone should be able to see the network without that, just not register to it.

Thanks,

Phil

ArielRFF commented 1 year ago

Hi Phil. I tried the "t" to view the trace, but nothing shows up.

Regarding the cellphone, I am using exactly the setup you describe. I have a programmed SIM card, which is added to user_db.csv database. The phone didn´t connect, so I am observing neighbouring cells entering "Service Mode". I am also using an android app called "Network cell Info" which shows all operator cells in the area. The srsRAN cell from Pluto is not listed.

Thank you. Ariel.

pgreenland commented 1 year ago

@ArielRFF

Taken me a while to get back to looking at this. I've just switched my unit back to its original setup using its internal clock and found the same as you.

I've got two modems in USB enclosures I've been testing with. Previously one modem was happy with the RF signal generated by the pluto using its internal clock, the other, a newer higher category modem wasn't. Similarly to you it just refused to see the network.

Today having switched back to the internal clock, neither modem would see the network. Switching back to an external GPS disciplined clock (http://www.leobodnar.com/shop/index.php?main_page=product_info&products_id=234) all is well again.

I wanted to see how low I could go performance wise, the network runs at 6 prb on a raspberry pi 4 and seemingly works reliably. But it wont at 15 prb :-(

If you're really set on getting it working trying a more accurate external clock might be the way forward. I believe the internal clock has an accuracy of +-25ppm - which is way out of the LTE specs. The better SDRs have +-5ppm or better.

If you're looking to do more than casually experiment you may be better buying a more beefy SDR. I've had success with the LimeSDR Mini. It's able to run at the full LTE sample rate and the clock seems accurate enough out of the box to work with both my modems.

For me getting this working with the Pluto was more a case of willing it into existence and having an excuse to tinker inside an FPGA for a bit / learn some new linux USB bits and pieces.

ArielRFF commented 1 year ago

@pgreenland Thanks for your comments.

I am running srsENB on Pluto+. The specs say the clock is 0.5 ppm, much more accurate than regular Pluto ! But maybe not enougth for the LTE requirement of 0.25 ppm.

Regards. Ariel.

LunaWuna commented 11 months ago

Update:

Success!

I managed to get it working with my pluto plus on a bare metal ubuntu server 23.04 machine. I have ordered some programmable sims to allow me to actually attach to it but so far, multiple devices can pick it up!

Tested on a Poco F3 and a Oneplus 11. Both pick it up perfectly fine in both 6 and 15prb.

Here is the spectrum of 6prb coming from the pluto. image

here is an NSG screnshot, however I can't get it to attach yet due to my lack of programmable sims right now :P image

pgreenland commented 7 months ago

@LunaWuna @ArielRFF I broke down and bought a pluto+.... checkout my latest post if you'd like to give the Ethernet interface a try: https://www.quantulum.co.uk/blog/private-lte-with-plutoplus-sdr/

ArielRFF commented 6 months ago

@pgreenland @LunaWuna Thank you so much for this update Phil !! I succeeded to connect a cellphone with a programmed SIM using Pluto+.

Screenshot_20231213-002228_Network Cell Info Lite