AudioSDR - A single Audio block SDR (software defined radio) processor/demodulator

Hi Frank: Thanks for setting me straight on this. That's how I had remembered things- it was only when I saw another post that I thought differently. Seems like the dedicated ADC (PCM1808) is better than codecs in this regard. I was interested to see you had also used various STM32 MCUs with SDR software. I have a STM32F746 Discovery board which I thought would be great for such projects as it has a beautiful 4.3" capacitive touchscreen and a WM8994 audio codec. I used it for some projects but cannot get the audio line in and audio line out to work simultaneously (microphone in and line out is OK). Others have had the same problem, but I expect someone out there has figured it out.
I've tried to use the STM32Cube IDE but find it very difficult to get used to, but I've been more successful using the Mbed platform- it's somewhat like the Teensy in good support, libraries etc.
I just figured out that the Audio library ADCS component has not yet been ported to the T4.x, so my idea of using the internal dual 12-bit ADC is a non-starter.
Cheers
Brian
 
Hi Frank: Thanks for setting me straight on this. That's how I had remembered things- it was only when I saw another post that I thought differently. Seems like the dedicated ADC (PCM1808) is better than codecs in this regard. I was interested to see you had also used various STM32 MCUs with SDR software. I have a STM32F746 Discovery board which I thought would be great for such projects as it has a beautiful 4.3" capacitive touchscreen and a WM8994 audio codec. I used it for some projects but cannot get the audio line in and audio line out to work simultaneously (microphone in and line out is OK). Others have had the same problem, but I expect someone out there has figured it out.
I've tried to use the STM32Cube IDE but find it very difficult to get used to, but I've been more successful using the Mbed platform- it's somewhat like the Teensy in good support, libraries etc.
I just figured out that the Audio library ADCS component has not yet been ported to the T4.x, so my idea of using the internal dual 12-bit ADC is a non-starter.
Cheers
Brian

Hi Brian,
I just came across your post, mentioning the F746 board. I have experimented with this board and have managed get the audio in/out part to work. I am now experimenting with Derek Rowell's AudioDSP library, but the going is slow as the STM32 development environment (as you mentioned) is daunting to say the least. However, I'd be more than pleased to share experiences if you are interested.
Jan
 
Hi Jan:
I gather you are also interested in other MCUs beyond the Teensys. Are you saying that you have gotten line in and line out working simultaneously. That is what I couldn't achieve and there were forum posts saying something about needing a separate I2S channel for line in and line out, and that there was only 1 channel associated with the Codec. Didn't seem to make much sense as the on-board microphone is handled by the codec and mic. in/ line out work together. But, even when I dug into the BSP library code for the codec, I couldn't get both working at once.
I heard about the AudioDSP, but never looked into it since I couldn't solve the basic line in/line out issue. We are truly spoiled with Teensy as the Audio library is very good. While I'd be hard-pressed to write a DSP lib. function in STM32Cube IDE, I have written several custom ones for the Teensy audio library.
I'd be interested in hearing how you are progressing. To be honest though, I am only comfortable using the Mbed IDE,I never got comfortable with STM32Cube. Similarly, the Silicon Labs MCUs use an eclipse-based IDE which I found awful to learn, and reverted to Mbed on that MCU as well.
Cheers
 
Hi Brian,
all that steered you away from STM32Cube is valid. It's not only Eclipse that takes getting used to, but the STM32 IDE plugin is very hard to get a handle on and I have found it error prone. The one reason I am not giving up is a very good graphics environment with TouchGFX, but that too is not for the daunted. The "line-in to line-out" audio path can indeed be made to work without an additional I2S channel, but it takes wading through such things as incompatible handler names between the STM32 audio library and the initialization code that CubeMX generates for an F746 discovery board. Explaining 'how to' means dragging you into the STM32 IDE, not where you'd want to go. Maybe one day I'll try Mbed as well, or simply stick to Teensy :)
 
Updates: Hi everybody! I've been involved in a large ESP32 project (a stand-alone WSPR beacon, with 20+ units now deployed) for several months and away from the forum, but still working on AudioSDR, and using it daily. A couple of things:

