JvanKatwijk / rtlsdr-emulator-sdrplay

rtlsdr emulator: How to run rtlsdr software with an SDRplay device (renewed for windows)
GNU General Public License v2.0
24 stars 5 forks source link

Error at set_ifgain GainUpdateError (45 3) #3

Open dirkbeer opened 4 years ago

dirkbeer commented 4 years ago

On a SDR2, Raspberry Pi 4 running Raspbian Buster, with SDRPlay API/HW Driver – v2.13 (20th Jun 2018), SDRPlay's rsp_tcp works.

However, using the emulator librtlsdr.so, I get Error at set_ifgain GainUpdateError (45 3):

pi@sdrpi:~ $ rtl_test Found 1 device(s): 0: sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220

name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Supported gain values (11): 0 100 200 250 300 350 400 450 500 550 6000.0 10.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode... Error at set_ifgain GainUpdateError (45 3) lost at least 3756891 bytes lost at least 3295992 bytes lost at least 3370282 bytes

dirkbeer commented 4 years ago

With debug info:

pi@sdrpi:~ $ rtl_test libusb: error [udev_hotplug_event] ignoring udev action bind Found 1 device(s): 0: sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220

name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Supported gain values (11): 0 100 200 250 300 350 400 450 500 550 6000.0 10.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode... StreamInit 45 2.048000 220.000000 1536 3 45 rtlsdr_read_async is started Error at set_ifgain GainUpdateError (45 3) lost at least 5277161 bytes lost at least 4704451 bytes lost at least 4651998 bytes ...

JvanKatwijk commented 4 years ago

Yes, I can reconstruct the error on my Linux box. Tomorrow I'll have some time to look at it. Interesting enough, there are no issues when using the lib for e.g. my own dab software

Op di 8 okt. 2019 om 20:53 schreef dirkbeer notifications@github.com:

With debug info:

pi@sdrpi:~ $ rtl_test libusb: error [udev_hotplug_event] ignoring udev action bind Found 1 device(s): 0: sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220

name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Supported gain values (11): 0 100 200 250 300 350 400 450 500 550 6000.0 10.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode... StreamInit 45 2.048000 220.000000 1536 3 45 rtlsdr_read_async is started Error at set_ifgain GainUpdateError (45 3) lost at least 5277161 bytes lost at least 4704451 bytes lost at least 4651998 bytes ...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/rtlsdr-emulator-sdrplay/issues/3?email_source=notifications&email_token=ACCPHQCERNBOJAHEVTTTQJDQNTJLXA5CNFSM4I574EJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAVHDNA#issuecomment-539652532, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCPHQD7U5Z3JBA5IGRMS4LQNTJLXANCNFSM4I574EJA .

-- Jan van Katwijk

JvanKatwijk commented 4 years ago

