Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 38 of 38

Thread: High frequency square wave output

  1. #26
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    Multiplier is 8 bit -> max val 255 -> max mult 256
    Divider is 12 bit -> max val 4095 -> max div 4096

  2. #27
    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.
    Click image for larger version. 

Name:	Dual_DAC_DMA_Squarewave.jpg 
Views:	12 
Size:	55.3 KB 
ID:	14714

  3. #28
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    321
    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

    Click image for larger version. 

Name:	3.png 
Views:	13 
Size:	249.5 KB 
ID:	15068

    Edit (Frank B): https://github.com/FrankBoesing/Minimal-SDR
    Last edited by Frank B; 11-01-2018 at 01:33 PM.

  4. #29
    Are you performing the IQ sampling using both ADCs on the Teensy? What is the maximum sampling rate that you have been able to attain?

  5. #30
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    We "abuse" a MCP2036.
    Datasheet: http://ww1.microchip.com/downloads/e...Doc/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.

  6. #31
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    321
    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)

  7. #32
    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

  8. #33
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    321
    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

  9. #34
    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

  10. #35
    Junior Member
    Join Date
    Nov 2018
    Location
    romania KN37EE
    Posts
    1
    Hi.The schema for mcp2036 is possible? No rx.I tried http://www.kh-gps.de/mcp2036.htm but did not go on Teensy 3.5 .

  11. #36
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    Click image for larger version. 

Name:	20181128_205810.jpg 
Views:	19 
Size:	108.3 KB 
ID:	15254Click image for larger version. 

Name:	20181128_210649.jpg 
Views:	14 
Size:	75.0 KB 
ID:	15255Click image for larger version. 

Name:	20181128_210657.jpg 
Views:	10 
Size:	48.8 KB 
ID:	15256

    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.

  12. #37
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    321
    hi Frank,

    looks great!!! Canīt wait to test that!

    All the best,

    Frank DD4WH

  13. #38
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •