MultiPurpose pin jitter on ADAU144x
I'm finding that I can't get a stable fast (10kHz) square wave out of the MultPurpose pins on my ADAU1445. My scope is telling me it's rock solid 10kHz but I see it scooting around. When I use the pin without a core pull-up I see some sort of signal rippling through it.
I've attached a test project.
Audio Signal Processors
square
core
pins
pull-up
purpose
sine
multi
jitter
adau1445
mp
sigmastudio
SigmaDSP Audio Processors
wave
multipurpose
frequency
SigmaDSP
sin
without
with
Show More
The MPx pin outputs are each updated once per audio frame at the core's sampling rate. So, assuming a 48 kHz fs, the highest-frequency square wave you could generate would be 24 kHz (one frame high, one frame low). The next-highest frequency perfect square wave (50% duty cycle) that you could generate would be 12 kHz (two frames high, two frames low). You may see here that if you want to generate a square wave at a frequency such as 10 kHz, you are not going to be able to do so with a 50% duty cycle on each frame. In order to do this, you would have to be able to update the output signals at a 20 kHz rate, which is not an evenly-divided rate off of the 48 kHz core sampling rate.
I didn't have a chance to look at your attached project, but hopefully this explains what you're seeing with your setup.
In this context of this discussion, the primary difference between what you can do with the I2S outputs and the MP outputs is that the I2S ports have a 24-bit resolution, while the MP pins have essentially a single bit of resolution. A pure sine wave (single tone) requires only 2 points/cycle to perfectly recreate it digitally (essentially, the Nyquist theorem). A square wave is a a series of sine waves at harmonically-related frequencies. The fundamental frequency component of a 10 kHz square wave is a 10 kHz sine wave, but also includes frequency components at 30 kHz, 50 kHz, and other odd harmonics. Even if you're sampling at 192 kHz and are generating a square wave your output signal won't include any frequency components above this 50 kHz tone, which means that your output signal will look somewhat like a square wave, but it won't have crisp, square edges at each high-low and low-high transition. With the 24-bit resolution of the I2S port, you'll see the rounding on these non-ideal transitions, but with only 1 bit of resolution on the MP pins you're only going to see the signal high or low. On some edges, this transition will happen a bit earlier than expected, and on others it will happen a bit later, which results in the jitter that you're seeing.
If we use your specific example of generating a 10 kHz square wave with fs=192 kHz, we ideally want to see:
Output period: 1/10000 = 100 us
Half period (time high or low) = 50 us
Sampling period: 1/192000 = 5.2 us
Half period (time high or low) = 2.6 us
You ideally want your square wave to be high for 50 us and then low for an equal 50 us. However, with fs=192 kHz, your output can be high or low for 19 sampling periods (49.4 us) or 20 sampling periods (52.0 us). If we assume that your output remains within these minimum and maximum periods, then the worst-case limits of your output frequency will be:
Low limit: 9,615 Hz (2 x 49.4 us period)
High limit: 10,121 Hz (2 x 52.0 us period)
The long-term average frequency of your square wave from the MP pins should be right around 10 kHz, but for any one cycle you are going to see jitter that will make your instantaneous frequency somewhere between the two limits listed above.
When I run it at 192kHz the jitter is less so what you are saying supports that except I can generate perfect sine waves out the I2S at even higher frequencies. I can't imagine there's a real limitation like that on square wave using the MP. I can understand the 48kHz update rate of the pin, that one is obvious, and not being ablt to make a square wave above 24k makes sense as well, but you can't be really be saying that I can only make consistent square waves at 50% unless the frequency is a multiple of 48kHz?!?!
Here is a picture of the project
Good point. I guess I'll have to scratch the idea of using the MP pins as a stable square wave source for anything even at an arbitrary duty cycle.
This question has been closed by the EZ team and is assumed answered.
Please log in to reply.

