Welcome to the Parallax Discussion Forums, sign-up to participate.

- 101.5K All Categories
- 812 Announcements
- 53 Propeller Code
- 23 PASM2/Spin2 (P2)
- 5 PASM/Spin (P1)
- 14 BASIC (for Propeller)
- 61 Forth
- 10 C/C++
- 2.8K Propeller 2
- 27.6K Propeller 1
- 18.9K BASIC Stamp
- 10 micro:bit
- 21.1K General Discussion
- 2K Learn with BlocklyProp
- 8.2K Robotics
- 124 Customer Projects
- 3.3K Accessories

## Comments

14,877What Specific frequencies and sample-N did you test this over ?

Did you get before and after ENOB ?

I can think of high frequency modulation effects that such a filter

mighthelp, but as with any notch filter, effects vary with the exact notch alignments.Note that SDM layered triangle+sawtooths, vary periods significantly with input voltage.

One test would be to sweep many N-samples, where N varies one count at a time, per set, and log the RMS deviation of a large number of same-N samples, before and after this filter is applied.

Use multiple pins, as they have enough variations to move operating points.

Even with an ideal, noiseless integrator, the start/stop instant can catch the integrator at any portion of 1 bit, which I think means there is +0/+1 count possible at each end, or +0,+1,+2 with both ends.

Early tests did show an improvement with oversampling then division, which would drop those quanta, but that also showed diminishing returns with large divisions.

1,809I think we should try to use a well-known and proven window, rather than invent our own. I've implemented a Tukey window with 32 steps up and down that vary from 0-3, giving a maximum value of 64, not 32 as now.

The table below shows the accumulator values:

The next table shows the accumulator increments:

It takes very little logic to create these increments from the outputs of a 5-bit counter.

Chip (or anyone else), would you like to try the Tukey window to see if the quality improves? A 6-bit right shift will be needed at the end. Ideally there should be rounding to get an extra ½ lsb.

1,71913: Continuous Signal Processing

14: Introduction to Digital Filters

15: Moving Average Filters

16: Windowed-Sinc Filters

Strategy of the Windowed-Sinc

Designing the Filter

Examples of Windowed-Sinc Filters

Pushing it to the Limit

17: Custom Filters

You can also download the PDF:

https://www.dspguide.com/pdfbook.htm

13,689Jmg, this technique has already proven impervious to different sample lengths. I'm pretty sure that as long as the tapering periiod is longer than the cycle period of the bitstream data, whose phase and period are ever-changing, the algorithm works.

13,689I will try this in just a little bit, TonyB_. I'm anxious to see how it works.

13,68913,68914,877That's part of what worries me - this edge filtering ignores 99% of the information, so

someof the time it fails to work.Key question becomes : If it removes one bit of reading jitter/quanta,

some of the time, is that worth the extra silicon being talked about ?Especially if it comes at the cost of no ADC streamer ?

The more conventional SW method to improve reading quanta effects, is to over sample x2, x4 ,x8 and then (using rounding) divide the totals.

The +0,+1,+2 possible edge effects then go below 1 LSB.

12,209The trade off is lag when using a rolling window. However, as long as aliasing doesn't pop in, it looks like non-rolling also works as one less effective bit than rolling.

13,68913,68910,2221,809I think there's quite a big difference in the window shapes, mathematically-speaking. Less weight is given to the samples at the extremities in Tukey and it's nice and smooth. Maybe I'll see some results in the morning.

I tried increments of 1-4 but the maximum value was 82, so I changed to 0-3 and it worked out well. The values shown are the closest integers with no fiddling, just a tiny bit of padding.

13,689That would be awesome if the Tukey window shape provided an added improvement. Where we are now is even very good, I think.

13,689It's the cycling in the ADC bitstream that causes the problems. Its period is no greater than 7 bits, so it only takes a handful of taps to filter out.

10,222Seems to me, we could sum three or four sine waves, know what that sample should set should look like, and then run this filter against something like that too.

Just trying to get at how broadly useful this may be, and or partially answer the question is it broadly applicable as we think it is?

How the heck did you come up with that Chip?

13,689The only filtering that needs to occur is at Fsys / ~7. That's way beyond the frequency of signals anyone is going to digitize.

It was inspiration. I had been thinking a lot and even dreaming about it. I had this feeling that I was right at the edge of discovery, when it finally came into focus and snapped to grid. At first when I coded it, it didn't work, so I was about to move on when I thought I should check a little harder. I found a bug in my code, fixed it, and all of the sudden it was working perfectly. Almost missed it.

