High frequency square wave output

Status
Not open for further replies.
With the attendant slew rate, you clearly don't want to use the DAC for this application. Just for reference, here is the DAC performance out of a Teensy 3.6. Using DMA to independently drive the DACs, each square wave ranges from 0 to 4095 (full range of 12-bits) and consists of 32 points with an update rate of 0.133 microseconds per sample (7.5 MHz). It takes about 636 nanoseconds to to transition from 0 to 4095. To transition from 4095 to 0 takes about 100 nanoseconds longer. The green trace is DAC0 and the magenta trace is DAC1. By design, DAC0 and DAC1 are out of phase by 180 degrees. Based on this performance I wouldn't use the DACs to represent waveforms of more than 100 kHz unless you were using it for generating sine waves, and even then I wouldn't exceed 200 kHz.
Dual_DAC_DMA_Squarewave.jpg
 
A first prototype of the "Mini - SDR" as the result of a cooperation of FrankB & Frank DD4WH can be seen here:

https://www.youtube.com/watch?v=VIKR3kuGEqg

Features of the first prototype:
* Teensy plus only one additional active part: MCP2036 [cost incl. caps and resistors & OLED display: about 8$]
* small OLED display
* analog direct conversion, IF is digitized with Teensy ADC
* high frequency local oscillator for the analog mixer is the Teensy itself with BCLK / MCLK signals!
* receives from VLF -> LF -> MW -> SW [70kHz to about 10MHz]
* software I & Q conversion for digital demodulation and decoding
* demodulation of SSB (LSB, USB)
* demodulation of AM
* synchronous AM demodulation with a software controlled NCO and phase detection ("PLL") [code adapted from wdsp lib by Warren Pratt]
* Teensy DAC for audio output

many things still to be added: AGC, sophisticated filtering etc.

Audio performance is not brilliant, but still amazing for this minimal design (no analog selectivity, no analog filtering, minimal hardware).

All the best,

Frank & Frank

3.png

Edit (Frank B): https://github.com/FrankBoesing/Minimal-SDR
 
Last edited by a moderator:
We "abuse" a MCP2036.
Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22186C.pdf
This is an "Inductive Sensor Analog Front End Device" and is actually not intended for this type of applications. It's just cheap (~0.50€) and simple. The IC has a built-in mixer (see Fig. 1-1 in the data sheet), and so we don't need a high sample rate. The current version uses 52000Hz samplerate, with the Teensy Audio Library.. Probably higher ones are possible without problems.

We're using only one ADC.

When we're done with the circuit, we'll publish it.
 
just some preliminary information:
Hardware:
* MCP2036

How does the Minimal-SDR work:
* Teensy produces LO RX frequency on BCLK (pin 9) or MCLK (pin 11)
* MCP2036 mixes LO with RF coming from antenna --> direct conversion
* MCP amplifies and lowpass filters the IF signal
* Teensy ADC samples the incoming single IF signal with sample rate == IF * 4
* Software Oscillators cos & sin are used to produce I & Q signals and simultaneously translate the I & Q signals to audio baseband
* I & Q are filtered by linear phase FIR [tbd]
* Demodulation --> SSB, AM or synchronous AM
* Decoding of time signals or other digital modes [tbd]
* auto-notch filter to eliminate birdies
* IIR biquad filter to shape baseband audio
* Audio output through Teensy DAC
@willie: BTW, I am using the Teensy to reliably record ultrasound through the internal ADC (12 bits) at 500ksps, so I can confirm your observations that the ADC is capable of sampling at high SRs. (have not tested higher rates)
 
I was trying to figure out what you were doing with the MCP2036. I got it now.

I don't use the Teensy Audio Library because I want to take advantage of the 32-bit floating point capability of the Cortex M4 architecture. In my book doing dsp using fixed point when I have floating point available is like committing blasphemy (although I do understand why Paul has taken that approach). I'm using the CMSIS Version 5 dsp library. The library is very powerful. I do use the ADC library along with some with some homegrown mods to extend the acquisition rates and to synchronize the timing. I'm currently working on a sketch that uses both ADCs on the teensy 3.6 to simultaneously acquire iq signals. I currently have it running using 16-bit resolution with acquisition rates up to 850 kHz, although any real processing that is done on the data slows it down. Using 2048 sample buffers and running the data through a cfft I can easily run both ADCs at 600 kHz without overruns. BTW, using the cfft is a natural for processing iq data.

