Wave Sources + Value Cross + Pulse Count... What's the Freq?
Hello,
In the attached project something is happening that I cannot understand...
Why counter is growing by 1 unit approximately every 8 seconds?
I expected it to grow by 2 units every second, since the square wave is actually crossing the 0.3 value two times per cycle.
Is it some numeric format issue?
Thank you in advance
tom
p.s.: by the way... no chance of displaying the waveform in the Graph...
counter
crossing
frequency
tommi,
This one stumped me for a few minutes, but I figured it out now!
The value output by the pulse counter is 28.0, but the DSP Readback cell on the ADAU1701 can only read back in 24.0 format because the readback registers were only designed to be 24 bits long. We updated the readback capability in newer SigmaDSPs (ADAU1761, ADAU1781, ADAU1442) to be a full 28 bits.
So, you're basically missing the bottom 4 bits, which means that the readback value is only incrementing once every 16 pulses (or 8 seconds, in the case of a 1 Hz square wave).
That's a limitation of the ADAU1701's hardware.
More information is available here:
https://wiki.analog.com/resources/tools-software/sigmastudio/usingsigmastudio/numericformats
A-ha!
Thank you Brett, I could not get it... and honestly, there is nothing about this specific format mismatching on the page you attached (which I have read many times, anyway), actually there is nothing about the 24.0 format on that page!
So, basically, I can go on trusting that the algorithm will work as supposed to.
Again, thank you for your support
Tom
Just think of 24.0 as the same concept of 5.19, but with the decimal point shifted. Basically, the readback registers are limited to 24 bits, which is unfortunate. The 4 LSBs are truncated, which means you lose the bottom four bits of resolution. In 5.19 format (an audio signal, for example), this is OK because the least significant bits represent a very tiny part of the signal, so the decreased resolution is OK. However, if you want to read integer values, normally in 28.0 format, you'll be missing the 4 LSBs, meaning that your resolution is limited to multiples of 16 instead of multiples of 1. I hope that makes sense!
Yep, it makes a lot of sense (0.5 * 16 = 8)!
I'm afraid I expressed myself badly... when I wrote "I could not get it" I meant "I could not get it by myself", but it was immediately clear as soon as you answered first time
Thanks again
Tom
No problem!
By the way, you can get around this issue (at least when you're debugging in SigmaStudio) by multiplying the signal by 16 before sending it to the DSP readback cell. That way, you're basically shifting all bits by 4. Since the largest number that can be represented in 5.23 format is actually 15.9999999 (not quite 16), you need to actually perform two multiplications... x4, x4. That will show you the LSB in the DSP readback cell when you put it in 24.0 format.
Please log in to reply.