Shop OBEX P1 Docs P2 Docs Learn Events
Goertzel Mode Questions — Parallax Forums

Goertzel Mode Questions

Hi as written in the other post I am lost again with P2's docu. So may I ask here?

I am trying to implement Goertzel Mode in Taqoz, starting from the example page 37 in https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit#
Unfortunately in Taqoz LUT is used partly and the first pins are not available too, so I must change several things at the same time.

I want to output on pin 44.
Input on pin 46.
Table in LUT starts at $0100. Length of table is 64 longs.
1. As in the example I have sin:cos:0:0 in the table, is this usable for any 2 pins?

I need to know
2. dds_d and
3. dds_s for:
xcont dds_d,dds_s 'issue Goertzel command
At the moment I believe dds_s is
%0000_0001_011 << 9 + sinTabStart ?

  1. Is it possible to use the Goertzel mode in parallel with assembler Hub code?

My main problem seems to be how to specify the pin numbers to xcont.

Thanks for any hints!
Christof

Comments

  • VonSzarvasVonSzarvas Posts: 3,280
    edited 2022-10-27 11:30

    There's a couple of Goertzel demo's in the PNUT zip archive. I've attached the versions I have, and you might find newer/better/more versions in the latest PNUT zip.

    There's a good amount of comments in the code files, and hopefully they will help explain the configuration you need to understand.

  • @VonSzarvas said:

    Thank you. I would have preferred direct answers to these direct questions!
    So guessing goes on.
    (((Is Chip the only person at Parallax who understands these things?)))

    One of my misunderstandings seems to be that the output pin is NOT specified in the xcont but in the WRPIN of the pin, that will be used as output. In that command you have to specify, which cog will send the data.

  • @"Christof Eb." said:

    @VonSzarvas said:

    Thank you. I would have preferred direct answers to these direct questions!
    So guessing goes on.

    Please don't mistake my reply for anything more than an attempt to share the resources that I use to look up SmartPin API info when I need it.

  • BTW... If Chip is not able to reply when his timezone comes around, then I could figure out a more "direct" explanation for you. At least addressing the SmartPin part, not the Taqoz bit.
    I'd need some time to set up some code and experiment first with this specific case- that's all.

  • @VonSzarvas said:
    BTW... If Chip is not able to reply when his timezone comes around, then I could figure out a more "direct" explanation for you. At least addressing the SmartPin part, not the Taqoz bit.
    I'd need some time to set up some code and experiment first with this specific case- that's all.

    Great offer, thanks!
    I think, I will be able to translate some code for TAQOZ, if the answer to question 4 is yes. Is it?

  • OK, managed to get the DDS output. The input does "something" too.
    What a fight!
    If this really works, I will post the Taqoz code.

    Please, please, please, Parallax, write better documentation!

    The sentences "In every mode, the three %ppp bits in D[22:20] select the pin group, in 8-pin increments, which will be used as outputs or inputs, for up to 32-pin transfers. The selection wraps around:"
    are downright wrong, I think?!

  • @"Christof Eb." said:
    Hi as written in the other post I am lost again with P2's docu. So may I ask here?

    I am trying to implement Goertzel Mode in Taqoz, starting from the example page 37 in https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit#
    Unfortunately in Taqoz LUT is used partly and the first pins are not available too, so I must change several things at the same time.

    I want to output on pin 44.
    Input on pin 46.
    Table in LUT starts at $0100. Length of table is 64 longs.
    1. As in the example I have sin:cos:0:0 in the table, is this usable for any 2 pins?

    I need to know
    2. dds_d and
    3. dds_s for:
    xcont dds_d,dds_s 'issue Goertzel command
    At the moment I believe dds_s is
    %0000_0001_011 << 9 + sinTabStart ?

    1. Is it possible to use the Goertzel mode in parallel with assembler Hub code?

    My main problem seems to be how to specify the pin numbers to xcont.

    Thanks for any hints!
    Christof

    Decoding your values for dds_s renders
    Base pin +0 is summed, Base pin +1 is ignored, Base pin +2 is ignored, Base pin +3 is ignored, and 64 entry LUT table at sinTabStart.
    This would make pin 44 an input.

    If you want pin 46 as the input then in addition to setting up pin 46 for ADC, dds_s should be:
    %0000_0100_011 << 9 + sinTabStart

    dds_d from the example decodes to:
    %1111 -> DDS/Goertzel mode
    %0000 -> no streamer DAC output
    %0 -> SINC1
    %0000 -> pin group 3 to 0
    %111 -> DDS/Goertzel mode

    but you've already worked out how to get the DDS working, so no suggestion needed there.

    @"Christof Eb." said:
    OK, managed to get the DDS output. The input does "something" too.
    What a fight!
    If this really works, I will post the Taqoz code.

    Please, please, please, Parallax, write better documentation!

    The sentences "In every mode, the three %ppp bits in D[22:20] select the pin group, in 8-pin increments, which will be used as outputs or inputs, for up to 32-pin transfers. The selection wraps around:"
    are downright wrong, I think?!

    You’ve partially quoted the section that talks about the things that are common to all streamer modes. What you’ve missed quoting is important for DDS/Goerztel too:

    For modes which involve less than 8 pins, lower-order %p bit(s) in D[19:19..17] are used to further resolve the pin number(s).

    You also seem to have missed, or not understood, the statement on page 35 that refines the definition more directly.

    The four-pin input block is selected by the %pppp bits in D/#[22:19], where %pppp*4 is the base pin. One to four of these pins should be configured for ADC mode, so that their IN signals are raw delta-sigma bit streams, with no smart pin mode selected. For IN bitstream summation, '0' values are treated as -1 and '1' values are treated as +1. For cases of two or four input channels summed together, the sum is always even, so it is shifted right by one bit to conserve multiplication and accumulator resources.

  • @AJL said:

    @"Christof Eb." said:
    Hi as written in the other post I am lost again with P2's docu. So may I ask here?

    I am trying to implement Goertzel Mode in Taqoz, starting from the example page 37 in https://docs.google.com/document/d/1gn6oaT5Ib7CytvlZHacmrSbVBJsD9t_-kmvjd7nUR6o/edit#
    Unfortunately in Taqoz LUT is used partly and the first pins are not available too, so I must change several things at the same time.

    I want to output on pin 44.
    Input on pin 46.
    Table in LUT starts at $0100. Length of table is 64 longs.
    1. As in the example I have sin:cos:0:0 in the table, is this usable for any 2 pins?

    I need to know
    2. dds_d and
    3. dds_s for:
    xcont dds_d,dds_s 'issue Goertzel command
    At the moment I believe dds_s is
    %0000_0001_011 << 9 + sinTabStart ?

    1. Is it possible to use the Goertzel mode in parallel with assembler Hub code?

    My main problem seems to be how to specify the pin numbers to xcont.

    Thanks for any hints!
    Christof

    Decoding your values for dds_s renders
    Base pin +0 is summed, Base pin +1 is ignored, Base pin +2 is ignored, Base pin +3 is ignored, and 64 entry LUT table at sinTabStart.
    This would make pin 44 an input.

    If you want pin 46 as the input then in addition to setting up pin 46 for ADC, dds_s should be:
    %0000_0100_011 << 9 + sinTabStart

    dds_d from the example decodes to:
    %1111 -> DDS/Goertzel mode
    %0000 -> no streamer DAC output
    %0 -> SINC1
    %0000 -> pin group 3 to 0
    %111 -> DDS/Goertzel mode

    but you've already worked out how to get the DDS working, so no suggestion needed there.

    @"Christof Eb." said:
    OK, managed to get the DDS output. The input does "something" too.
    What a fight!
    If this really works, I will post the Taqoz code.

    Please, please, please, Parallax, write better documentation!

    The sentences "In every mode, the three %ppp bits in D[22:20] select the pin group, in 8-pin increments, which will be used as outputs or inputs, for up to 32-pin transfers. The selection wraps around:"
    are downright wrong, I think?!

    You’ve partially quoted the section that talks about the things that are common to all streamer modes. What you’ve missed quoting is important for DDS/Goerztel too:

    For modes which involve less than 8 pins, lower-order %p bit(s) in D[19:19..17] are used to further resolve the pin number(s).

    You also seem to have missed, or not understood, the statement on page 35 that refines the definition more directly.

    The four-pin input block is selected by the %pppp bits in D/#[22:19], where %pppp*4 is the base pin. One to four of these pins should be configured for ADC mode, so that their IN signals are raw delta-sigma bit streams, with no smart pin mode selected. For IN bitstream summation, '0' values are treated as -1 and '1' values are treated as +1. For cases of two or four input channels summed together, the sum is always even, so it is shifted right by one bit to conserve multiplication and accumulator resources.

    Thank you!
    Yes, there is a lot of information somewhere and I had great difficulty to select and combine the correct and relevant bits of it. Yes and silly me did not understand some things. My biggest problem was, that I did not know of the concept of the "dac-channels", so I did not even ask the right question, how the output pin is defined. I assumed, that the output pin has to be defined in the xcont statement too somehow.
    Well, if it says in a document "in every mode..." than I am used to believe , that it means "in every mode....". It is very special that in Parallax documents, it means "in some mode".

  • evanhevanh Posts: 15,192

    The Silicon Doc isn't wrong. It's just a general statement that isn't all that useful. Those upper three %ppp bits are always used for pin group select. Just they aren't always for both ins and outs. And sometimes there is finer groupings that require extra bits.

    Silicon Document Quote:
    In every mode, the three %ppp bits in D[22:20] select the pin group, in 8-pin increments, which will be used as outputs or inputs, for up to 32-pin transfers.

    On its own, that sentence could be removed and no one would notice. However, that sentence supports the subsequent table in the document that shows the pin mappings of those three bits. Maybe a larger document will have more tables showing the mappings for each major streamer mode and no longer have a generic table and description.

  • @evanh said:
    The Silicon Doc isn't wrong. It's just a general statement that isn't all that useful.

    In every mode, the three %ppp bits in D[22:20] select the pin group, in 8-pin increments, which will be used as outputs or inputs, for up to 32-pin transfers. The selection wraps around

    Well if these sentences are not to be called wrong, despite "outputs" and "wrap around" are not true for Goertzel mode and for this a pin group has 4 pins. Then perhaps we can agree that they can be called Smile.

  • evanhevanh Posts: 15,192

    Ease up, it does say or inputs. Everyone agrees more documentation is needed.

Sign In or Register to comment.