Regards,
W
 
BTW, using the cfft is a natural for processing iq data.
I would strongly disagree ;-). It entirely depends on your goal.

Have a look at the Teensy Convolution SDR, which uses a newer CMSIS lib (and uses cfft and inverse cfft) and 32-bit-floating point realtime processing with the Teensy 3.6. This is justified because that approach is meant to squeeze the most out of the quadrature sampling detector SDR hardware that it uses. And with that approach you would want the lowest possible sample rate (at least internally after decimation) in order to have enough time for processing, so no need for high speed sampling in this case. A lot of software decimation is being done internally.

Please note that we are not talking about direct sampling SDRs here which naturally need high speed ADCs. The speeds necessary in those cases (ADC sample rates > 60MHz for a shortwave radio) largely exceed the possibilities of the Teensy.

We are talking about a "Minimal SDR" in this thread using direct conversion in the analog domain and producing the I & Q signals in the digital domain from a single signal produced by the direct conversion frontend (and fed into a single Teensy ADC input). So our goal is to get the best possible result using a minimalistic approach using minimal hardware for the frontend and for the processing (so you see this is going to be great fun, with a willful restriction of our potential possibilities ;-)). So we think about using a Teensy 3.2 for processing; however with the possibilities of the Teensy 3.6 so many more things are possible :) . . . we will see how this project evolves.

BTW: can we have a look at your high speed acquisition code? Would be very interesting to have a link to your github or similar.

Have fun with the Teensy,

Frank DD4WH
 
Hi Frank,
Sorry for not responding sooner but I’ve been off the grid for a couple of weeks and still have a week to go on the road. I have thought about posting my code someplace in the event there is any interest. I’m not a C++ programmer by any stretch, but was able to hack and cobble together something that works by looking at some of the excellent examples on this forum. I need to do some cleanup on it and will post it when I can get an opportunity.
Regards,
W
 
20181128_205810.jpg20181128_210649.jpg20181128_210657.jpg

Thought I post some pictures.. the PCB arrived today. Needs a Teensy 3.6.
2MHz I2C causes noise :( so I had to disable the spektrum display - was'nt a problem on the breadboard, before..

@titim: shema follows.
 
Any chance you could supply a schematic or a PC board? I've ordered several MPC2036's but need at least a schematic to get any further.

Thanks,
Michael KD4SGN
 
Minimal sdr test

Hi.How can I get the encoder to go?
I'm going to change the frequency only from serial monitor
Thanks
 

Attachments

  • mcp2036 test.jpg
    mcp2036 test.jpg
    153.5 KB · Views: 124
Hi Tim,

your PCB looks great!

the software and hardware is in a preliminary stage at this moment. We (FrankB and Frank DD4WH) are busy with other projects at the moment (T4 and ultrasound recording), so this project has a pause at least in the next weeks :).

But feel free to experiment and report your findings here!

Have fun!

All the best,

Frank DD4WH
 
With Teensy 3.6, no need to fiddle with the timer registers. All you need is this:

Code:
void setup() {
  analogWriteFrequency(3, 10000000);
  analogWrite(3, 128);
}

void loop() {
}

This does depend on F_BUS being a multiple of 20 MHz. On 3.5 & 3.6 it defaults to 60 MHz. At other speeds or on Teensy 3.2 F_BUS is other frequencies like 48 MHz.

Tried it just now on a Teensy 3.6. Here's the waveform (using a short wire and ground lead clip - not the best probing for a high speed signal so you see a little ringning due to the leads, but quick and easy to connect)

View attachment 14706

I've used this simple method to generate square waves between 30KHz to 50KHz as desired, but need four independent signals, all at the same frequency, but phase adjustable.

I've tried by adding delayMicroseconds between the analogWrites, but it isn't really working.

Any suggestions? I'm trying to avoid using a shift register.
 
Status
Not open for further replies.
Back
Top