C++ and RTL SDR RT820T2

Main forum to discuss RTL-SDR related topics.
Post Reply
MisterG
Posts: 3
Joined: Mon Apr 24, 2017 4:31 pm

C++ and RTL SDR RT820T2

Post by MisterG » Mon Apr 24, 2017 4:35 pm

Hi!
Ive purchased RTL SDR RT820T2 Dongle (with all the antennas i need) and i need to build a program in C++ to configure everything i want.
It's a project so i can't use simple programs to use the SDR .
I understand everything because im an Electrical Engineer in Communications but i have no experience with Drivers.
I know how to use C++ to create programs but i don't know how to use it to write what i need to configure the blocks of the SDR (Filters,IF frequency i want,Which demodulation type ETC)

I got into here :
http://wiki.spench.net/wiki/RTL2832U
but i'm not sure i understand enough.

Can someone help a little and explaine?

Thank you very much!

rtlsdrblog
Site Admin
Posts: 2563
Joined: Mon Nov 19, 2012 11:54 pm

Re: C++ and RTL SDR RT820T2

Post by rtlsdrblog » Tue Apr 25, 2017 9:17 am

What exactly is the end goal? I don't think your project would be to rewrite the drivers, it's probably asking you to implement some basic DSP code. Basically with an SDR you're getting raw ADC or IQ data coming in, and you need your DSP code to do something with it. You'd need to read a textbook on DSP principles to understand the maths. You can't just magically "set" the demodulation mode because there is no demodulator on the SDR, it's demodulated in your DSP code.

If it's really about the drivers then i'd suggest just looking through the driver code https://github.com/osmocom/rtl-sdr

MisterG
Posts: 3
Joined: Mon Apr 24, 2017 4:31 pm

Re: C++ and RTL SDR RT820T2

Post by MisterG » Tue Apr 25, 2017 12:26 pm

Ok i think by good probability that the right path is to implement DSP code.
about what you've wrote "You can't just magically "set" the demodulation mode because there is no demodulator on the SDR, it's demodulated in your DSP code."
there isn't any code that "creates" demodulator and the parameters can't be changed in the code?

Thanks!

MisterG
Posts: 3
Joined: Mon Apr 24, 2017 4:31 pm

Re: C++ and RTL SDR RT820T2

Post by MisterG » Tue Apr 25, 2017 5:58 pm

Ok ill ask my question in other way.
When i use GNU radio for example and i use blocks to demodulate the data into the original signal, is it the data that is already in my computer after it was sended by the USB ?

What are the ports that gain the I/Q samples in the C,which library and commands do i need to use in order to get this I/Q samples.

Thanks!

rtlsdrblog
Site Admin
Posts: 2563
Joined: Mon Nov 19, 2012 11:54 pm

Re: C++ and RTL SDR RT820T2

Post by rtlsdrblog » Thu Apr 27, 2017 11:08 am

Yep, when using blocks in GNU Radio the data is already in the PC. The blocks do nothing to the actual SDR hardware. Except for the source blog which is used to set the SDR gain and frequency.

You'll need to look at the code in well known examples like rtl_fm etc in order to understand how to interface with the driver and get and use the data.

hotpaw2
Posts: 127
Joined: Sat Jan 14, 2017 11:07 pm
Contact:

Re: C++ and RTL SDR RT820T2

Post by hotpaw2 » Sat May 06, 2017 6:47 pm

I wanted to write some basic SDR DSP code in C and in Swift, and without worrying about USB drivers, hardware chip register settings, and such. So I just installed and ran the rtl_tcp utility. The rtl_tcp utility is included as part of various RTL-SDR software distributions (on github, etc.), with ports available for linux, windows, macOS, and the raspberry pi.

The rtl_tcp utility connects to the RTL-SDR USB dongle, and presents the SDR IQ data as a simple stream of IQ bytes thru a TCP/IP network socket. Most competent C programmers know how to get data bytes in and out of a simple network socket. The rtl_tcp network protocol also supports some simple 5 byte commands to set the frequency, sample rate and gain, etc., of a USB RTL-SDR through the same network socket.

Post Reply