Teensy Convolution SDR (Software Defined Radio)

I am trying to compile Teensy Convolution SDR (Windows 10, Arduino 1.8.12, Teensy 4.0, HARDWARE_DD4WH_T4 uncommented). I have copied the Si5351Arduino and the Arduino-Teensy-Codec-lib libraries to Arduino/hardware/teensy/avr/libraries as suggested in the software setup chapter of DD4WH's github. Additionally I have copied the ILI9341_t3n library to the libraries folder, as the compiler could not find it initially. According to post #239 I did not copy the CMSIS DSP files.

Now I get quite some error messages because "'tft' was not declared in this scope" (details see attached file). What 's wrong?



  • compiler_messsages.zip
    7.5 KB · Views: 179
Hi Peter, thats quite strange.

If you have HARDWARE_DD4WH_T4 uncommented:

then the compiler should find tft, because it is defined in line 938.

Are you sure, that you have:

1.) really uncommented HARDWARE_DD4WH_T4 in line 187

2.) the latest version of the .ino-file from github ?

your hints were very helpful. It looks like I have used a wrong/old version of the .ino file. To be sure I deleted all project related files and installed everything again. Now the .ino file compiles without errors.

Thanks very much for your help.

Could anyone help me with the next error of one of this program:

Hello ,
After waiting a while for parts from CH. some tests can be done
and something goes wrong in my hardware.

Could anyone help me with the next error of one of this program:
I use
Arduino version 1.8.5
Teensyduino 1.51
Teensy 4.0

(c) DD4WH 09/11/2019

Error by line
146 setI2SFreq(SAMPLE_RATE);
'setI2SFreq' was not declared in this scope

Multiple libraries were found for "Audio.h"
Used: C:\Program Files
(x86)\Arduino\hardware\teensy\avr\libraries\Audio ok
Not used: C:\Users\xhenk01\Documents\Arduino\libraries\Audio-master
Multiple libraries were found for "SD.h"
Used: C:\Program Files
(x86)\Arduino\hardware\teensy\avr\libraries\SD ok
Not used: C:\Program Files (x86)\Arduino\libraries\SD

Henk -PA0HAH


  • Audiotest.zip
    5.4 KB · Views: 107
Hi Henk,

I do not know where you got this code ;-). it has nothing to do with the Teensy Convolution SDR. Maybe you can get it to run on your system by just deleting the line with setI2SFreq. That line is only necessary if you want to alter the sample rate. Do you want to do that?
it has nothing to do with the Teensy Convolution SDR . Yes that is true, but I will test my minimal Hardware ADC DAC. I have removed the line with setI2SFreq . And I have got another error. best wishes, Henk Hoekstra
I would recommend to proceed in very small steps:
* test DAC: try the guitar example of the audio lib
* test ADC-DAC --> try the PassThrough example
If those two test are positive, proceed with other stuff
I am currently doing experiments with the Elektor-SDR and the software from Frank.
I have noticed that the Teensy 4 emits HF, and tried to minimize the HF-radiation by optimizing the settings.
The most important thing was to increase the BUS frequency (150MHZ at 600MHZ CPU clock):

