pothosware / SoapyHackRF

SoapySDR HackRF module
https://github.com/pothosware/SoapyHackRF/wiki
MIT License
131 stars 31 forks source link

Request to create RX/TX split for SoapyHackRF #44

Open kschepps opened 1 year ago

kschepps commented 1 year ago

Since the HackRF is half duplex, it can only work as an RX or TX. Not both. I have two HackRF's. I'm trying to get SoapyMultiSDR to run one HackRF as TX and another as RX, but Soapy is only connecting one as RX and TX then ignoring the other which doesn't work.

If I adjust this source code and change HackRF_Settings.cpp where line 160 reads the below code, I can force the HackRF to be RX or TX once compiled. For TX: return (dir == SOAPY_SDR_RX) ? 1 : 0; For RX: return (dir == SOAPY_SDR_RX) ? 0 : 1;

However, this will overwrite the SoapyHackRF driver. I need separate drivers for only RX and only TX. My attempts to compile the source as a separate instance by editing the CMakeList has only caused crashes when trying to run.

tomdionysus commented 11 months ago

I have started work on a Soapy module for HackRF that is intended to allow 2x HackRF One units to be viewed as a single full-duplex device. The code so far is a best-guess draft, I'm waiting for delivery of 2 HackRF One SDRs to continue. @kschepps please feel free to jump on the below and take a look - what I know about real SDR engineering could comfortably be written on quite a small postcard with quite a large pen, and I could use all the help I can get.

This is pre-alpha: https://github.com/tomdionysus/SoapyHackRFDuplex

If I/we get it working, we can submit it to the powers that be at https://github.com/pothosware and hopefully others will find it useful - in my case, because it means I'll be able to build a LTE picocell using srsRAN and open5gs for under USD $250 :)

kschepps commented 11 months ago

I got TX and RX working with two HackRF's with an if statement: if serial number equals one of my specific serial numbers then be RX else be TX. I was trying to use it with srsRAN to run an LTE signal. It started with no errors, but no devices would attach. Maybe there's a timing issue? I couldn't figure out how to confirm if the clocks were syncing or if something else was preventing it from working.

tomdionysus commented 11 months ago

Fair enough. At a guess, the HackRF modules are reporting one half duplex channel each to SoapyMultiSDR, which is likely smart enough not attempt to use them at the same time. Unless you're using TDD (which AFAIK the srsRAN ENB doesn't support) you need full-duplex on the uplink and downlink pair for LTE to work properly - which is why only full duplex devices are natively supported by srsenb. Hence, my attempt at my own module, which reports 2 channels, one TX, one RX, both marked full duplex.