Shop OBEX P1 Docs P2 Docs Learn Events
Goertzel mode differences — Parallax Forums

Goertzel mode differences

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.
'   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

  • cgraceycgracey Posts: 14,153
    I think the only difference for SINC1 mode in Rev B silicon is that there is one additional clock delay for ADC data coming into the Goertzel circuit. Does that seem a sufficient explanation?
  • cgraceycgracey Posts: 14,153
    Ah, wait. There is also a one-clock delay as you're noticing. It's because of the potential for SINC2 mode, where one accumulator is added into the other.
  • I had a suspicion that this happened because of the added SINC2.
  • cgraceycgracey Posts: 14,153
    Could you trim your sin/cos table to be within the 512-sample boundary, so that the end samples are zeroes? It would require a slight frequency adjustment. That would only work for single NCO cycles, of course.
  • No sin/cos, I have a ramp up and ramp down. The ramp up and ramp down are added together to produce overlapping triangular windowed samples.

    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?
  • cgraceycgracey Posts: 14,153
    It's just Goertzel mode that has this extra-clock issue.

    That's a neat approach you are taking.
  • cgraceycgracey Posts: 14,153
    I think if you are taking single-NCO-cycle measurements, you might want to have a few zeroes at the ends of the LUT loop.

    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.
Sign In or Register to comment.