ΣSigmaStudio Ask AI Русский Log in

How to get an high frequency triangle output?

SigmaDSP & SigmaStudio DevPH1 Aug 23, 2010 00:00 12 replies Original on forum ↗
Subscribe
DevPH1 Question
Aug 23, 2010 00:00

Hello,

About the triangle wave generator of SigmaStudio, i have tested this at low frequencies using DAC output, the results are okay.

Have any problem if I define the frequency of triagular wave more than 20KHz (consider Fs = 96 or 192KHz)? Because I need in an app two triangle waveforms, but the frequency is about 48KHz.

The chip is ADAU1701.

Thanks,

Paulo

Audio Signal Processors

SigmaDSP Audio Processors

adau1701

ADIApproved Reply
Aug 24, 2010 00:00

Hi Paulo,

By setting the system sample rate, you will be able to create triangle waves at frequencies higher than 20 kHz. Here's an explanation of how to set the system sample rate:

How do I change the sample rate of my SigmaStudio system?
Here's an example of triangle waves at 1/16th, 1/8th, and 1/4th of the sample rate. Note that at 1/4th of the sample rate or above, there is no difference between a triangle wave and a sine wave because the harmonics are no longer included in the signal.

ef68c03ae63f0b8ed20665fd67cef901.jpg
ef68c03ae63f0b8ed20665fd67cef901.jpg
ef68c03ae63f0b8ed20665fd67cef901.jpg-450x337.jpg
ef68c03ae63f0b8ed20665fd67cef901.jpg-450x337.jpg
DevPH1 Reply
Aug 24, 2010 00:00

Thank you BrettG!

Your information is very helpful.

I think to use this triangle wave to generate an external PWM, comparing the audio with triangle wave I get an PWM on a external comparator output.

On this forum i see a discussion about the PWM generation for leds on GPIO - Can I generate the PWM with GPIO to use with audio (internally comparing the audio level with a triangle wave)?

The PWM carrier must have about 48KHz... It´s possible?

Thanks in advance.

Paulo

ADIApproved Reply
Aug 25, 2010 00:00

More information about the PWM implementation is here. It's definitely possible to jump the carrier up to 48 kHz, as long as your sample rate is 192 kHz.

https://ez.analog.com/message/12246#12246

I'm very sorry, but I missed a key part of your original post. If you're using the ADAU1701, you need to know that the ADCs and DACs will only work at 48 kHz sampling rate. If you increase the core rate to 96 kHz or 192 kHz, the converters will still be running at 48 kHz. In order to get an analog output signal at higher than 24 kHz, you'll need to use an external DAC that can run at 96 kHz or 192 kHz.

DevPH1 Reply
Aug 26, 2010 00:00

Thanks BrettG for your fast reply.

Yes, but I was thinking this PWM out in GPIO (without use the 1401´s DAC) it´s don´t possible?

I am a novice in DSP, sorry for some questions

Thanks in advance.

ADIApproved Reply
Aug 26, 2010 00:00

The GPIOs are updated at the sampling rate, so the fastest square wave you could output from these pins is 24 kHz (one cycle high, one cycle low). This is probably too slow to be used as a PWM output for audio. These GPIOs are intended for use as control interfaces such as lighting an LED or connecting external buttons. You can expand the number of channels on the ADAU1701 by using the serial data I/O ports to connect to other codecs or digital-input amplifiers.

ADIApproved Reply
Aug 27, 2010 00:00

Note: If you set the sample rate of the core to 192 kHz, you can get the GPIOs to output a maximum of 96 kHz. Still, as Jerad said, this is probably too slow to be used as a PWM output for audio.

DevPH1 Reply
Aug 27, 2010 00:00

Hello BrettG and Jerald,

The idea of use of triangle wave was to I compare (by external comparator) the audio with a ADAU1401 48KHz supplied triangle wave, then I output in external comparator the PWM carrier. But as you said, the DAC`s don´t work with this frequency of triangle wave ( I have tested this on eval board, in this case the triangle wave appears as a sinusoidal wave).

You said: "Still, as Jerad said, this is probably too slow to be used as a PWM output for audio"

The PWM carrier operating at 48KHz true is too slow to full-range audio (20Hz - 20KHz), but my circuit need only 20Hz ~ 5KHz range. It´s a class-D amplifier with PWM input, designed only for low frequencies.

I need use the ADAU´s processing, such as filters and volume controller. It´s already tested, okay. But I think to use ADAU to supply the PWM signal to source to power output stage of my project.

You Said: Note: If you set the sample rate of the core to 192 kHz, you can get the GPIOs to output a maximum of 96 kHz.

Then, I think based in this afirmation, is possible I get an 48KHz PWM output on GPIO on this chip (ADAU1401). Ok?

Because Jerald said: "The GPIOs are updated at the sampling rate, so the fastest square wave you could output from these pins is 24 kHz (one cycle high, one cycle low)..."

Thanks in advance.

Paulo

ADIApproved Reply
Aug 30, 2010 00:00

Jerad was referring to the 48 kHz case, where the maximum frequency you can generate in the core and on the GPIOs is 24 kHz.

If you set the core at 192 kHz, then the maximum frequency you can generate in the core and on the GPIOs 96 kHz.

The problem is that the carrier signal stops resembling a triangle wave at about fs/4.

Anyways, I attached some examples of PWM so you can see the results. In all of these examples, the sample rate was 192 kHz.

Carrier = 12 kHz, Modulation = 1 kHz

Carrier = 24 kHz, Modulation = 1 kHz

Carrier = 48 kHz, Modulation = 1 kHz

Carrier = 48 kHz, Modulation = 5 kHz

b44dba935cd35b0ebc04496765e5560b.jpg
b44dba935cd35b0ebc04496765e5560b.jpg
b44dba935cd35b0ebc04496765e5560b.jpg-450x226.jpg
b44dba935cd35b0ebc04496765e5560b.jpg-450x226.jpg
53cf2a176b71c05fa4ca78d96077601e.jpg
53cf2a176b71c05fa4ca78d96077601e.jpg
53cf2a176b71c05fa4ca78d96077601e.jpg-450x225.jpg
53cf2a176b71c05fa4ca78d96077601e.jpg-450x225.jpg
60ca23d8e81847bb9c96b4974ae839ba.jpg
60ca23d8e81847bb9c96b4974ae839ba.jpg
60ca23d8e81847bb9c96b4974ae839ba.jpg-450x115.jpg
60ca23d8e81847bb9c96b4974ae839ba.jpg-450x115.jpg
ba72fda88df35798cda50d5c86d5b699.jpg
ba72fda88df35798cda50d5c86d5b699.jpg
ba72fda88df35798cda50d5c86d5b699.jpg-450x114.jpg
ba72fda88df35798cda50d5c86d5b699.jpg-450x114.jpg
ADIApproved Reply
Aug 30, 2010 00:00

Also, be aware that the drive strength on the GPIO pins is only rated at 2 mA.

CelsoSC Reply
Oct 6, 2011 00:00

Hello Paulo,

I'm just curious if you managed it to drive a class D amp with this approach.

CelsoSC Reply
Oct 6, 2011 00:00

BrettG,

If I have the triangle on the GPIO pins and an audio signal on the DAC output, would both signal be synchron in relation to each other because of the sample rate ? What would be the delay between the signals ?

ADIApproved Reply
Oct 7, 2011 00:00

There will be a delay in the DAC due to the interpolation filters, but I'm not sure exactly how many samples. You can insert a delay in the project's GPIO path to compensate for this.

iPodから送信