Digital digitizer -> Now mixed signal Scope + DDS
Rayman
Posts: 14,646
I'm working on a digital digitizer with graphical display...
Update: Better acquisition scheme described below.
Here's a binary of current program and a photo of the setup showing which pins things are on.
Update2: Adding two analog channels
Update3: Added Cursors and fixed timing.
Update4: Added SP (SmartPin) settings buttons for each channel and also vertical gain knob for analog channels
Note: Using jumpers (see image) so analog input pins #8 and #9 can look at DDS output pins #12 and #13.
Update: Better acquisition scheme described below.
Here's a binary of current program and a photo of the setup showing which pins things are on.
Update2: Adding two analog channels
Update3: Added Cursors and fixed timing.
Update4: Added SP (SmartPin) settings buttons for each channel and also vertical gain knob for analog channels
Note: Using jumpers (see image) so analog input pins #8 and #9 can look at DDS output pins #12 and #13.
Comments
( I don't think a single streamer wraps continually into a block of RAM ?)
A separate trigger test can then freeze those (after some delay), and where the delay:capture ratios fall, determine the pre-trigger view.
It would need to capture the streamer index, but maybe that can be inferred ?
A smartpin could assist with concurrent trigger capture. The cog then doesn't have to spin on a tight point and instead just decide, after the fact, on when to stop the streamer.
This revealed some need for improvements...
Think it's in good shape now.
It now acquires in three steps:
1. Fill the buffer with data (so have something to show in case trigger happens right off)
2. Wait for the no-trigger condition
3. Wait for trigger condition
The trick was going from step to step with the same number of clock ticks between data collections...
I've added a slider that can move the trigger point (indicated by yellow bar).
Getting close to being useable now...
These screens are useful for setting it up...
I made it so that when you click on a table, the value get set accordingly.
I'd recommend renaming the "digital filter" to "de-glitch filter". That'll help clarify its real purpose and won't get hopes up that it'll do more. I should hassle Chip to do the same.
EDIT: Chip's write-up for the %TT field is problematic because that field is intertwined with both M and P fields and even changes modes in the cases of BIT_DAC and COG_DAC.
I changed "RxPIN" to "RZPIN", that's what you mean, right? (see new image below)
I'll look at %TT some more.
I posted the binary to the top post and a photo of the setup.
There's an interesting TT mode where you can AND, XOR, etc. the A and B inputs.
Here's what I got before and after ANDing the signal displayed on P54 with that of P56.
Look at the top trace to see what I mean in these two images.
Fortunately, you can look at a neighboring pins smartpin output using the %AAABBB wrpin setting.
In the above, I have P54 looking at P55, P56 looking at P57 and P58 looking at P59.
The INA for the ones in smartpin mode are all high even though they are actually outputting square waves.
It doesn't actually tell you how to set the %duty.
I just played with it and see now that Y controls duty.
Y=$FFFF_FFFF is 100% duty, Y=$8000_0000 is 50% duty and Y=0 is 0% duty.
Makes some sense now...
X controls the minimum pulse width apparently. Not exactly sure how...
But, I see now that X[31..16] times X{15..0] decides clocks in a frame.
The pulse width fraction is decided by Y[15..0] divided by X[31..16].
Y[15..0] must be less than X[31..16] so the fraction of on time ranges from 0 to 1.
I don't see any external difference between sawtooth and triangle other than the triangle's frame width being twice as long.
EDIT: Or maybe it's good for holding centre phasing when wanting a rock solid frequency.
I'm working on a P2 article for N&V right now. I will be including these two examples of PWM sawtooth mode that handle common tasks. The pwm() method is to emulate analogWrite() from the Arduino, with the added benefit of using any pin and being able to specify PWM frequency.
Of course, once setup, both PWM and servo pins can be updated with wypin().
Of course, if the pulse width never changes, both generate the same harmonic energy, since the waveforms are indistinguishable.
-Phil
Usually I imagine hundreds if not thousands of PWM cycles before a change is made to the setting.
Servos just use this as input. Not as the actual value going to the motor...
Ok, I guess I see that if you are generating a modulated PWM signal like on the Wikipedia page, it could be important.
Triangle becomes important when you have multiple channels (eg) 6 pins driving an AC inverter.
Here, you want dead bands between the Top and Bottom fets - you cannot do that with sawtooth counter PWM.
Triangle also allows multi-phase PWM, with less changes on a single edge, in a SMPS you may want 2 or 3 phases, designed so they nominally hand-over at the ideal operating point. This gives lowest ripple in the filters.
As Vin varies from that, the edges move slightly to give small gaps or overlaps in the times, but that still equates to low ripple currents in the filters.
IIRC Chip has a means to launch multiple smart pins in a known phase, that remains fixed.
* A 6 pin PWM driver example (triangle) as may be used to drive the 6 MOSFETS of a 3 phase AC inverter.
* A 2 pin PWM driver example, as may be used in a 2 phase SMPS (usually high current)
This is an intro article so those topics may be advanced, but let's talk about it for down the road. Also, Parallax is going to need material for good app notes when the P2 launches -- these sound like real opportunities.
See pic for analog top trace.
On the down side, the minimum clock period increased from 12 to 20 clocks.
Also, had to use last remaining cog to do DDS...
Fortunately, I think it almost does everything I wanted now.
Just need to add in analog trigger and DDS controls. And, maybe some cursors to measure stuff...
Before that changed one NOP in the waiting for no trigger code to an AKPIN.
This let the same code work for both digital and analog triggering (magically).
Everything was good until set trigger on Pin 23. Then, everything just froze.
Spent more time than I should have figuring out what was going on...
Turns out P23 is a USB pin. Seems it doesn't like being AK'd
Seems I have to put in some safety nets to keep from doing something not advisable...