Beyond that, I continued experimenting.
The following code changes the cpu-clock-source to PLL2. This PLL has the option "Spread spectrum" which should further minimize the radiation. (A disadvantage is that the CPU speed can't be controlled in small steps anymore). The code below sets 594MHz. The no longer needed PLL 1 is switched off.
There are commented out lines in it that turn off some parts of the CPU. They might be helpful too.

#define USE_T4_PLL2 

void init_cpu()
  CCM_ANALOG_PLL_SYS_SS = 0xfffff000; //enable spread spectrum for PLL2. TODO: Find best value.
  //Disable some parts:
  //CCM_ANALOG_PFD_528_SET = (1 << 31) | (1 << 15) ; //Disable PLL2: PFD3, PFD1 (not needed)
  //CCM_ANALOG_PFD_480_SET = (1 << 31) | (1 << 23) | (1 << 15); //Disable PLL3: PFD3, PFD2, PFD1 (not needed)

#ifdef USE_T4_PLL2
  F_BUS_ACTUAL = 594'000'000 / 2;
  CCM_ANALOG_PFD_528_CLR = (0x3f << 16);
  CCM_ANALOG_PFD_528_SET = (0x10 << 16);


  CCM_CBCMR &= ~(1 << 19); //ARM - Clock Source PLL2 - PFD0


  CCM_ANALOG_PLL_ARM &= ~(1 << 12); //Disable ARM-PLL


Next Step would be to try to reduce the CPU Voltage now..

I don't own equipment to measure ift these additional things are hepful or not( the Overclock IGP helped!!). I have the feeling the additional Steps helped too - but that's very subjective and I'm biased, maybe.

Edit: ILI9341_t3n allows to set the used SPI-Frequency (tft.begin(xxx, yyy)) - I'd choose the highest frequency possible - For higher speeds, it helps to add 100OHM to SCLK and MOSI)
Last edited:
Has anyone tried WFM with the Elektor - board ? I'm getting too much of noise, even with shorted (to GND) antennna-input
There are is a combinded high-and lowpass on th 2nd OP-Amp stage. How can I optimize this (for WFM?) I'd like to remove the filtering (shorting c7+c13 - correct?) and to reduce the amplification. Would this help?
Last edited:
I think I found the real culprit: The amplifier circuit with BF545A. I 've shorted the output (on R6) and the noise goes away. It does not go away if I short the Antenna Input. What does that mean? Is the FET defective? Or is that normal for the BF545?
Frank, how did you measure the noise? What do you mean by "too much of noise"? What is your noise benchmark? Did you measure in an EMI-free situation? Also one has to be careful not to be fooled by the AGC, because hearing more noise can seriously fool you. Sometimes the noise seems louder, but there is in fact less noise. Did you adjust the AGC threshold when playing with different hardware gains? Saying that, as an example, having 10dB more noise can be an advantage, if the signal level is 12dB higher, making the net effect a rise in SNR of 2dB.
In my radio experiments, I often felt that you would very rarely need an RF amplifier, especially if you are in a noisy (EMI) city environment and use a long wire antenna (which is known to pick up lots of electrical noise). So, yes, eliminating the RF amp could potentially improve the situation, but not much. Maybe try a magnetic loop antenna to improve your SNR?
My ears tell me wether there is noise or not. Output of BF545 shorted to GND - no noise. Antenna Input shorted: loud noise.
Shouldn't it be the same for both?
I might be wrong - would be nice if you could explain that !!

I don't get how i would have less noise with an other Antenna. Shorting to ground = NO antenna :)
Frank, I am pretty sure the AGC produces the noise that you hear. Could you do the following:
* USB demodulation, filter bandwidth 2.4kHz
* measure the noise with the dBm display for the situations that you described: input shortened, with antenna, etc.
* only the dBm display is objective, your ears will only hear the noise that is amplified by the AGC
* the AGC in the Teensy Convolution SDR is a very tricky one. It works very nicely, but the AGC threshold has to be manually adjusted for every noise level for best performance: https://github.com/DD4WH/Teensy-ConvolutionSDR/wiki/AGC-(automatic-gain-control)
the next step is:
Connect your antenna and measure the SNR:
* inject an RF signal with constant signal level (or use a radio signal that does not change signal level in time, for example ground wave reception of nearby medium wave/longwave stations) and measure (with the built-in dBm display) the signal level and measure the noise level (same filter bandwidth and demodulation mode)
It is only the SNR (signal minus noise) that is important, not the noise level per se.
Then connect a different antenna and do the same. The comparison of the antennas should only be made on the basis of the SNRs, not on the absolute value of the noise level.
Ok, here are the Results (49m) - no defaults in your program changed, USB, 2.4kHz

No Antenna: ~ -101.5 dBm
Antenna input shorted to GND : same as above
R6 shorted: -132 dBM (was still decreasing slowly, but I guess that shows the difference. )

So, 30 dBm more (where I would expect 0 dBm)
Last edited:
Are we still speaking about the input stage on the Elektor board? :)

