Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report the exact tuned frequency #524

Open
mossmann opened this issue Sep 26, 2018 · 3 comments
Open

report the exact tuned frequency #524

mossmann opened this issue Sep 26, 2018 · 3 comments
Labels
enhancement potential new feature software

Comments

@mossmann
Copy link
Member

mossmann commented Sep 26, 2018

When tuning to a user-requested frequency there is a small amount of error. We should provide a way, perhaps in a debug command-line tool, to retrieve the actual frequency the HackRF has actually tuned to (or equivalently the amount of error with respect to the user-requested frequency).

┆Issue is synchronized with this Basecamp todo by Unito

@mossmann mossmann added the enhancement potential new feature label Sep 26, 2018
@odrisci
Copy link

odrisci commented Oct 19, 2018

This would be very useful for GNSS (satnav) applications. I recently published a short paper on this here. I have some hacky code knocking about somewhere, I'll post a link here once I push it online

@Sasszem
Copy link
Contributor

Sasszem commented Mar 23, 2024

I see this issue is quite old. Is a solution planned for it?
I see there are PLL calculations for both frequency and sample rate, but none of those is accessible host-side.
We can copy the firmware code like in #1223, but the algorithm might change and we get the wrong results (altough sample rate calculation haven't changed in a decade, the tuning algorithm did).
I think another possible solution would be to add a new vendor request that requests the same calculation from the firmware. This would be future-proof, but would also be incompatible with all current devices & programs.

@martinling
Copy link
Member

martinling commented Mar 25, 2024

A new vendor request that gets the actual frequency from the firmware is definitely the right way to do this.

Software is going to have to be updated whatever we do, because there's currently no API in libhackrf for programs to get the actual frequency; they're going to have to call new functions.

For software that uses libhackrf via wrapper libraries like gr-osmosdr or SoapySDR, it would be sufficient to just update the wrappers, because they both provide their own APIs to retrieve the actual frequency (gr-osmosdr API, SoapySDR API). Once those wrappers are updated to use the new libhackrf API feature, they can just return the results via their own APIs, and programs that use them should just work accordingly.

I don't think it's a problem to require a firmware update for this feature to work. But if we wanted to, it may be possible to make it work with older firmware versions too.

We want to ensure that new firmware versions are free to change their tuning algorithm, but we don't expect old firmware versions to change theirs. So a way to do it would be to have libhackrf first read the firmware API version. In the case of a new-enough version, use the new vendor request, and in the case of an older version, run the same tuning calculation within libhackrf that was known to have been used in that version of the firmware, and return the predicted result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement potential new feature software
Projects
None yet
Development

No branches or pull requests

5 participants