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

- 101.6K All Categories
- 812 Announcements
- 57 Propeller Code
- 24 PASM2/Spin2 (P2)
- 8 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

13,689That would be expensive. I'm hoping we can just keep outputting accumulator values.

Yanomani, I'm thinking about the digital filter method that hopefully doubles the effective number of bits.

1,67213,689ErNa, do you believe it's possible to get a 16-bit or a 13-bit result from 256 bits of 1-bit ADC samples?

1,329So, 5 out of 6 or 7, 6 out of 8, 7 out of 9 or 10, and so on.

1,67212,223My skill level here is to look for visual ripples in the data. Hence the graphs.

Here's the spreadsheet with the useful data I've collected.

13,689We could make a 15-bit shifter for incoming ADC bits and mantain a 4-bit inventory count. Would that be a basis for increasing resolution? It would certainly limit slope.

13,689The Tukey could work on a bit stream if you had signals to know when the opening window was beginning and when the closing window was beginning. You would output a '1' every time you reached an MSB of summation for the weighted bits.

13,689But you must have some insight on the matter.

1,8091,809Here are the current suggested Tukey candidates for testing:

* indicates first and last duplicate values omitted.

Chip, could you try 17*/32 today? We really need to know how short the ramps can be. If 17*/32 is good, then 12/32 should be next.

14,882A good test to run alongside the 17*/32 would be a

time-doubled 7/32(every value stays for 2 sysclks, taking 14 to walk the table)A little more coarse, but much less logic cost, and it is that logic cost that needs to be driven down, as it multiplies by 64 here

Yes, I agree for the smaller Tukey sizes, a direct state engine can be used.

13,689What if we had a 31-bit shift register into which we shifted ADC bits, and then weighted each bit position to an up+down ramp (trapezoid or cosine)? The positions could sum to $FF if all 31 bits were high for 8-bit containment. It seems to me that that would give us an 8-bit sample every clock. Those 8-bit samples could be summed, as well, to get bigger samples.

A 31-position trapezoid pattern that sums to $FF would look like this:

1 2 3 4 5 6 7 8 9 A B C D E F F F E D C B A 9 8 7 6 5 4 3 2 1

So, on each clock, all 31 weighted bits are summed up to produce an 8-bit sample.

I'm going to try this out to see what it looks like, using captured ADC streams.

Does anyone have any prediction about how this will work out? I realize there's going to be a low-pass effect.

13,689Right now, I'm trying to get my head around this double-the-bits idea. I realize that what I proposed above might be more realistic for 5-bit results.

1,809Thanks, Chip. Are any as good as the original 32 sample version?

374from a certain number of bits. Of course using more bits is going to be better.The sinc^2 / triangular window is cheap to implement, as it's just count up, count down. We could consider it "a long trapezoidal window taken to its limit." I was wondering about implementing these windows, mainly, how do we ramp the triangle back down when it's time?

Or it could be implemented as integrators. Only the integrators need to be in hardware, the differentiation/comb part can be done in software.

It seems counter-intuitive that "throwing away" more bits will produce a better result, but that is result of my analysis. Chip, can you try a triangular filter?

EDIT: I realized that the only way the P2 was able to process the bitstream in realtime was by using the "ones" instruction for the flat top part. But it may be possible with a look up table of 8-11 bits input to count the bits with increasing weights. Then add increasing offsets to the LUT output.

I may be testing some of these theories on the P1 soon.

2,780Here's some real streams from P2 silicon.

8 channels of bitstream x 64000 clocks

13,689I'm not sure. I need to do more testing.

13,689Saucy, do you mean that for a 256-clock bitstream, we ramp up the first 128 samples and then ramp down the second 128 samples? Samples would be weighted 1..128, then 128..1, right?

13,6891,809You get multi-bit samples more quickly by using a triangular or trapezoidal sliding window that moves by a single-bit sample every clock. Bits moving up the ramp would be worth +1 compared to the last clock and bits moving down the ramp -1. You just need to keep a count of the number of '1' bits in the ramps and the plateau (if there is one).

The problem is that this requires storing samples and only very small windows could be handled by a smart pin.13,6891,329I don't know nothing about @ErNa's reaction, but at least to me, they seem like two huge and delicious icecream pots!

Thanks a lot, @ozpropdev

13,689Thanks a lot for posting this data, Ozpropdev.

14,882These SDM filters exist, but they are not compact.

Here is one example google finds, of the FPGA resource used

374Probably need to go to the CIC structure like shown on page 1.

Here's a snippet of code from evanh. The stuff in the do{}while loop needs happens for every bit in. The rest happens for every sample out. Consecutive samples will not be entirely independent.

Having the sums calculated in hardware would be very elegant way to do the filtering. The code could just read one of the accumulators (the interval needs to be the same) and do some post-processing. Although it would have to oversample by 4x or so to get independent samples. I don't know it it's worth having a 4th order accumulator.

-James

1,809A triangular window has a gain of 0.5, whereas a Tukey window could be close to 1.0. What does that the mean for the effective number of bits?

1,809I'm not arguing in favour of Tukey at the expense of anything else. From the output of a binary counter, only a little logic would be needed to generate a small error term, which when added to the counter would create the Tukey value to add to the accumulator. One counter and two adders needed and Sinc3 requires two adders.

1,329You can easily extract two 3 out of 4, and one 6 out of 8 majority voting, almost at a glimpse!

And because two nearby Gio/Vio node-dependant groups are being hammered at the same time, you can trust cleansing one of them, based on its own history, and also in a 3 out of 4 majority voting at its neighbour.

Fantastic!

13,689How is the gain pushing 2x? Double gain adds 1 bit, right?