Two issues: a. the error message indicated that the gain setting came while the previous gain setting was not completed yet. The point where the gain setting was done did not actually need this gain setting. So that one can be removed. b. the function rtlsdr_set_testmode is not implemented, so the rtl_test program will return lots of lost samples. I do not know what the function does, probably returning the same value allover (zero's, -1?)

In the application(s) I had in mind for this simple wrapper there was no need for rtlsdr_set_testmode

Op di 8 okt. 2019 om 21:02 schreef jan van katwijk j.vankatwijk@gmail.com:

Yes, I can reconstruct the error on my Linux box. Tomorrow I'll have some time to look at it. Interesting enough, there are no issues when using the lib for e.g. my own dab software

Op di 8 okt. 2019 om 20:53 schreef dirkbeer notifications@github.com:

With debug info:

pi@sdrpi:~ $ rtl_test libusb: error [udev_hotplug_event] ignoring udev action bind Found 1 device(s): 0: sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220

name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Supported gain values (11): 0 100 200 250 300 350 400 450 500 550 6000.0 10.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 55.0 60.0 Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode... StreamInit 45 2.048000 220.000000 1536 3 45 rtlsdr_read_async is started Error at set_ifgain GainUpdateError (45 3) lost at least 5277161 bytes lost at least 4704451 bytes lost at least 4651998 bytes ...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/rtlsdr-emulator-sdrplay/issues/3?email_source=notifications&email_token=ACCPHQCERNBOJAHEVTTTQJDQNTJLXA5CNFSM4I574EJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAVHDNA#issuecomment-539652532, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCPHQD7U5Z3JBA5IGRMS4LQNTJLXANCNFSM4I574EJA .

-- Jan van Katwijk

-- Jan van Katwijk

dirkbeer commented 4 years ago

Ok, interesting. Thank you for your investigation, and for your work in creating this wrapper.

I don't care about rtl_test either, just thought that its output might be most diagnostic. My interest is in rtl_433. It currently produces the output shown below, but doesn't read data from my thermometer or alarm system (I tried with the antenna on input A or B). One possible explanation is a problem with the gain setting. Maybe this will be fixed by removing the second gain setting as you describe? Here is the output I get from it:

pi@sdrpi:~ $ rtl_433 -v rtl_433 version 19.08-24-g14c5b9a branch master at 201910071222 inputs file rtl_tcp RTL-SDR Use -h for usage help and see https://triq.org/ for documentation. Trying conf file at "rtl_433.conf"... Trying conf file at "/home/pi/.config/rtl_433/rtl_433.conf"... Trying conf file at "/usr/local/etc/rtl_433/rtl_433.conf"... Trying conf file at "/etc/rtl_433/rtl_433.conf"...

        Consider using "-M newmodel" to transition to new model keys. This will become the default someday.         A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.

Registering protocol [1] "Silvercrest Remote Control"

...

Registering protocol [140] "Elantra2012 TPMS" Registered 110 out of 140 device decoding protocols libusb: error [udev_hotplug_event] ignoring udev action bind Found 1 device(s)

trying device  0:  sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220 name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Sample rate set to 250000 S/s. Bit detection level set to 0 (Auto). Tuner gain set to Auto. Reading samples in async mode... Tuned to 433.920MHz. StreamInit 45 2.000000 433.920000 1536 3 45 rtlsdr_read_async is started Error at set_ifgain GainUpdateError (45 3) we got a signal 65 frequency request for 433920000

... when I press Ctrl-C:

^CSignal caught, exiting! cancel is called, running = 1 ^CSignal caught, exiting! cancel is called, running = 1

JvanKatwijk commented 4 years ago

Looks like an interesting project. I do not have rtl_433 related devices, but when running here with the rtl_433 executable on my Linux box, everything is quiet. Please do not forget to set the samplerate to 2000000, the wrapper maps the rates from 1 - 2 Mhz to 2 Mhz and up, but it does not do that for lower rates.

Furthermore, there is an issue with program termination: in the wrapper I assume that the caller provides for a separate thread to host the callbacks. If that is not the case - as with the rtl_test program and as far as I can see the rtl_433 program, normal termination will not work.

Op wo 9 okt. 2019 om 18:14 schreef dirkbeer notifications@github.com:

Ok, interesting. Thank you for your investigation, and for your work in creating this wrapper.

I don't care about rtl_test either, just thought that its output might be most diagnostic. My interest is in rtl_433. It currently produces the output shown below, but doesn't read data from my thermometer or alarm system (I tried with the antenna on input A or B). One possible explanation is a problem with the gain setting. Maybe this will be fixed by removing the second gain setting as you describe? Here is the output I get from it:

pi@sdrpi:~ $ rtl_433 -v rtl_433 version 19.08-24-g14c5b9a branch master at 201910071222 inputs file rtl_tcp RTL-SDR Use -h for usage help and see https://triq.org/ for documentation. Trying conf file at "rtl_433.conf"... Trying conf file at "/home/pi/.config/rtl_433/rtl_433.conf"... Trying conf file at "/usr/local/etc/rtl_433/rtl_433.conf"... Trying conf file at "/etc/rtl_433/rtl_433.conf"...

    Consider using "-M newmodel" to transition to new model keys. This

will become the default someday. A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.

Registering protocol [1] "Silvercrest Remote Control" ... Registering protocol [140] "Elantra2012 TPMS" Registered 110 out of 140 device decoding protocols libusb: error [udev_hotplug_event] ignoring udev action bind Found 1 device(s)

trying device 0: sdrplay.com, SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003, SN: 170802A220 name for 0-th device = SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Using device 0: SDRplay_RSPII_VID_1DF7&PID_3010_BUS_001_PORT_003 Sample rate set to 250000 S/s. Bit detection level set to 0 (Auto). Tuner gain set to Auto. Reading samples in async mode... Tuned to 433.920MHz. StreamInit 45 2.000000 433.920000 1536 3 45 rtlsdr_read_async is started Error at set_ifgain GainUpdateError (45 3) we got a signal 65 frequency request for 433920000

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/rtlsdr-emulator-sdrplay/issues/3?email_source=notifications&email_token=ACCPHQEJYB6CFACWBOFDASDQNX7ORA5CNFSM4I574EJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAYOADA#issuecomment-540073996, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCPHQDEDVNYQVJ6DF5WI2LQNX7ORANCNFSM4I574EJA .

-- Jan van Katwijk

bchieric commented 4 years ago

BUMP - I'm having this issue as well.

gvanem commented 3 years ago

Maybe this warning has something to do with it (from clang-cl):

gains.c(112,9): warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
        return RSP1_Table [3];
               ^           ~
gains.c(8,1): note: array 'RSP1_Table' declared here
static
^

I.e. returning random junk! (similarly for non-MinGW32?)

JvanKatwijk commented 3 years ago

That is a long time ago that I have seen that code, I'll have a look

Op za 1 mei 2021 om 13:36 schreef Gisle Vanem @.***>:

Maybe this warning has something to do with it (from clang-cl):

gains.c(112,9): warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds] return RSP1_Table [3]; ^ ~ gains.c(8,1): note: array 'RSP1_Table' declared here static ^

I.e. returning random junk! (similarly for non-MinGW32?)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JvanKatwijk/rtlsdr-emulator-sdrplay/issues/3#issuecomment-830618330, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCPHQG5FKSGX4D45H2RPJLTLPRUJANCNFSM4I574EJA .

-- Jan van Katwijk