DSO 150: Timebase

The voltage management was designed by Jyetech to reflect the values they wanted to use.
The resistors have the right values to form good voltage dividers, and as a result, converting between them and volt/div is pretty simple.

It's not so simple for the timebase.
Ideally, we'd like standard value, such as 10us/div, 50ms/div etc...
Since we use 24 pixels per div, that would mean 10us/24, 50ms/24 etc... sampling frequency

Unfortunately, we don't have the required  flexibility as far as sampling frequencies are concerned.
Here is a  table of all the available values (prescaler x sampling time)


2 4 6 8
1,5 0,39 0,78 1,17 1,56
7,5 0,56 1,11 1,67 2,22
13,5 0,72 1,44 2,17 2,89
28,5 1,14 2,28 3,42 4,56
41,5 1,50 3,00 4,50 6,00
55,5 1,89 3,78 5,67 7,56
71,5 2,33 4,67 7,00 9,33
239,5 7,00 14,00 21,00 28,00
Time/sample (us)


Multiple by 24, to get the time/div
Not so great in terms of user experience, 45.33 us/div is not very user friendly.

So, what we'll do is  oversample a bit the value we actually aim at, and then  decimate it.
It is a very simple decimate so that it does not slow down everything too much.

For example, if we want 100 samples at 500us/div, we'll program 400us/div, take 125 samples and decimate them regularly to keep only 100 values.

The table to deal with that is now:


Time/div (us) ADC Prescaler AcqTime Expand Expand *4096
25 17,33 2 13,5 1,44 5909
50 45,55 2 55,5 1,10 4496
100 90,67 4 55,5 1,10 4517
500 336 4 239,5 1,49 6095
1000 672 8 239,5 1,49 6095





Where expand is the discard/expansion ratio.
If we want 100 samples, we need to acquire 100*Expand, and decimate accordingly.

We might do a real resampling later if it is fast enough

When selecting the candidates for the AcqTime/Prescaler pair, we'll take the highest Acq time to favor accuracy.


So now, we have 'fast sampling' working for both time & voltage.
Need to do 'slow sampling' & triggering, and we have something remotely usable.


Comments

Popular posts from this blog

Component tester with STM32 : Part 1 ADC, Resistor

Fixing the INA3221

INA3221, weird wiring