23,174nooptimum filter for every source of time-series analog data. Depending upon the source of the signal and its characteristics, a binomial filter might outperform a boxcar averager; or a linear filter (e.g. FIR filter) might outperform a non-linear one (e.g. median filter). For that reason, I think it's a mistake to try to incorporate an ADC filter of any sort in hardware, since it might skew the user's results in some cases. Better to let the raw data fall where they may and let the user apply whichever software filter is best for his/her analog source.As an example, I'm working with a sensor that has extremely noisy output. The distribution is Gaussian, but the variance is quite large. I've finally settled on a median filter of sorts, wherein

nsamples are taken and sorted, and the middlen/2samples from the sorted list are averaged. (Try implementingthatin hardware!) I prefer working with the raw data and would not want it to be pre-sanitized by a hardware filter.Chip, you seem a bit disappointed with the raw performance of your ADC. But it is what it is. By airbrushing it with a hardware filter to hide its supposed deficiencies, you're not helping everyone who may be using it and are hurting the prospects for some. It will affect not just the noise introduced by the ADC, but also any noise or other high-frequency components generated by the user's analog output, wherever that may come from. I would vote for dropping this whole train of thought to focus on just getting the P2 finished.

-Phil

13,689Well, it would be awesome to get 16-bit samples at 100KHz. Wouldn't that be funny if somehow we were able to get 24-bit samples?

14,877Some good example performance plots are in the TI manual for the 18 bit DAC9881 Evaluation Module I linked earlier.

See page 8, Figure 8. INL and DNL Characteristic Plot.

14,877Certainly, I hope this edge filter is made optional...

14,877Note that a linear ramped filter, can be implemented in hardware with a simple U/D saturating counter, feeding your adder. (no ROM table needed)

1,44171This new filtering mode is an exciting development, but I think the ADC streamer mode with un-filtered samples could still be useful if the user wishes to implement an alternate filtering algorithm or is making a rapid series of measurements where the least significant bits aren't important.

13,689Not necessarily! What kills high-resolution measurements is the acquisition time more than any other thing, as 1/f noise becomes more prominent with the longer sample periods.

If it is possible to get more bits in a shorter time, We can get ahead of the 1/f noise.

13,689The sad part is that the windowing needs to occur on the original bitstream. Once you have a composite sample, it's too late.

10,222Say this correction was in place already. How would you know?

13,689Only one piece of information would need to be given:

"Acquisition time will be the WXPIN value plus 64, while the number of equivalent whole-bit samples taken will be the WXPIN value plus 33."

It's 33 because SUM(1..32, 32..1)/32 = 33.

So, those 64 attenuated/windowed samples are equivalent to 33 normal samples and are in proportion to the average sample.

I don't see how this could be problematic.

10,222But, from what I see here, the concerns are "what if?" types. All good, but the way to get at those is to invert the problem, which is why I posed the though experiment I just did.

So, you will have given that information. Had that been the release silicon, Rev A, what would the discussion be?

Secondly, someone approaching all this for the first time would test the ADC, as any of us would. What do they find out of the ordinary?

If we don't really have solid scenarios that fit either of those lines of reasoning, we are left with a solid feature.

Should we identify a scenario, great! That is a discussion we can all think on and likely resolve, just like all the thousand other ones.

Personally, I see this as a huge win. Tons of people are just going to use the ADC, and it's going to perform for them as expected.

Good.

While that mess of noise is a fun challenge, and it can be compensated for, you all just know there will be a bazillion, "but what, but why?" and a bazillion more, "How do I?" after that.

This way, it's hard to even formulate a material question that needs an answer. Either there are good reasons for that, like what you came up with Chip, works. Or?

Very worst case scenario is we find some edge or corner case somewhere, someday, and it somehow doesn't perform well enough. In that rare case, another component is added, or someone makes a ADC out of some of the pins, done, next.

23,174hasto be done in hardware (although I'm still not convinced), it's really quite an interesting optimization problem:1) Characterize the noise,

i.e.is it white noise, pink noise, Gaussian, ... ? Youhaveto do this first.2) Write a program that simulates the noise, based upon the characteristics determined in 1).

3) For a total of

nclock cycles andmseparate coefficients summing ton, what allocation of those of those clock cycles among the coefficients yields the lowest statistical variance in the results from applying the noise in 2)? That, then, becomes a well-defined, classical, multivariate optimization problem.4) Apply a known optimization technique to search out the best coefficient set, using multiple runs, Monte Carlo style. Simulated annealing comes to mind here, but there are many others. And it may well turn out that the "triangular" coefficient set is the best. But there's no way to tell without going through this exercise first. Otherwise, you're just guessing.

-Phil