Goertzel mode differences
SaucySoliton
Posts: 521
in Propeller 2
I've been using Goertzel mode in a creative way to make it function as a window filter. More: forums.parallax.com/discussion/comment/1476671/#Comment_1476671 For this to work, it needs to capture the accumulator exactly when the NCO rolls over. If it is even 1 sysclock late, a bit near the top of the triangle will be missed. That can have a noticeable effect on the output. There is an interrupt for NCO rollover, but that seems to delay the accumulator sampling.
The code does not use the Goertzel sinc2 mode. There isn't time for the extra cycles.
My video capture code performed noticeably worse on rev b. I eventually found that offsetting the window function is able to reclaim most of the loss. The NCO advances by 6.17 steps each clock. So the optimal offset is 6. But, to keep the correct frequency sometimes it needs to advance by 7 steps. It seems that there has been a one sysclock shift in when the Goetzel accumulators are sampled. The concern was whether the offset fully compensates for this. It doesn't. There are much more frequent deviations outside of the expected Gaussian distribution from ADC noise. Frequent enough to be seen on the histogram. Yet, somehow the peak-to-peak noise is reduced slightly.
The output from the scope filter looks quite good. Just need a good way to add multiple channels together.
The code does not use the Goertzel sinc2 mode. There isn't time for the extra cycles.
My video capture code performed noticeably worse on rev b. I eventually found that offsetting the window function is able to reclaim most of the loss. The NCO advances by 6.17 steps each clock. So the optimal offset is 6. But, to keep the correct frequency sometimes it needs to advance by 7 steps. It seems that there has been a one sysclock shift in when the Goetzel accumulators are sampled. The concern was whether the offset fully compensates for this. It doesn't. There are much more frequent deviations outside of the expected Gaussian distribution from ADC noise. Frequent enough to be seen on the histogram. Yet, somehow the peak-to-peak noise is reduced slightly.
' 2A silicon open lead std_dev = 1.3883 extremes 51-70 = 19 ' 2B silicon open lead std_dev = 6.6866 offset 0 extremes 40-72 = 32 ' 2B silicon open lead std_dev = 2.7117 offset 5 ' 2B silicon open lead std_dev = 1.5955 offset 6 extremes 48-66 = 18 ' 2B silicon open lead std_dev = 2.3679 offset 7 ' Math note 128/(280/13.5)=6.171429 steps advanced each sysclock
The output from the scope filter looks quite good. Just need a good way to add multiple channels together.
Comments
Maybe a flat-topped window like Tukey can reduce some of issues.
I'll look into trying non-overlapping samples for reference.
I assume that this clock offset doesn't affect anything other than Goertzel mode?
That's a neat approach you are taking.
If you are taking multi-NCO-cycle measurements, the LUT loop should be a continuous function and you can read the accumulators at the end of each N cycles, while keeping DDS/Goertzel running continuously. In that case, you can just offset your LUT loop data by a sample, or two, if needed.