It receives very good on 31 - 41meter, - on evening, the chinese stations are even much better to hear than with the unversity twente web-sdr http://websdr.ewi.utwente.nl:8901/
(some other stations similar) The anoying thing is the noise level introduced by (I think )- the board. Even with an amplifier I can't get WFM noise-free.

I'll do the measuring of post #290 this evening and report back.
Maybe I misunderstand your approach:
If you short R6, you short the input to the QSD. And you also short Vdd to GND through the FET, but I may be wrong. That means, your input signal must be zero, and so the signal level is very low, as expected.
Could you also measure the signal level in dBm WITH antenna ?
Up to -25dBM (around 7MHz tuned to china station (evenings) ), normally -30 - 35dBM.

Yes, I know I short the inputs. That was to get the noise of the OP-AMPS only. It's still audible then, but OK.
But I expect the noise level to be the same with shorted Antenna-Input. Shouldn't it be the same? So I think the 30dBm difference come from the FET only. Am I wrong?
Frank, probably we are talking about very different things. I dont get your problem, I think.
We seem to be using different meanings of the word "noise".
For example: How did you measure the noise of the "input stage of the board"? Did you disconnect your input stage from the rest of the board and perform a noise measurement?
Maybe better to continue via PM, because I seem to have problems in understanding.
1) If I short R6 the Input stage (FET - Amplifier) has no influence to the noise - right?
2) If I measure both one after the other - input shorted and then R6 shorted - the difference is the noise introduced by the FET-circuit - right?

3) I'm doing this because I suspect these 30dBm* difference are the problem.

*according to the display of your program, using the defaults.
Last edited:
Why should I disconnect the OP-AMPs inputs? With R6 shorted, they have no input - however, this shows me, that the noise-level of the rest of the circuit is OK. It's very low.
This alone shows that the culprit is _before_ the IC3 (4066)
Last edited:
Ok, (no answer=> usually means I'm probably right)

Back to my question:
Is that high noise level of the FET BF545 in this circuit normal, or is it broken?
Last edited:
Hi Frank, sorry, I had some easterly distraction and also I had to think a bit more about your problem.

You have to convince me, that you have a problem with high noise in the preamp. I do not see that yet, but I am open for your arguments.
* you could disconnect the preamp from the QSD
* put 50 Ohms to ground at the input of the QSD
* measure the noise (in dBm)
* that is your noise baseline for the QSD (mixer, Si5351, opamp)
* now disconnect the 50 Ohms and connect a signal with constant level to the input of the QSD
* measure the signal level
* calculate SNR for the QSD
* now connect the preamp again
* put 50 Ohms to GND at the antenna input of the preamp
* measure the noise level [in dBm]
* disconnect the 50 Ohms resistor
* put the same signal source to the antenna input
* measure the signal level
* calculate SNR for the whole system [preamp plus QSD incl. mixer, opamp]

Maybe there is some easier way, but at the moment the setup above should show, whether you have a problem with noise in the preamp or not. I think your 30dB difference is mainly an artifact of the grounding of the FET output, which has some side effect on the whole circuit, because you did not isolate / disconnect the preamp from the QSD.

If you have a spectrum analyser and a calibrated signal generator, it is much easier to measure the noise figure of the preamp alone (again, do not GND the output of the preamp, but disconnect it from the QSD before any measurement)

I am not totally sure, but as the input/ouput of the preamp and the input of the QSD are designed for 50 Ohms impedance, it is probably wise to use 50 Ohms and not short-circuit any input/output for measurements.
Last edited:
Frank: thanks for your code regarding PLL and spread spectrum! I do not have the time to test it thoroughly now, but I will do so in the next days!!!
It potentially collides a little bit with my intention to adjust the CPU frequency of the T4 in realtime in order to lower battery draw for mobile use ;-) [I often lower the CPU freq to 240MHz and get a saving of something like 50mA !]. But I will test that later.