1) I have just uploaded an update to GitHub. It includes a bugfix for the AM demodulator that caused severe audio distortion, and changes to the PLL for the SAM demodulator to improve the carrier lock. I also removed the EXAMPLES folder, which should never have been there :confused: Link here
2) The SDR works well on the T4.1. I continue to work on the UI, and the rf preprocessor. Here is an image of the ILI9341 2.8" display with spectrum and signal strength:
sdrSpectrum.jpg
The yellow stripe on the spectrum shows the tuning band. I have struggled to develop a waterfall display, with no satisfactory solution.

A second screen shot shows an example of my encoder-based menu system for selecting/changing system parameters.
sdrMenu.jpg
(I find that the touch screen is just too hard to use for small menu buttons)

I have not published the whole system code because of the dependencies on my homebrew receiver rf front end, and the structure of the user interface (encoders, pots, tactile push buttons etc). However, if anybody wants the whole package just let me know by PM with your email, and I'll send you a zip with the whole bundle. You'll be on your own to work out what's going on ;)

I am currently working on adding a transmitter to make a complete transceiver. I have the Teensy based DSP audio processing (compression, shaping, Hilbert transfom (phase-shifter)) done, and am now working on the hardware RF mixers and amplifiers. It's stand-alone right now but the goal is to make it a fully integrated transceiver.
 
Last edited:
Hi Derek, thanks for updating your SDR library ..There are members on my Facebook Group (Keiths_SDR) that are using it for their receiver builds ..Im also running the 2.8" touch panel as well as the ili9488 3.5" touch panel ..and I agree the 2.8" is just a touch undersized for touch ..

Cheers
K
 
Another quick GitHub update: Just to let you know that I"ve just uploaded another update with minor changes:
1. A more recent version of the manual (with source code for BareBonesWSPR)
2. An EXTRAS folder with the .ino for BareBonesWSPR, and a copy of my library SI5351quad, which generates quadrature outputs directly on channels 0 and 1 of the SI5351A oscillator, without generating an x4 frequency and using a Johnson counter to create the quadrature pair.
 
Any chance of TX?

Yes... I'm working on it! Right now I have the SDR part (Audio processing, IQ generation etc) working in a stand-aloe config, and am concentrating of the RF hardware side (mixers. QRP linear amplifier, filters). The goal is to integrate the RX and TX after both are working,
Derek, AK1WI
 
One more thing

Yes... I'm working on it! Right now I have the SDR part (Audio processing, IQ generation etc) working in a stand-aloe config, and am concentrating of the RF hardware side (mixers. QRP linear amplifier, filters). The goal is to integrate the RX and TX after both are working,
Derek, AK1WI

I am working to get your RX version working, but I am on a MacBook. You only have instructions of how to load the arm...h files on a PC, do you have info how / where to copy them to on a Mac?

Front end here is either a QCX+ or an Elektor SDR board, IQ outputs. Hope this will work! Eventually I hope to follow you and get a TX/RX going, simple OLED display, nothing fancy... Activity on GanymedeHam.blogspot.com
 
I am working to get your RX version working, but I am on a MacBook. You only have instructions of how to load the arm...h files on a PC, do you have info how / where to copy them to on a Mac?
Sorry, I don't have any real experience with a Mac. Since it is just a matter of substituting files in the Teensy folders, can you find the appropriate place on the Mac?
 
Hi Derek!

Anything new to report on the transceiver project? Did you make any progress on the waterfall display?

Joe
W3JDR
 
Hi

I need some help/guidance with a spectrum display for the receiver project . I have a 40m SSB/CW receiver version working with switching filters/AGC/mode etc and a RA8875 5inch display..

But I am having problems with the code for a spectrum display. Any FFT code fragments for a basic spectrum display would be very helpful.

Thanks
Bob G3PJT
 
PhaseChange() on T4 with OpenAudio_Library F32 working

I got Ron's PhaseChange() to work on the Teensy 4 to remove images using OpenAudio_Library 32bit floating point objects.

