Propeller Signal Generator
Ahle2
Posts: 1,179
Have a look in the OBEX for the latest version!
http://obex.parallax.com/objects/872/
Version 1.2 features:
* Runs in a single cog
* Uses "duty dac"
* 1.25 MHz sample rate
* 6 waveform types (Saw, Triangle, Square, Noise, Sine, User)
* High resolution pulse width
* Outputs both normal and inverted signal at the same time
* Synchronization output on extra pin
* Signal can be damped in steps of 6 dB
* All parameters can be changed on the fly
Original first post below
http://obex.parallax.com/objects/872/
Version 1.2 features:
* Runs in a single cog
* Uses "duty dac"
* 1.25 MHz sample rate
* 6 waveform types (Saw, Triangle, Square, Noise, Sine, User)
* High resolution pulse width
* Outputs both normal and inverted signal at the same time
* Synchronization output on extra pin
* Signal can be damped in steps of 6 dB
* All parameters can be changed on the fly
Original first post below
I needed a signal generator that had a small footprint and a high sample rate; So I made one!
Features:
* Uses "duty dac"
* 600 kHz sample rate
* 4 waveform types (Saw, Triangle, Square, Noise)
* High resolution pulse width
* Outputs both normal and inverted signal at the same time
* Signal can be damped in steps of 6 dB
* All parameters can be changed on the fly
Comments
Propeller to the rescue!
I can do all kinds of mathematical calculations on jitter, "frequency exactness", linearity, resolution, SNR... etc
But I would like to have some real measurments on the performance..... pretty please!
You have got all this equipment to do good measurements (and the knowledge of course)
Many of these unknowns depends on the analog output stage... RC filter, OP... etc... etc...
And of course, the "duty DAC" is FAAAAR from good enough for high bandwidth signals. And of course, there's all kinds of "digital artifacts" generated inside the Prop. But let's say that we would want "optimal" performance for audio stuff. Then we would like to have a low pass filter with an extremely steep curve (48 dB or more) with a cut off of ~20 kHz to get rid of "duty noise". We would also like to have a high performance OP. and overall good components.
I want measurments of how well the "optimal" duty DAC circuit performs in combination with my PSG:
* Resolution for audio signals
* SNR (different pins and cogs... etc)
* Jitter
* Linearity
* Frequency exactness (in lack of better words)
*
(BTW, I think I can reach a sample rate of around 1 Mhz (80 Mhz prop) with some optimisations)
I am now experimenting with sample player. dithered, non dithered, noise shaped etc. Normal "duty DAC" gives 1812 clock cycles between two samples @44.1 kHz, and it means about 10bit DAC
And it means that lower bits of 16-bit signal causes peaks here and there - in accoustic band. All of this interferes with Propeller's internal work currents, so this noise depends on what cog is used and don't know what else. I tested my sample player without dithering with coginit instead of cognew, every cog gives different result. The best was using cog0 with playing routine and high numbered cogs for background work.
One remedium for it is this high frequency - 1 MHz in reality - white noise dither
Maybe, as someone wrote in my "sample player" topic, noise shaping and oversampling can give better results.
Another idea I want to try is using video generator for audio. This can be clocked with pll - something about 200 MHz instead of 80 MHz - I have to try it.
Btw, using the vide generator for audio has been done before and the bandwidth is great, but the resolution is.... Smile (8 bits at most). Maybe we could use two cogs/video generators, one taking care of the 8 MSBs and the other taking care of the LSBs?! Of course 16 pins will be needed and it might be hard to synchronize the two video generators. Just a thought!
Time to run bst and start testing
(1) this is another chip
(2) $1? Where to buy???
(3) they are not suitable for a signal generator described in this topic - too low frequency
Wolfson Microelectronics WM8762, WM8759, WM8766... I2S bus, 24 bit stereo sigma-delta, upto 192kHz sample rate. Available from Farnell.
[ Also don't forget R-2R resistor ladder converter! ]
Sure, but roughly the same incremental cost as a single COG.
AK4386ETP-E2 at digikey is 52c/1k and 94c/100+
No problem - For higher frequencies, you can still use any prop pin you like.
For square wave clocks, direct connect would likely be best.
At Audio frequencies, which is where a lot of the focus is, then the cheap DAC gives far better noise/distortion, and can use the Sine LUT in Prop, for low distortion sine.
-Phil
http://obex.parallax.com/objects/872/
* Sample rate increased to 1.25 MHz (Because I hate jitter and aliasing)
* Code size decreased by 10% (It's just 39 rows of assembly now)
--tom
That all depends on your preference. A pot would be super simple using this circuit...
http://www.rayslogic.com/propeller/programming/adc.htm
Your input signal would be the wiper on a potentiometer.
You'd sample the potentiometer and equate various voltage values as settings for your home brew signal generator.
Personally, I'd prefer to use a handful of buttons plus the rotary encoder, but the pot method is super simple.
Try this: http://www.qsl.net/dl4yhf/spectra1.html
It is excellent.
Regards
Richard
Guess I'm olde fashioned, I still like the smooth response of a real knob.
Question: the 1n notation on the caps?
1n = 1 nanofarad = 1 x 10^-9 F = .001 x 10^-6 F = .001 uF
I like the feel of real knobs too. I hear ya.
I've been thinking of a project with, lets say, 8 knobs that will control various parameters of the software running in the Prop.
The RC circuit takes 2 pins, which may not be a big deal.
Excluding preferences for feel, to interface these 8 knobs (pots or encoders) with the Prop, which circuit would have the fewest number of components?
--tom
And I must warn that the audio out port on the Propeller Demo Board isn't an option at all. Even after some modifications of the RC filter the signal still is severely "distorted".
It seems like the OP/headphone circuit has a very nonlinear frequency response. I would guess that some kind of loudness filter is applied.
So what does a 1 nano farad cap look like?
-Phil
Goodness me!
*rummages through parts drawers*
He's right, by jove!
I've got drawers full of the brown ones http://www.futurlec.com/Capacitors/C001UC.shtml but my favorites are the green shiny ones http://www.futurlec.com/Capacitors/C001U250M.shtml
@Cluso, wasn't there a discussion a while back about how the propeller demo board has the wrong filter caps? http://elmicro.com/files/parallax/propdemod_schematic.pdf
10nf and 10k gives 1591hz according to http://sim.okawa-denshi.jp/en/CRtool.php Would 10nf and 1k be better?
--tom
I added a front end to your signal generator. Knobs, switches etc all work with a touchscreen. You can dial up approx the right frequency with the slider knob, then adjust with the +1 and -1 buttons for the exact frequency.
A modified C3 or El Jugador gives a much better result than a modified Demo Board.
That's extremely cool, I wish I had your board to play around with!