pothosware / SoapyBladeRF

Soapy SDR plugin for the Blade RF
https://github.com/pothosware/SoapyBladeRF/wiki
23 stars 20 forks source link

Access quick tune API #34

Closed KarlL2 closed 2 years ago

KarlL2 commented 5 years ago

Hi Josh,

I'd like to access bladerf_get_quick_tune and bladerf_schedule_retune . Do you think we could update the SoapySDR API to handle that? Or is there an easier way to access those methods?

I'm currently modifying the SoapySDR and SoapyBladeRF dlls, but I would rather not have to maintain my own version. Also that would impact all types of device and I'd need to rebuild all other dlls.

guruofquality commented 5 years ago

I think the path of least resistance is to use the tune args in the existing set frequency call to invoke bladerf_schedule_retune when a timestamp is passed.

KarlL2 commented 5 years ago

Actually there are several ways to use bladerf_schedule_retune:

In my tests I always called bladerf_schedule_retune with a timestamp of 0 to do it at once. Doing a normal tune takes 12-15ms, while a retune takes 0.4ms.

We could indeed pass data in args when calling setFrequency. Here are the possible cases I'm thinking of:

Note that the tune configuration may need to be updated as time passes:

These parameters are sensitive to changes in the operating environment, and should be "refreshed" if planning to use the "quick retune" functionality over a long period of time.

We could pass an additional argument forceTuneAfterSeconds=xxx to force a normal tune if the tune configuration is older than the specified number of seconds. After a forced normal tune, we would store the tune configuration for future reuse. This would again work only when scheduling at once.

We could also (instead?) use quickTune=true to either reuse an existing quick retune if any, or do a normal tune and store the quick tune configuration.

What do you think?

guruofquality commented 5 years ago

Sounds good overall. I don't think the forceTuneAfterSeconds hurts anything, its like a happy extra feature. Since the application could also manage the force tune if needed.

KarlL2 commented 5 years ago

Thanks. I'll look into it once I have time.

KarlL2 commented 2 years ago

Hi Josh,

I sent https://github.com/pothosware/SoapyBladeRF/pull/52 where you can pass the following arguments:

Note that I haven't done anything concerning forceTuneAfterSeconds as:

For now if you reach the max number of quick tunes, you can SoapySDRDevice_unmake then SoapySDRDevice_make your device again, which will reset things.

KarlL2 commented 2 years ago

@guruofquality I've fixed my PR (I had renamed but somehow missed to commit the updated definition). The PR now compiles fine and works well.