diff --git a/img/antenna-picture.jpg b/img/antenna-picture.jpg deleted file mode 100644 index c2d2baab6..000000000 Binary files a/img/antenna-picture.jpg and /dev/null differ diff --git a/img/antenna-schematic.png b/img/antenna-schematic.png deleted file mode 100644 index eb56e6d50..000000000 Binary files a/img/antenna-schematic.png and /dev/null differ diff --git a/img/antenna.png b/img/antenna.png new file mode 100644 index 000000000..f39d9c728 Binary files /dev/null and b/img/antenna.png differ diff --git a/img/sdr-receiver.png b/img/sdr-receiver.png deleted file mode 100644 index 51bdbff0d..000000000 Binary files a/img/sdr-receiver.png and /dev/null differ diff --git a/img/sdr-smem.png b/img/sdr-smem.png new file mode 100644 index 000000000..cec788d31 Binary files /dev/null and b/img/sdr-smem.png differ diff --git a/index.md b/index.md index 29d7bdab5..75a27bbec 100644 --- a/index.md +++ b/index.md @@ -26,6 +26,7 @@ layout: default 1. [Scanning system]({{ "/scanner/" | prepend: site.baseurl }}) 1. [Vector Network Analyzer]({{ "/vna/" | prepend: site.baseurl }}) 1. Applications for Red Pitaya STEMlab 122.88-16 SDR and SDRlab 122-16: + 1. [SDR receiver]({{ "/sdr-receiver-122-88/" | prepend: site.baseurl }}) 1. [SDR transceiver]({{ "/sdr-transceiver-122-88/" | prepend: site.baseurl }}) 1. [SDR transceiver compatible with HPSDR]({{ "/sdr-transceiver-hpsdr-122-88/" | prepend: site.baseurl }}) 1. [SDR receiver compatible with HPSDR]({{ "/sdr-receiver-hpsdr-122-88/" | prepend: site.baseurl }}) diff --git a/sdr-receiver-122-88.md b/sdr-receiver-122-88.md new file mode 100644 index 000000000..0c821014e --- /dev/null +++ b/sdr-receiver-122-88.md @@ -0,0 +1,96 @@ +--- +layout: page +title: SDR receiver +permalink: /sdr-receiver-122-88/ +--- + +Hardware +----- + +The FPGA configuration consists of sixteen identical digital down-converters (DDC). Their structure is shown on the following diagram: + +![SDR receiver]({{ "/img/sdr-transceiver-hpsdr-ddc-122-88.png" | prepend: site.baseurl }}) + +The I/Q data rate is configurable and four settings are available: 48, 96, 192, 384 kSPS. + +The tunable frequency range covers from 0 Hz to 490 MHz. + +The [projects/sdr_receiver_122_88](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver_122_88) directory contains two Tcl files: [block_design.tcl](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver_122_88/block_design.tcl), [rx.tcl](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver_122_88/rx.tcl). The code in these files instantiates, configures and interconnects all the needed IP cores. + +The [projects/sdr_receiver_122_88/filters](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver_122_88/filters) directory contains the source code of the [R](https://www.r-project.org) scripts used to calculate the coefficients of the FIR filters. + +Software +----- + +The [projects/sdr_receiver_122_88/server](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver_122_88/server) directory contains the source code of the TCP server ([sdr-receiver.c](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver_122_88/server/sdr-receiver.c)) that receives control commands and transmits the I/Q data streams to the SDR programs. + +The [SDR SMEM](https://github.com/pavel-demin/sdr-smem) repository contains the source code of the TCP client ([tcp_smem.lpr](https://github.com/pavel-demin/sdr-smem/blob/main/tcp_smem.lpr)), ExtIO plug-in ([extio_smem.lpr](https://github.com/pavel-demin/sdr-smem/blob/main/extio_smem.lpr)) and other programs and plug-ins. The following diagram shows an example of how these programs and plug-ins can be used: + +![SDR SMEM]({{ "/img/sdr-smem.png" | prepend: site.baseurl }}) + +The `tcp_smem` program runs on a computer. It receives the I/Q data streams over the network and transfers them to other programs and plugins via shared memory. + +Antenna +----- + +I use simple indoor antennas made from a single loop of non-coaxial wire. Their approximate scheme is shown on the following diagrams: + +![Antenna]({{ "/img/antenna.png" | prepend: site.baseurl }}) + +Getting started +----- + + - Connect an antenna to the IN1 connector on the Red Pitaya board. + - Download [SD card image zip file]({{ site.release-image }}) (more details about the SD card image can be found at [this link]({{ "/alpine/" | prepend: site.baseurl }})). + - Copy the contents of the SD card image zip file to a micro SD card. + - Optionally, to start the application automatically at boot time, copy its `start.sh` file from `apps/sdr_receiver_122_88` to the topmost directory on the SD card. + - Install the micro SD card in the Red Pitaya board and connect the power. + - Download and install [SDR#](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AAAdAcU238cppWziK4xPRIADa/sdr/sdrsharp_v1.0.0.1361_with_plugins.zip?dl=1) or [HDSDR](https://www.hdsdr.de). + - Download and unpack the [SDR SMEM zip file]({{ site.sdr-smem-file }}). + - Copy `extio_smem.dll` into the SDR# or HDSDR installation directory. + - Start SDR# or HDSDR. + - Select SMEM from the Source list in SDR# or from the Options [F7] → Select Input menu in HDSDR. + - Press Configure icon in SDR# or press ExtIO button in HDSDR, then enter the IP address of the Red Pitaya board. + - Press Play icon in SDR# or press Start [F2] button in HDSDR. + +Running CW Skimmer Server and Reverse Beacon Network Aggregator +----- + + - Install [CW Skimmer Server](https://dxatlas.com/skimserver). + - Download and unpack the [SDR SMEM zip file]({{ site.sdr-smem-file }}). + - Make a copy of the `tcp_smem.exe` program and rename the copy to `tcp_smem_1.exe`. + - Start `tcp_smem.exe` and `tcp_smem_1.exe`, enter the IP addresses of the Red Pitaya board and press the Connect button. + - Copy `intf_smem.dll` to the CW Skimmer Server program directory (`C:\Program Files (x86)\Afreet\SkimSrv`). + - Make a copy of the `SkimSrv` directory and rename the copy to `SkimSrv2`. + - In the `SkimSrv2` directory, rename `SkimSrv.exe` to `SkimSrv2.exe` and rename `intf_smem.dll` to `intf_smem_1.dll`. + - Install [Reverse Beacon Network Aggregator](https://www.reversebeacon.net/pages/Aggregator+34). + - Start `SkimSrv.exe` and `SkimSrv2.exe`, configure frequencies and your call sign. + - Start Reverse Beacon Network Aggregator. + +Building from source +----- + +The installation of the development machine is described at [this link]({{ "/development-machine/" | prepend: site.baseurl }}). + +The structure of the source code and of the development chain is described at [this link]({{ "/led-blinker/" | prepend: site.baseurl }}). + +Setting up the Vitis and Vivado environment: +{% highlight bash %} +source /opt/Xilinx/Vitis/2023.1/settings64.sh +{% endhighlight %} + +Cloning the source code repository: +{% highlight bash %} +git clone https://github.com/pavel-demin/red-pitaya-notes +cd red-pitaya-notes +{% endhighlight %} + +Building `sdr_receiver.bit`: +{% highlight bash %} +make NAME=sdr_receiver bit +{% endhighlight %} + +Building SD card image zip file: +{% highlight bash %} +source helpers/build-all.sh +{% endhighlight %} diff --git a/sdr-receiver.md b/sdr-receiver.md index 54c891464..e06906f20 100644 --- a/sdr-receiver.md +++ b/sdr-receiver.md @@ -15,119 +15,66 @@ Some interesting links on digital signal processing and software defined radio: - [GNU Radio - Suggested Reading](https://wiki.gnuradio.org/index.php/SuggestedReading) -Short description +Hardware ----- -The implementation of the SDR receiver is quite straightforward: +The FPGA configuration consists of eight identical digital down-converters (DDC). Their structure is shown on the following diagram: - - An antenna is connected to one of the high-impedance analog inputs. - - The on-board ADC (125 MS/s sampling frequency, 14-bit resolution) digitizes the RF signal from the antenna. - - The data coming from the ADC is processed by a in-phase/quadrature (I/Q) digital down-converter (DDC) running on the Red Pitaya's FPGA. - - The I/Q data is transmitted via TCP to the SDR programs such as SDR# and HDSDR. +![SDR receiver]({{ "/img/sdr-receiver-hpsdr-ddc.png" | prepend: site.baseurl }}) -The tunable frequency range covers from 0 Hz to 50 MHz. +The I/Q data rate is configurable and four settings are available: 48, 96, 192 kSPS. -The I/Q data rate is configurable and four settings are available: 50, 100, 250 and 500 kSPS. +The tunable frequency range covers from 0 Hz to 490 MHz. -Digital down-converter ------ - -The basic blocks of the digital down-converter (DDC) are shown on the following diagram: - -![SDR receiver]({{ "/img/sdr-receiver.png" | prepend: site.baseurl }}) - -The in-phase/quadrature (I/Q) demodulator is implemented using the [CORDIC algorithm](https://www.xilinx.com/products/intellectual-property/cordic.html). [CIC filter](https://www.xilinx.com/products/intellectual-property/cic_compiler.html) is used to decrease the data rate by a configurable factor within the range from 125 to 1250. [FIR filter](https://www.xilinx.com/products/intellectual-property/fir_compiler.html) compensates for the drop in the CIC frequency response, filters out high frequencies and reduces the data rate by a factor of two. - -FIR filter coefficients are calculated with the following code in [R](https://www.r-project.org): -{% highlight R %} -library(signal) - -# CIC filter parameters -R <- 125 # Decimation factor -M <- 1 # Differential delay -N <- 6 # Number of stages - -Fo <- 0.22 # Pass band edge; 220 kHz - -# fir2 parameters -k <- kaiserord(c(Fo, Fo+0.02), c(1, 0), 1/(2^16), 1) -L <- k$n # Filter order -Beta <- k$beta # Kaiser window parameter - -# FIR filter design using fir2 -s <- 0.001 # Step size -fp <- seq(0.0, Fo, by=s) # Pass band frequency samples -fs <- seq(Fo+0.02, 0.5, by=s) # Stop band frequency samples -f <- c(fp, fs)*2 # Normalized frequency samples; 0<=f<=1 - -Mp <- matrix(1, 1, length(fp)) # Pass band response; Mp[1]=1 -Mp[-1] <- abs(M*R*sin(pi*fp[-1]/R)/sin(pi*M*fp[-1]))^N -Mf <- c(Mp, matrix(0, 1, length(fs))) - -h <- fir2(L, f, Mf, window=kaiser(L+1, Beta)) - -# Print filter coefficients -paste(as.character(h), collapse=", ") -{% endhighlight %} +The [projects/sdr_receiver](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver) directory contains two Tcl files: [block_design.tcl](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver/block_design.tcl), [rx.tcl](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver/rx.tcl). The code in these files instantiates, configures and interconnects all the needed IP cores. -To get an idea of the combined (CIC and FIR) filter response, the following figure shows a 256k FFT display from the SDR# program when Red Pitaya inputs are not connected to anything: +The [projects/sdr_receiver/filters](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver/filters) directory contains the source code of the [R](https://www.r-project.org) scripts used to calculate the coefficients of the FIR filters. -![Filter response]({{ "/img/no-signal.png" | prepend: site.baseurl }}) - -The [projects/sdr_receiver](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver) directory contains one Tcl file [block_design.tcl](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver/block_design.tcl) that instantiates, configures and interconnects all the needed IP cores. - -The [projects/sdr_receiver/server](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver/server) directory contains the source code of the TCP server ([sdr-receiver.c](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver/server/sdr-receiver.c)) that transmits the I/Q data stream (up to 2 x 32 bit x 500 kSPS = 30.5 Mbit/s) to the SDR programs and receives commands to configure the decimation rate and the frequency of the sine and cosine waves used for the I/Q demodulation. - -User interface +Software ----- -The I/Q data coming from Red Pitaya can be analyzed and processed by a SDR program such as [SDR#](https://sdrsharp.com/#download) or [HDSDR](https://www.hdsdr.de). - -The SDR programs are communicating with the SDR radio hardware through an External Input Output Dynamic Link Library (ExtIO-DLL). +The [projects/sdr_receiver/server](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver/server) directory contains the source code of the TCP server ([sdr-receiver.c](https://github.com/pavel-demin/red-pitaya-notes/blob/master/projects/sdr_receiver/server/sdr-receiver.c)) that receives control commands and transmits the I/Q data streams to the SDR programs. -Based on the [example ExtIO DLL](https://hdsdr.de/download/ExtIO/ExtIO_Demo_102.zip), I've developed a simple ExtIO plug-in for the Red Pitaya SDR receiver. The [projects/sdr_receiver/ExtIO_RedPitaya](https://github.com/pavel-demin/red-pitaya-notes/tree/master/projects/sdr_receiver/ExtIO_RedPitaya) directory contains the source code of this plug-in. +The [SDR SMEM](https://github.com/pavel-demin/sdr-smem) repository contains the source code of the TCP client ([tcp_smem.lpr](https://github.com/pavel-demin/sdr-smem/blob/main/tcp_smem.lpr)), ExtIO plug-in ([extio_smem.lpr](https://github.com/pavel-demin/sdr-smem/blob/main/extio_smem.lpr)) and other programs and plug-ins. The following diagram shows an example of how these programs and plug-ins can be used: -A pre-built ExtIO plug-in for the Red Pitaya SDR receiver can be downloaded from [this link](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AADBqDFBJpAnkcpAEARf5xQNa/sdr/ExtIO_RedPitaya.dll?dl=1). +![SDR SMEM]({{ "/img/sdr-smem.png" | prepend: site.baseurl }}) -For both SDR# and HDSDR, the `ExtIO_RedPitaya.dll` file should be copied to the directory where the program is installed and the program will recognize it automatically at start-up. +The `tcp_smem` program runs on a computer. It receives the I/Q data streams over the network and transfers them to other programs and plugins via shared memory. Antenna ----- -Inspired by the "Wideband active loop antenna" article appeared in the January, 2000 issue of Elektor Electronics, I've built my antenna using 4 wire telephone cable (9 m, 4 x 0.2 mm2). A schematic and picture of the antenna connected to Red Pitaya is shown in the following figure: +I use simple indoor antennas made from a single loop of non-coaxial wire. Their approximate scheme is shown on the following diagrams: -![Antenna schematic]({{ "/img/antenna-schematic.png" | prepend: site.baseurl }}) ![Antenna picture]({{ "/img/antenna-picture.jpg" | prepend: site.baseurl }}) - -With this antenna I can receive some MW and SW broadcast stations. - -Screen shot and audio sample ------ - -Signal from a 300 kW broadcast MW transmitter, 25 km from the transmitter: - -![Strong signal]({{ "/img/strong-signal.png" | prepend: site.baseurl }}) - -[Audio sample](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AAB5D6JQtyf3bQB_U65cnMIba/sdr/strong-signal.wav?dl=1) +![Antenna]({{ "/img/antenna.png" | prepend: site.baseurl }}) Getting started ----- - - Requirements: - - Computer running MS Windows. - - Wired or wireless Ethernet connection between the computer and the Red Pitaya board. - - Connect an antenna to the IN2 connector on the Red Pitaya board. - - Download customized [SD card image zip file](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AACcQ6HrPC3GCAxfkL4Pjrpwa/sdr/ecosystem-0.92-65-35575ed-sdr-receiver.zip?dl=1). + - Connect an antenna to the IN1 connector on the Red Pitaya board. + - Download [SD card image zip file]({{ site.release-image }}) (more details about the SD card image can be found at [this link]({{ "/alpine/" | prepend: site.baseurl }})). - Copy the contents of the SD card image zip file to a micro SD card. + - Optionally, to start the application automatically at boot time, copy its `start.sh` file from `apps/sdr_receiver` to the topmost directory on the SD card. - Install the micro SD card in the Red Pitaya board and connect the power. - Download and install [SDR#](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AAAdAcU238cppWziK4xPRIADa/sdr/sdrsharp_v1.0.0.1361_with_plugins.zip?dl=1) or [HDSDR](https://www.hdsdr.de). - - Download and install [Microsoft Visual C++ Redistributable for Visual Studio 2019](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist). - - Download [pre-built ExtIO plug-in](https://www.dropbox.com/sh/5fy49wae6xwxa8a/AADBqDFBJpAnkcpAEARf5xQNa/sdr/ExtIO_RedPitaya.dll?dl=1) for SDR# and HDSDR. - - Copy `ExtIO_RedPitaya.dll` into the SDR# or HDSDR installation directory. + - Download and unpack the [SDR SMEM zip file]({{ site.sdr-smem-file }}). + - Copy `extio_smem.dll` into the SDR# or HDSDR installation directory. - Start SDR# or HDSDR. - - Select Red Pitaya SDR from the Source list in SDR# or from the Options [F7] → Select Input menu in HDSDR. - - Press Configure icon in SDR# or press ExtIO button in HDSDR, then type in the IP address of the Red Pitaya board and close the configuration window. + - Select SMEM from the Source list in SDR# or from the Options [F7] → Select Input menu in HDSDR. + - Press Configure icon in SDR# or press ExtIO button in HDSDR, then enter the IP address of the Red Pitaya board. - Press Play icon in SDR# or press Start [F2] button in HDSDR. +Running CW Skimmer Server and Reverse Beacon Network Aggregator +----- + + - Install [CW Skimmer Server](https://dxatlas.com/skimserver). + - Download and unpack the [SDR SMEM zip file]({{ site.sdr-smem-file }}). + - Start `tcp_smem.exe`, enter the IP address of the Red Pitaya board and press the Connect button. + - Copy `intf_smem.dll` to the CW Skimmer Server program directory (`C:\Program Files (x86)\Afreet\SkimSrv`). + - Install [Reverse Beacon Network Aggregator](https://www.reversebeacon.net/pages/Aggregator+34). + - Start CW Skimmer Server, configure frequencies and your call sign. + - Start Reverse Beacon Network Aggregator. + Building from source ----- @@ -153,5 +100,5 @@ make NAME=sdr_receiver bit Building SD card image zip file: {% highlight bash %} -source helpers/sdr-receiver-ecosystem.sh +source helpers/build-all.sh {% endhighlight %}