Had to make some changes.
1. Change the int16_t arrays to float32_t
2. Change the 32767 to 1.0f

Plugged in the begin() functions after the sgtl5000.enable().
ex: PhaseQ.begin(PhaseIfir, 2);

I assigned PhaseChanges(1) to a button to cycle through the 3 combos.


Code follows with some usage comments added
________________________________________________________________________________________________

HTML:
//     Manual I2S codec Phase Correction Utility by Ron Carr
//     Reference: [URL]https://forum.pjrc.com/threads/57362-AudioSDR-A-single-Audio-block-SDR-(software-defined-radio)-processor-demodulator?p=263048&viewfull=1#post263048[/URL]
//      Updated for Teensy 4.0/1 using the OpenAudio_Library (F32) by K7MDL on 24 Feb 2022
//
//    Usage: Paste in the code below as-is in the appropriate sections.
//        There is nothing to configure.
//        Normally you would attach the function PhaseChange(1) to a user control.
//        When you see a mirror image at startup, operate the control to try each of
//            the 3 combos until you see the mirror image go away. 
//
//.............................
//     Phase correction FIRs. Apparently sometimes the I2s audio samples are 1 step out of phase
//         and waterfall shows very little opposite sideband suppression
//
float32_t  PhaseIfir[2] = { 1.0f, 0 };    // swap constants to change phasing
float32_t  PhaseQfir[2] = { 1.0f, 0 };
//.............................


// Your pgrogam should already have these lines
float sample_rate_Hz = 48000.0f;  // set to your preference
const int   audio_block_samples = 128;          // do not change this!
AudioSettings_F32           audio_settings(sample_rate_Hz, audio_block_samples);  


// Add the below code in the approriate places
AudioFilterFIR_F32          PhaseI(audio_settings);
AudioFilterFIR_F32          PhaseQ(audio_settings);


// Attach PhaseI and PhaseQ to the i2s inputs.  Here is an example.
AudioConnection_F32     patchCord_RX_In_L(Input,0,  PhaseI,0);  // route raw input audio to the FFT display
AudioConnection_F32     patchCord_RX_In_R(Input,1,  PhaseQ,0);
AudioConnection_F32     patchCord_RX_Ph_L(PhaseI,0, I_Switch,0);  // route raw input audio to the FFT display
AudioConnection_F32     patchCord_RX_Ph_R(PhaseQ,0, Q_Switch,0);


//    ------------------- PhaseChange() -------------------------------------
// I2S audio sometimes starts with I and Q out of order
//    --------------------------------- -------------------------------------
void PhaseChange(uint8_t chg)
{
   static int val;


   if( chg ){
   if( ++val > 2 ) val = 0;                            // rotate through the settings
   }
      // print 
   Serial.print("Ph:  ");


   switch( val ){
   case 0:  
      PhaseIfir[0] = 1.0f;   PhaseIfir[1] = 0;        // normal in phase
      PhaseQfir[0] = 1.0f;   PhaseQfir[1] = 0;
      Serial.println("1010");
   break;
   case 1:
      PhaseIfir[0] = 1.0f;   PhaseIfir[1] = 0;    
      PhaseQfir[0] = 0;      PhaseQfir[1] = 1.0f;    // delay Q  ( delay I if fir runs backward )
      Serial.println("1001");
   break;
   case 2:
      PhaseIfir[0] = 0;      PhaseIfir[1] = 1.0f;    // delay I
      PhaseQfir[0] = 1.0f;   PhaseQfir[1] = 0;
      Serial.println("0110");
      break;
   }  
}



setup()
{
   PhaseI.begin(PhaseIfir, 2);
   PhaseQ.begin(PhaseQfir, 2);
}


loop()
{


 . . .


   // Call this from a UI control to manually try al l3 combos.  
   // A value of 1 will cause the function increment the count internally to the function
   PhaseChange(1);  // deal with "twin-peaks problem" - 3 combos, call this until the problem goes away


. . . 


}
 
