From jra at febo.com Fri Mar 2 14:46:41 2018 From: jra at febo.com (John Ackermann N8UR) Date: Fri, 2 Mar 2018 09:46:41 -0500 Subject: RTL-SDR sample bit depth Message-ID: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> Hi -- I'm trying to understand the sampling and decimation structure of the RTL-SDR dongle, to work out the effective number of bits after decimation. From Google and looking at the librtlsdr code (which is beyond my programming depth), I think I've figured out the following. I'd much appreciate verification/correction/amplification. 1. Actual ADC in the RTL-2832U is a single-bit sigma-delta running at some very high rate. 2. This is converted to 28.8 msps at 8 bit depth. 3. 28.8 msps is downsampled to the rate requested by the user and sent over the USB bus as 8 bit unsigned IQ pairs. Based on that, I *think*: a. Any processing gain in the downsample from 28.8 msps/8 bits within the chip is lost because the wire samples are limited to 8 bits. The output is 8 bits dynamic range regardless of the sample rate set. b. THEREFORE... for best dynamic range one wants to set the RTL-2832U to the highest sample rate that avoids lost samples, and do further decimation in the host processor, where the added bits aren't lost on the wire. I'd appreciate any verification or correction of that analysis. Thanks, John From jra at febo.com Sun Mar 4 15:15:05 2018 From: jra at febo.com (John Ackermann N8UR) Date: Sun, 4 Mar 2018 10:15:05 -0500 Subject: RTL-SDR sample bit depth In-Reply-To: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> Message-ID: <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> As a follow up to this, I've been doing testing with an RTL-SDR.com v3 dongle and Gnu Radio flowgraph. I set sample rate to 1.536 msps and the flowgraph decimates by 8 to yield 192 ksps, which is displayed on an FFT without further processing. Gain control is set to manual, and I step the RF gain between 0 and 50 dB for testing. I use a precision signal generator (HP 8642A calibrated with an HP power meter) as a signal source and test at 144 MHz. For an approximation of the minimum discernable signal (MDS) I adjust the signal generator amplitude until I see a noticeable signal that is consistently just above the noise. To find the overload point, I increase the amplitude until I see the first spur appear -- it's a very sudden transition, with a 1 dB amplitude increase triggering spurs many dB above the noise. Based on the assumptions in my earlier message, I would expect to see a dynamic range of about 59 dB (~50 dB from 8 bits at 1.536 Msps, plus 9 dB processing gain by the decimate-by-8). However, I'm seeing closer to 100 dB dynamic range -- for example, with the RF gain set to 20 dB, the MDS is -124 dBm and the overload level is 25 dBm. This tracks for various settings of the RF gain, though there seems to be a few dB of compression with gains above 30 dB. I'm trying to understand this discrepancy, which could be the result of: 1. Some AGC operation or gain compression in the R820T2 tuner chip; 2. My assumptions about the internal sample rate bit depth or decimation being wrong; or 3. My math being wrong (for example, is there a log10 vs. log20 error in my dB calculations, or is the dB scaling in the FFT showing voltage rather than power?). Any thoughts would be appreciated. Thanks, John ---- On 03/02/2018 09:46 AM, John Ackermann N8UR wrote: > Hi -- > > I'm trying to understand the sampling and decimation structure of the > RTL-SDR dongle, to work out the effective number of bits after decimation. > > From Google and looking at the librtlsdr code (which is beyond my > programming depth), I think I've figured out the following.? I'd much > appreciate verification/correction/amplification. > > 1.? Actual ADC in the RTL-2832U is a single-bit sigma-delta running at > some very high rate. > > 2.? This is converted to 28.8 msps at 8 bit depth. > > 3.? 28.8 msps is downsampled to the rate requested by the user and sent > over the USB bus as 8 bit unsigned IQ pairs. > > Based on that, I *think*: > > a.? Any processing gain in the downsample from 28.8 msps/8 bits within > the chip is lost because the wire samples are limited to 8 bits.? The > output is 8 bits dynamic range regardless of the sample rate set. > > b.? THEREFORE... for best dynamic range one wants to set the RTL-2832U > to the highest sample rate that avoids lost samples, and do further > decimation in the host processor, where the added bits aren't lost on > the wire. > > I'd appreciate any verification or correction of that analysis. > > Thanks, > John From leif at sm5bsz.com Sun Mar 4 16:56:27 2018 From: leif at sm5bsz.com (Leif Asbrink) Date: Sun, 4 Mar 2018 17:56:27 +0100 Subject: RTL-SDR sample bit depth In-Reply-To: <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> Message-ID: <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> Hi John, > For an approximation of the minimum discernable signal (MDS) I adjust > the signal generator amplitude until I see a noticeable signal that is > consistently just above the noise. To find the overload point, I > increase the amplitude until I see the first spur appear -- it's a very > sudden transition, with a 1 dB amplitude increase triggering spurs many > dB above the noise. > > Based on the assumptions in my earlier message, I would expect to see a > dynamic range of about 59 dB (~50 dB from 8 bits at 1.536 Msps, plus 9 > dB processing gain by the decimate-by-8). No, you are measuring noise in a much narrower bandwidth. "until I see a noticeable signal" implicates that you look at a spectrum of some kind. If I assume your bin resolution is 19.2 Hz you have another 40 dB higher dynamic range. You might be interested in this: http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtlsdr-03.40.htm > However, I'm seeing closer to 100 dB dynamic range -- for example, with > the RF gain set to 20 dB, the MDS is -124 dBm and the overload level is > 25 dBm. This tracks for various settings of the RF gain, though there > seems to be a few dB of compression with gains above 30 dB. MDS in what bandwidth? In amateur radio it is usually 500 Hz which, if you adhere to that means you found the noise floor at -151 dBm/Hz. That is 23 dB from room temperature (-174 dBm/Hz) so your noise figure would be 23 dB. With overload at -25 dBm (typo?) your range would be 126 dBm/Hz or 99 dB in a 500 Hz bandwidth. That is not really true however because you would have to measure the noise floor while there is a strong signal present and reciprocal mixing would set the limit. On the other hand, if the strong signal is at 90 MHz it would not reach the ADC so performance would be determined by the tuner chip. Regards Leif > > I'm trying to understand this discrepancy, which could be the result of: > > 1. Some AGC operation or gain compression in the R820T2 tuner chip; > > 2. My assumptions about the internal sample rate bit depth or > decimation being wrong; or > > 3. My math being wrong (for example, is there a log10 vs. log20 error > in my dB calculations, or is the dB scaling in the FFT showing voltage > rather than power?). > > Any thoughts would be appreciated. > > Thanks, > John > ---- > On 03/02/2018 09:46 AM, John Ackermann N8UR wrote: > > Hi -- > > > > I'm trying to understand the sampling and decimation structure of the > > RTL-SDR dongle, to work out the effective number of bits after decimation. > > > > From Google and looking at the librtlsdr code (which is beyond my > > programming depth), I think I've figured out the following.? I'd much > > appreciate verification/correction/amplification. > > > > 1.? Actual ADC in the RTL-2832U is a single-bit sigma-delta running at > > some very high rate. > > > > 2.? This is converted to 28.8 msps at 8 bit depth. > > > > 3.? 28.8 msps is downsampled to the rate requested by the user and sent > > over the USB bus as 8 bit unsigned IQ pairs. > > > > Based on that, I *think*: > > > > a.? Any processing gain in the downsample from 28.8 msps/8 bits within > > the chip is lost because the wire samples are limited to 8 bits.? The > > output is 8 bits dynamic range regardless of the sample rate set. > > > > b.? THEREFORE... for best dynamic range one wants to set the RTL-2832U > > to the highest sample rate that avoids lost samples, and do further > > decimation in the host processor, where the added bits aren't lost on > > the wire. > > > > I'd appreciate any verification or correction of that analysis. > > > > Thanks, > > John From jra at febo.com Sun Mar 4 22:14:47 2018 From: jra at febo.com (John Ackermann N8UR) Date: Sun, 4 Mar 2018 17:14:47 -0500 Subject: RTL-SDR sample bit depth In-Reply-To: <86c93a29-3f44-1dba-32ec-51294b939253@febo.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> <86c93a29-3f44-1dba-32ec-51294b939253@febo.com> Message-ID: Hi Leif -- Thanks for the reply, and for the pointer to your page!? I will look at that very closely. The purpose of my tests is for using dongles with the CW Skimmer software which takes an input bandwidth of 192 kHz. I'm looking at 192 kHz of spectrum in a 1024 bin FFT, so that's 187.5 Hz per bin.? Trying to understand what you said below, is it correct that I should view the bin width as the equivalent of the receive bandwidth for MDS purposes?? And that therefore there would be processing gain of about 30 dB (division by 1024)?? That would bring my measurements into the range of theory. For what it's worth, here's a link to an animation I did showing the abrupt onset of spurs when the ADC overload point is reached, in this case at -57 dBm with "rf gain" set to 37.2: https://www.dropbox.com/s/a788k0cj16mi7zr/dongle_overload.gif?dl=0. Thanks! 73, John ---- On 03/04/2018 11:56 AM, Leif Asbrink wrote: >> Hi John, >> >>> For an approximation of the minimum discernable signal (MDS) I adjust >>> the signal generator amplitude until I see a noticeable signal that is >>> consistently just above the noise.? To find the overload point, I >>> increase the amplitude until I see the first spur appear -- it's a very >>> sudden transition, with a 1 dB amplitude increase triggering spurs many >>> dB above the noise. >>> >>> Based on the assumptions in my earlier message, I would expect to see a >>> dynamic range of about 59 dB (~50 dB from 8 bits at 1.536 Msps, plus 9 >>> dB processing gain by the decimate-by-8). >> No, you are measuring noise in a much narrower bandwidth. >> "until I see a noticeable signal" implicates that you look at >> a spectrum of some kind. If I assume your bin resolution is >> 19.2 Hz you have another 40 dB higher dynamic range. >> You might be interested in this: >> http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtlsdr-03.40.htm >> >>> However, I'm seeing closer to 100 dB dynamic range -- for example, with >>> the RF gain set to 20 dB, the MDS is -124 dBm and the overload level is >>> 25 dBm.? This tracks for various settings of the RF gain, though there >>> seems to be a few dB of compression with gains above 30 dB. >> MDS in what bandwidth? In amateur radio it is usually 500 Hz >> which, if you adhere to that means you found the noise floor >> at -151 dBm/Hz. That is 23 dB from room temperature (-174 dBm/Hz) >> so your noise figure would be 23 dB. >> >> With overload at -25 dBm (typo?) your range would be 126 dBm/Hz >> or 99 dB in a 500 Hz bandwidth. That is not really true however >> because you would have to measure the noise floor while there >> is a strong signal present and reciprocal mixing would set the >> limit. On the other hand, if the strong signal is at 90 MHz >> it would not reach the ADC so performance would be determined by >> the tuner chip. >> >> >> Regards >> >> Leif >> >> >> >>> >>> I'm trying to understand this discrepancy, which could be the result of: >>> >>> 1.? Some AGC operation or gain compression in the R820T2 tuner chip; >>> >>> 2.? My assumptions about the internal sample rate bit depth or >>> decimation being wrong; or >>> >>> 3.? My math being wrong (for example, is there a log10 vs. log20 error >>> in my dB calculations, or is the dB scaling in the FFT showing voltage >>> rather than power?). >>> >>> Any thoughts would be appreciated. >>> >>> Thanks, >>> John >>> ---- >>> On 03/02/2018 09:46 AM, John Ackermann N8UR wrote: >>>> Hi -- >>>> >>>> I'm trying to understand the sampling and decimation structure of the >>>> RTL-SDR dongle, to work out the effective number of bits after >>>> decimation. >>>> >>>> ? From Google and looking at the librtlsdr code (which is beyond my >>>> programming depth), I think I've figured out the following.? I'd much >>>> appreciate verification/correction/amplification. >>>> >>>> 1.? Actual ADC in the RTL-2832U is a single-bit sigma-delta running at >>>> some very high rate. >>>> >>>> 2.? This is converted to 28.8 msps at 8 bit depth. >>>> >>>> 3.? 28.8 msps is downsampled to the rate requested by the user and sent >>>> over the USB bus as 8 bit unsigned IQ pairs. >>>> >>>> Based on that, I *think*: >>>> >>>> a.? Any processing gain in the downsample from 28.8 msps/8 bits within >>>> the chip is lost because the wire samples are limited to 8 bits.? The >>>> output is 8 bits dynamic range regardless of the sample rate set. >>>> >>>> b.? THEREFORE... for best dynamic range one wants to set the RTL-2832U >>>> to the highest sample rate that avoids lost samples, and do further >>>> decimation in the host processor, where the added bits aren't lost on >>>> the wire. >>>> >>>> I'd appreciate any verification or correction of that analysis. >>>> >>>> Thanks, >>>> John From jra at febo.com Sun Mar 4 22:26:01 2018 From: jra at febo.com (John Ackermann N8UR) Date: Sun, 4 Mar 2018 17:26:01 -0500 Subject: RTL-SDR sample bit depth In-Reply-To: <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> Message-ID: Leif, one other question... how do you use a noise figure meter to measure an SDR? I have an HP 8970A with noise head available, but haven't figured out how to do a measurement where there's no RF output to connect the meter to. Thanks, John ---- On 03/04/2018 11:56 AM, Leif Asbrink wrote: > Hi John, > >> For an approximation of the minimum discernable signal (MDS) I adjust >> the signal generator amplitude until I see a noticeable signal that is >> consistently just above the noise. To find the overload point, I >> increase the amplitude until I see the first spur appear -- it's a very >> sudden transition, with a 1 dB amplitude increase triggering spurs many >> dB above the noise. >> >> Based on the assumptions in my earlier message, I would expect to see a >> dynamic range of about 59 dB (~50 dB from 8 bits at 1.536 Msps, plus 9 >> dB processing gain by the decimate-by-8). > No, you are measuring noise in a much narrower bandwidth. > "until I see a noticeable signal" implicates that you look at > a spectrum of some kind. If I assume your bin resolution is > 19.2 Hz you have another 40 dB higher dynamic range. > You might be interested in this: > http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtlsdr-03.40.htm > >> However, I'm seeing closer to 100 dB dynamic range -- for example, with >> the RF gain set to 20 dB, the MDS is -124 dBm and the overload level is >> 25 dBm. This tracks for various settings of the RF gain, though there >> seems to be a few dB of compression with gains above 30 dB. > MDS in what bandwidth? In amateur radio it is usually 500 Hz > which, if you adhere to that means you found the noise floor > at -151 dBm/Hz. That is 23 dB from room temperature (-174 dBm/Hz) > so your noise figure would be 23 dB. > > With overload at -25 dBm (typo?) your range would be 126 dBm/Hz > or 99 dB in a 500 Hz bandwidth. That is not really true however > because you would have to measure the noise floor while there > is a strong signal present and reciprocal mixing would set the > limit. On the other hand, if the strong signal is at 90 MHz > it would not reach the ADC so performance would be determined by > the tuner chip. > > > Regards > > Leif > > > > >> >> I'm trying to understand this discrepancy, which could be the result of: >> >> 1. Some AGC operation or gain compression in the R820T2 tuner chip; >> >> 2. My assumptions about the internal sample rate bit depth or >> decimation being wrong; or >> >> 3. My math being wrong (for example, is there a log10 vs. log20 error >> in my dB calculations, or is the dB scaling in the FFT showing voltage >> rather than power?). >> >> Any thoughts would be appreciated. >> >> Thanks, >> John >> ---- >> On 03/02/2018 09:46 AM, John Ackermann N8UR wrote: >>> Hi -- >>> >>> I'm trying to understand the sampling and decimation structure of the >>> RTL-SDR dongle, to work out the effective number of bits after decimation. >>> >>> From Google and looking at the librtlsdr code (which is beyond my >>> programming depth), I think I've figured out the following.? I'd much >>> appreciate verification/correction/amplification. >>> >>> 1.? Actual ADC in the RTL-2832U is a single-bit sigma-delta running at >>> some very high rate. >>> >>> 2.? This is converted to 28.8 msps at 8 bit depth. >>> >>> 3.? 28.8 msps is downsampled to the rate requested by the user and sent >>> over the USB bus as 8 bit unsigned IQ pairs. >>> >>> Based on that, I *think*: >>> >>> a.? Any processing gain in the downsample from 28.8 msps/8 bits within >>> the chip is lost because the wire samples are limited to 8 bits.? The >>> output is 8 bits dynamic range regardless of the sample rate set. >>> >>> b.? THEREFORE... for best dynamic range one wants to set the RTL-2832U >>> to the highest sample rate that avoids lost samples, and do further >>> decimation in the host processor, where the added bits aren't lost on >>> the wire. >>> >>> I'd appreciate any verification or correction of that analysis. >>> >>> Thanks, >>> John From leif at sm5bsz.com Mon Mar 5 09:27:05 2018 From: leif at sm5bsz.com (Leif Asbrink) Date: Mon, 5 Mar 2018 10:27:05 +0100 Subject: RTL-SDR sample bit depth In-Reply-To: References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> <86c93a29-3f44-1dba-32ec-51294b939253@febo.com> Message-ID: <20180305102705.4beb6a055aa2d989f0422dc4@sm5bsz.com> Hello John, > I'm looking at 192 kHz of spectrum in a 1024 bin FFT, so that's 187.5 Hz > per bin.? Trying to understand what you said below, is it correct that I > should view the bin width as the equivalent of the receive bandwidth for > MDS purposes? This would be the case if the FFT is un-windowed which it is probably not. A window function will make the data points go towards zero at the ends of the data block. Have a look here: http://www.sm5bsz.com/slfft/slfft.htm The filter function that each fft bin represents can be obtained by computing the FFT of the window function. If you do not know it, you might guess that it is 300 Hz or so. A better strategy is to select for example SSB mode with a filter bandwidth of 1 kHz. Then measure the noise level within the passband. Many SDR software have a true RMS detector that would allow precise measurements. 73 Leif From leif at sm5bsz.com Mon Mar 5 10:21:36 2018 From: leif at sm5bsz.com (Leif Asbrink) Date: Mon, 5 Mar 2018 11:21:36 +0100 Subject: RTL-SDR sample bit depth In-Reply-To: References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> Message-ID: <20180305112136.e7a7a697de83cb123505670d@sm5bsz.com> Hi again John, > Leif, one other question... how do you use a noise figure meter to > measure an SDR? I have an HP 8970A with noise head available, but > haven't figured out how to do a measurement where there's no RF output > to connect the meter to. You could open the unit and connect the signal that goes to the A/D converter to the NF meter. Not very practical and probably very difficult because of spurs. You can use the noise head and your SDR program to measure power over the widest spur free frequency range you can find. Just use the SDR to measure by how many dB the noise floor changes when you switch the noise head on and off. That is exactly what the NF meter is doing although it makes several more things to compensate for the noise it generates itself which is important if you measure low gain amplifiers. Now, you do not want those complications because you want to measure the system NF of the entire SDR. What you have is like figure 3 here: https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_application/application_notes/1ma178/1MA178_2e_NoiseFigure.pdf Your SDR is a spectrum analyzer and the power difference you observe is the Y-factor in dB. Convert it to linear power scale and use equation 12 in the document. In case the NF of your SDR would be very near 0 dB you would find the difference that you measure equal to the excess noise you can read on the noise head. 73 Leif From jra at febo.com Mon Mar 5 14:43:54 2018 From: jra at febo.com (John Ackermann N8UR) Date: Mon, 5 Mar 2018 09:43:54 -0500 Subject: RTL-SDR sample bit depth In-Reply-To: <20180305112136.e7a7a697de83cb123505670d@sm5bsz.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> <20180305112136.e7a7a697de83cb123505670d@sm5bsz.com> Message-ID: <70c48683-9dd1-1505-8ca4-60191d46dd75@febo.com> Leif, thanks much for the informative replies. Some of the pieces are beginning to connect for me, and I'm going to go back and do some further measurements, including with the noise head. In the past, I'd set up a Gnu Radio flowgraph that was in effect a channel power meter. I will go back and use that to test the noise floor in various bandwidths. I'll also try using the noise head to measure NF as you described. Thanks! John ---- On 03/05/2018 05:21 AM, Leif Asbrink wrote: > Hi again John, > >> Leif, one other question... how do you use a noise figure meter to >> measure an SDR? I have an HP 8970A with noise head available, but >> haven't figured out how to do a measurement where there's no RF output >> to connect the meter to. > You could open the unit and connect the signal that goes to > the A/D converter to the NF meter. Not very practical and > probably very difficult because of spurs. > > You can use the noise head and your SDR program to measure > power over the widest spur free frequency range you can > find. > > Just use the SDR to measure by how many dB the noise floor > changes when you switch the noise head on and off. That > is exactly what the NF meter is doing although it makes > several more things to compensate for the noise it generates > itself which is important if you measure low gain amplifiers. > Now, you do not want those complications because you want to > measure the system NF of the entire SDR. > > What you have is like figure 3 here: > https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_application/application_notes/1ma178/1MA178_2e_NoiseFigure.pdf > > Your SDR is a spectrum analyzer and the power difference > you observe is the Y-factor in dB. Convert it to linear > power scale and use equation 12 in the document. > > In case the NF of your SDR would be very near 0 dB you > would find the difference that you measure equal to the > excess noise you can read on the noise head. > > 73 > > Leif > From daleranta at icloud.com Mon Mar 5 17:02:18 2018 From: daleranta at icloud.com (dale ranta) Date: Mon, 05 Mar 2018 09:02:18 -0800 Subject: drop in replacement for nonfunctioning "discover_netsdr" Message-ID: The module ?discover_netsdr? in ?rfspace_source_c.cc? failed everywhere that I tried it, except for MacOS 10.6. Here is a drop in replacement that was tested and found to work on 10.6, 10.11, 10.12, 10.13 and ubuntu 16.04 LTS. #include #include class interfaceInformation{ public: std::string name; std::string address; std::string broadcast; }; std::vector interfaceList(); static std::vector < unit_t > discover_netsdr() { std::vector < unit_t > units; std::vector list=interfaceList(); for(int pass=0;pass<2;++pass){ for(size_t n=0;n> 8; tx_msg.key[0] = KEY0; tx_msg.key[1] = KEY1; tx_msg.op = MSG_REQ; sendto(sockTx, &tx_msg, sizeof(tx_msg), 0, (struct sockaddr *)&peer_sa, sizeof(peer_sa)); sendto(sockTx, &tx_msg, sizeof(tx_msg), 0, (struct sockaddr *)&peer_sa2, sizeof(peer_sa2)); while ( 1 ) { size_t rx_bytes = 0; unsigned char data[1024*2]; socklen_t addrlen = sizeof(host_sa); /* length of addresses */ int nbytes = recvfrom(sockRx, data, sizeof(data), 0, (struct sockaddr *)&host_sa, &addrlen); if ( nbytes <= 0 ) break; rx_bytes = nbytes; if ( rx_bytes >= sizeof(discover_common_msg_t) ) { discover_common_msg_t *rx_msg = (discover_common_msg_t *)data; if ( KEY0 == rx_msg->key[0] && KEY1 == rx_msg->key[1] && MSG_RESP == rx_msg->op ) { void *temp = rx_msg->port; uint16_t port = *((uint16_t *)temp); std::stringstream buffer; buffer << int(rx_msg->ipaddr[3]) << "." << int(rx_msg->ipaddr[2]) << "." << int(rx_msg->ipaddr[1]) << "." << int(rx_msg->ipaddr[0]); std::string addr=buffer.str(); //std::cout << "addr " << addr << std::endl; unit_t unit; unit.name = rx_msg->name; unit.sn = rx_msg->sn; unit.addr = addr; unit.port = port; units.push_back( unit ); } } } close(sockTx); close(sockRx); } } return units; } std::vector interfaceList() { std::vector list; interfaceInformation c1; struct ifaddrs *addrs,*iloop; char buf[64],buf2[64]; struct sockaddr_in *s4; getifaddrs(&addrs); for (iloop = addrs; iloop != NULL; iloop = iloop->ifa_next) { s4 = (struct sockaddr_in *)(iloop->ifa_addr); buf[0]=0; if(s4){ inet_ntop(iloop->ifa_addr->sa_family, (void *)&(s4->sin_addr), buf, sizeof(buf)); }else{ continue; } s4 = (struct sockaddr_in *)(iloop->ifa_dstaddr); buf2[0]=0; if(s4){ inet_ntop(iloop->ifa_dstaddr->sa_family, (void *)&(s4->sin_addr), buf2, sizeof(buf2)); }else{ continue; } if(!(iloop->ifa_flags & IFF_UP) || !(iloop->ifa_flags & IFF_BROADCAST))continue; c1.name = iloop->ifa_name; c1.address = buf; c1.broadcast = buf2; list.push_back(c1); } freeifaddrs(addrs); return list; } From mary at lpantenna.com Wed Mar 14 10:51:21 2018 From: mary at lpantenna.com (mary) Date: Wed, 14 Mar 2018 18:51:21 +0800 Subject: antenna enquiry/long praise inc Message-ID: <211e6c27309ada5f825e5981a96b9557@172.17.104.172> An HTML attachment was scrubbed... URL: From jra at febo.com Sun Mar 4 22:09:57 2018 From: jra at febo.com (John Ackermann N8UR) Date: Sun, 4 Mar 2018 17:09:57 -0500 Subject: RTL-SDR sample bit depth In-Reply-To: <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> References: <71a6c1b0-161c-9e38-6917-68a45e858533@febo.com> <8579f2b7-161c-829e-281c-f90a6a9797ed@febo.com> <20180304175627.3d09da931901f8a6e5033e6e@sm5bsz.com> Message-ID: <86c93a29-3f44-1dba-32ec-51294b939253@febo.com> Hi Leif -- Thanks for the reply, and for the pointer to your page! I will look at that very closely. The purpose of my tests is for using dongles with the CW Skimmer software which takes an input bandwidth of 192 kHz. I'm looking at 192 kHz of spectrum in a 1024 bin FFT, so that's 187.5 Hz per bin. Trying to understand what you said below, is it correct that I should view the bin width as the equivalent of the receive bandwidth for MDS purposes? And that therefore there would be processing gain of about 30 dB (division by 1024)? That would bring my measurements into the range of theory. For what it's worth, attached is an animation I did showing the abrupt onset of spurs when the ADC overload point is reached, in this case at -57 dBm with "rf gain" set to 37.2. (If the listserv deletes this, let me know and I'll send it to you privately.) Thanks! 73, John ---- On 03/04/2018 11:56 AM, Leif Asbrink wrote: > Hi John, > >> For an approximation of the minimum discernable signal (MDS) I adjust >> the signal generator amplitude until I see a noticeable signal that is >> consistently just above the noise. To find the overload point, I >> increase the amplitude until I see the first spur appear -- it's a very >> sudden transition, with a 1 dB amplitude increase triggering spurs many >> dB above the noise. >> >> Based on the assumptions in my earlier message, I would expect to see a >> dynamic range of about 59 dB (~50 dB from 8 bits at 1.536 Msps, plus 9 >> dB processing gain by the decimate-by-8). > No, you are measuring noise in a much narrower bandwidth. > "until I see a noticeable signal" implicates that you look at > a spectrum of some kind. If I assume your bin resolution is > 19.2 Hz you have another 40 dB higher dynamic range. > You might be interested in this: > http://www.sm5bsz.com/linuxdsp/hware/rtlsdr/rtlsdr-03.40.htm > >> However, I'm seeing closer to 100 dB dynamic range -- for example, with >> the RF gain set to 20 dB, the MDS is -124 dBm and the overload level is >> 25 dBm. This tracks for various settings of the RF gain, though there >> seems to be a few dB of compression with gains above 30 dB. > MDS in what bandwidth? In amateur radio it is usually 500 Hz > which, if you adhere to that means you found the noise floor > at -151 dBm/Hz. That is 23 dB from room temperature (-174 dBm/Hz) > so your noise figure would be 23 dB. > > With overload at -25 dBm (typo?) your range would be 126 dBm/Hz > or 99 dB in a 500 Hz bandwidth. That is not really true however > because you would have to measure the noise floor while there > is a strong signal present and reciprocal mixing would set the > limit. On the other hand, if the strong signal is at 90 MHz > it would not reach the ADC so performance would be determined by > the tuner chip. > > > Regards > > Leif > > > > >> >> I'm trying to understand this discrepancy, which could be the result of: >> >> 1. Some AGC operation or gain compression in the R820T2 tuner chip; >> >> 2. My assumptions about the internal sample rate bit depth or >> decimation being wrong; or >> >> 3. My math being wrong (for example, is there a log10 vs. log20 error >> in my dB calculations, or is the dB scaling in the FFT showing voltage >> rather than power?). >> >> Any thoughts would be appreciated. >> >> Thanks, >> John >> ---- >> On 03/02/2018 09:46 AM, John Ackermann N8UR wrote: >>> Hi -- >>> >>> I'm trying to understand the sampling and decimation structure of the >>> RTL-SDR dongle, to work out the effective number of bits after decimation. >>> >>> From Google and looking at the librtlsdr code (which is beyond my >>> programming depth), I think I've figured out the following.? I'd much >>> appreciate verification/correction/amplification. >>> >>> 1.? Actual ADC in the RTL-2832U is a single-bit sigma-delta running at >>> some very high rate. >>> >>> 2.? This is converted to 28.8 msps at 8 bit depth. >>> >>> 3.? 28.8 msps is downsampled to the rate requested by the user and sent >>> over the USB bus as 8 bit unsigned IQ pairs. >>> >>> Based on that, I *think*: >>> >>> a.? Any processing gain in the downsample from 28.8 msps/8 bits within >>> the chip is lost because the wire samples are limited to 8 bits.? The >>> output is 8 bits dynamic range regardless of the sample rate set. >>> >>> b.? THEREFORE... for best dynamic range one wants to set the RTL-2832U >>> to the highest sample rate that avoids lost samples, and do further >>> decimation in the host processor, where the added bits aren't lost on >>> the wire. >>> >>> I'd appreciate any verification or correction of that analysis. >>> >>> Thanks, >>> John -------------- next part -------------- A non-text attachment was scrubbed... Name: dongle_overload.gif Type: image/gif Size: 629909 bytes Desc: not available URL: From theodric at mit.edu Wed Mar 14 19:57:55 2018 From: theodric at mit.edu (Theodric Young) Date: Wed, 14 Mar 2018 15:57:55 -0400 Subject: Meaning of rtl_fm output values Message-ID: Hi, I'm new to SDR and I have a question about the data values that are generated by the rtl_fm program. I got rtl_fm running on my system (cygwin running on Windows 7). It is sending a stream of 16-bit signed integer values to stdout which I can redirect to a file or pipe to an audio playback system, such as sox. So when I do this: rtl_fm -f 88.1M -M wbfm -s 240k -r120k -g 30 | play -t raw -r 120k -b 16 -c 1 -e s -V1 - I hear sweet, sweet music! Hurray! But how do these 16-bit integers relate to the modulation level of the carrier? I'm assuming that the values are directly proportional to the instantaneous frequency deviation of the transmitted signal. Is that right? If so, how do I determine that ratio? I'm hoping to use this to build a device that shows total modulation (as a percentage of the maximum modulation of +/- 75kHz) for an FM radio station. Also, I'm assuming that the sample-rate of the output data stream needs to be at least 120kHz because the baseband signal includes the stereo pilot (19kHz), the stereo subcarrier (38kHz) and an RBDS subcarrier (57 kHz). Any insight would be appreciated. Thanks in advance, Theodric Young From mueller at kit.edu Wed Mar 14 20:10:43 2018 From: mueller at kit.edu (=?utf-8?B?TcO8bGxlciwgTWFyY3VzIChDRUwp?=) Date: Wed, 14 Mar 2018 20:10:43 +0000 Subject: Meaning of rtl_fm output values In-Reply-To: References: Message-ID: <1521058241.14399.223.camel@kit.edu> Hi Theodric, no, these values that appear on stdout are already audio samples (PCM to be specific). That is the "job" of rtl_fm: It takes the complex time-domain baseband samples from the hardware, detects FM (which implies detecting a frequency deviation) and convert that to audio amplitude values. The `aplay` command barely takes these samples and hands them over to the sound card (after resampling to fit possible sampling rates, I guess, as 120 kHz isn't something that sound systems usually operate at). The `rtl_fm` command takes a couple of parameters. In your case, `-M wbfm` means that it's demodulating FM in a way compatible to broadcast FM; that implies fixed parameters for deviation, emphasis etc. What you want is really not `rtl_fm`, which primarily is a demo program, not meant to be a flexible do-it-all solution. What you want, showing deviation of a station, does very much sound like a spectrum visualization. Wouldn't a waterfall or even just an instantaneous spectrum visualization be what you want? Best regards, Marcus On Wed, 2018-03-14 at 15:57 -0400, Theodric Young wrote: > Hi, > > I'm new to SDR and I have a question about the data values that are > generated by the rtl_fm program. > > I got rtl_fm running on my system (cygwin running on Windows 7). It is > sending a stream of 16-bit signed integer values to stdout which I can > redirect to a file or pipe to an audio playback system, such as sox. So > when I do this: > > rtl_fm -f 88.1M -M wbfm -s 240k -r120k -g 30 | play -t raw -r 120k -b > 16 -c 1 -e s -V1 - > > I hear sweet, sweet music! Hurray! > > But how do these 16-bit integers relate to the modulation level of the > carrier? I'm assuming that the values are directly proportional to the > instantaneous frequency deviation of the transmitted signal. Is that > right? If so, how do I determine that ratio? I'm hoping to use this to > build a device that shows total modulation (as a percentage of the > maximum modulation of +/- 75kHz) for an FM radio station. > > Also, I'm assuming that the sample-rate of the output data stream needs > to be at least 120kHz because the baseband signal includes the stereo > pilot (19kHz), the stereo subcarrier (38kHz) and an RBDS subcarrier (57 > kHz). > > Any insight would be appreciated. Thanks in advance, > > Theodric Young -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6582 bytes Desc: not available URL: