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

Allow configuring arbitrary gain settings #546

Merged
merged 3 commits into from
Nov 11, 2021

Conversation

devicenull
Copy link
Contributor

This adds a "gain_settings" option to sources, which allows you to configure arbitrary gain stages by name. For example, to fix some of the RSP1A issues from #422:

"gain_settings": {
  "RFGR": 1,
  "IFGR": 25
 }

I am not a C developer, so uh.. you get to keep both pieces if this breaks. I did not remove any of the existing gain config settings - these will override anything set in this new array.

@robotastic
Copy link
Owner

This looks pretty good! The only thing I can think that is missing is that the gain values are not really saved anywhere in the source. I might add a little code that creates a vector of the gain values. This could be useful for sending the config of the Source off to somewhere else.

@devicenull
Copy link
Contributor Author

Great! It looks like this will also resolve #489 and possibly #290

@robotastic
Copy link
Owner

Ok - I have gone a bit off the deep end and I am reworking the whole gain section to be based on around this... Mostly just changes under the hood.

@devicenull
Copy link
Contributor Author

That looks pretty good to me! I guess at some point you'll want to remove the non-array config options there, but no real reason to break backwards compatibility now.

@robotastic
Copy link
Owner

Agreed - I am just keeping the old way around for compatibility, but it could all be moved to the settings array. Thanks for putting this together!!

@robotastic robotastic merged commit 865cd84 into robotastic:master Nov 11, 2021
@gisforgirard
Copy link
Contributor

gisforgirard commented Nov 12, 2021

just wanted to say, I tested it and appears to have fixed issues I was having with a bladeRF x40 where gains weren't being set properly, they appear to set perfectly fine now... the bladeRF 2.0 xA9 on the other hand, I think might be totally useless in its ability to set gains but that's their fault, not yours...

before:

[WARNING @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:1825] bladerf1_set_gain_stage: gain stage 'LNA' invalid
[WARNING @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:1869] bladerf1_get_gain_stage: gain stage 'LNA' invalid
[WARNING @ host/libraries/libbladeRF/src/board/bladerf1/bladerf1.c:1869] bladerf1_get_gain_stage: gain stage 'LNA' invalid
[2021-11-12 02:31:22.313465] (info) LNA Gain set to: 0

after (using gainSettings and lowercase "lna" plus the other two differently named gain settings):

FOUND lna
FOUND rxvga1
FOUND rxvga2
[2021-11-12 02:32:46.052332] (info) Gain Stage: system supported values: -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
[2021-11-12 02:32:46.052344] (info) Gain Stage: lna supported values: 0 3 6
[2021-11-12 02:32:46.052358] (info) Gain Stage: rxvga1 supported values: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
[2021-11-12 02:32:46.052366] (info) Gain Stage: rxvga2 supported values: 0 3 6 9 12 15 18 21 24 27 30
[2021-11-12 02:32:46.052821] (info) lna Gain set to: 3
[2021-11-12 02:32:46.053272] (info) rxvga1 Gain set to: 18
[2021-11-12 02:32:46.053705] (info) rxvga2 Gain set to: 21

no errors at all! nice!

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

Successfully merging this pull request may close these issues.

3 participants