I converted AudioSDRpreProcessor to f32 to be compatible with OpenAudio_Library and Teensy 4.x. I and using it in my Teensy 4 based RA887x_SDR radio and tweaked and seems to be working well after tweaking some variables. In my app I have a #define to choose between the PhaseChange() manual method vs this Auto-method as one prefers to help ease further testing of both methods.

There are 2 files at https://github.com/K7MDL2/KEITHSDR
AudioSDRpreProcessor_F32.h
AudioSDRpreProcessor_F32.cpp

I also pasted them into a PullRequest at https://github.com/DerekRowell/AudioSDR/issues/1

Both methods seem to work fine so far.

Mike K7MDL
 
Recently found the GitHub AudioSDR and this thread today. The thread answers some of my questions and needs some more reading and analysis. Have an unanswered question about the selection of the 6890 Hz clock. The frequency appears to be unusual from a digital point of view as opposed to 8KHz. Is this due to the digital processing or the aliasing filters? I am not yet up to speed on the DSP software and know more about hardware.

Also have not read much here about the transmitter approach in hardware. Interested in making a single exciter for 20M, 10M and/or 6M because they are common transverter frequencies. Also looking at analog Gilbert cells [like NE602/612, ADL5375 or AD831] for the second multiplier stage, because the Tayloe performance seems to fall of at higher frequencies and perhaps these circuits may work better.

Thanks for any comments.

Dick K9IVB
 
@robjohn...
Nice looking unit. I really like the simplicity of your panel and display!! My unit(s) are still being built on protoboards with hand wiring underneath.

I'll be delighted to share my control/display software with you. However, it's continually being updated, and is not quite as clean as I would like before being released. For example, I've (just this week) added a menu sytem for adjusting operating mode/band/adjusting operating parameters etc. It's working well but the code is still a bit untidy. :rolleyes: It's a work-in-progress and always will be.
The other thing is that the code is closely tied to my hardware. For example, I use an I2C port expander to communicate with the tactile switches on the front panel, and I have a home-brew RF front-end with an "SDR Cube" (which has 0/6/10/16 dB atten, and 4 octave-wide BPFs) and I use another port expander to control that. I am also using direct quadrature generation from the SI5351 (without the "divide by 4"). So you may have to make quite a few adjustments.

How should we proceed? I'll start by uploading the SI5351 libraries to GitHub tomorrow. Maybe we should continue by PM? It'll take me a day or so to package up all my libraries...

The things I'm working on right now are:
1) Improving the panadapter display (graphics, smoothing, and algorithm). I had to compromise with the T3.6, but the extra speed of the T4 opens up new possibilities.
2) As you say, the AM demod is not as clean as it might be, although I get a 120 Hz hum on the audio. It should be the simplest demodulator - it is just a quadrature envelope detector - but it has given me the most problems. Also, I'm not happy with the capture range in the PLL used in the SAM detector, and am looking at that.
3) A bigger project is the design of a proper adaptive audio noise reduction filter. At the moment it simply uses the notch filter in an enhancement mode.

BTW - what display are you currently using? Is it the PJRC ILI9341 2.8". I ask because I'm planning to move up to a 3.5", which will mean yet another bunch of software changes. It just never ends...

Derek


Hi Derek.
I am a radioelectronic amateur, I have been interested in electronics since I was 12 years old and at the moment I was developing a radio (printed circuit boards, assembly) on the well-known si4735 chip. Unfortunately, the performance of the chip in SSB mode leaves much to be desired. I'm very impressed with your project, I've always been trying to understand SDR architecture and am just starting to learn the basics of modulation etc.
I found a repository on GitHub where you saved the code for si5351 and the library for teensy. In fact, I'd really like to repeat your audioSDR project. I read your theory in English, Weaver's method. But I don’t have enough “touch” to begin to understand the practice (application, hw level). But I didn’t find a single mention of a circuit diagram or a project for programming teensy. Is this project available for re-creation (you are the author, licensor)? Is it possible to somehow get the source files and schematics? I have been prototyping for the past few years and have experience designing PCBs in Kicad for non-microwave applications. I would really like to try to repeat your experience, and if I can learn from this project, or understand more through this forum and communication with you.

Best regards,
Andrey
 
Last edited:
Back
Top