Goertzel Question: How to Check for new Result without Blocking
Christof Eb.
Posts: 1,214
in Propeller 2
Hi, sorry, another question about Goertzel mode.
In the examples I know of, there is a XCONT immediately followed by a GETXACC. The xcont will wait to complete the previous sampling, so GETXACC reads the last full sampling.
If I want to use the cog in parallel to Goertzel, how can I check, if there is new data completed without blocking?
Thank you! Christof
Comments
The XMT event flag gets set when the streamer is ready to accept a new XCONT/XZERO, so you could use POLLXMT to check for that ( or assign an IRQ to the XMT event ).
XFI is the streamer finished event, as opposed to streamer empty (XMT)
So, it seems you could have a non-blocking processing loop that includes a JXFI pointing to a XCONT / GETXACC X / MOV Y, 0 sequence to handle the streamer ops.
That doesn't read well. The "some number" isn't very precise wording. I'd imagine the number is exactly what was specified in the previous command.
XFI is when the streamer completely runs out of data, XMT is when the command buffer is ready. I think he wants the latter.
I've been looking at Chip's examples and I'm unsure if the extra buffer is present in Goertzel mode. I don't see any mention in the docs of the buffering being any different but the code comments and the long command times would suggest there is only room for the operating command. If a second command could be buffered then the "get prior Goertzel acc's" comment wouldn't be in phase.
EDIT: Although, there isn't really anything to compare result phase with I don't think. GETXACC could be pulling out results from two commands earlier and no one would know.
I don't think, that there is double buffering for the accumulators. Just the actual sum is read, I think. Therefore it must be xfi, otherwise the result will be dependent on the time. Must try.
No, if you wait for XFI, there will be a disruption in streamer activity (I think, not sure what goes on in DDS mode when the streamer runs out of commands). Eitherhow, your sampling rate would go funky.
Ok, If XMT is the relevant event then the processing loop could contain a JXMT pointing to the XCONT / GETXACC X / MOV Y, 0 sequence.
POLLXMT could be use with conditionally executed code to feed the next streamer command and get the results, but that needs a flag free to hold the condition. The downside of using JXMT is slightly longer execution time because of the branches.
Some update:
1. If the number of cycles of the streamer is done without buffered command waiting, DDS (and accumulation) stops.
At the moment for continuous DDS I resolve to a second cog, which will be blocked. ((Kind of silly to dedicate a cog which could do the Goertzel in software....))
Thanks for the inputs!!!