Direct audio output from FPGA pins

I'm playing around with sigma-delat ADC and DAC for audio. It's amazing how good this works without any active components. Just Rs and Cs.

The question now is: Can I hook a speaker direct to the output pins of an FPGA?

The idea is to omit any passive components as the speaker acts as low-pass filter and to use two pins, feeding one with the inverted sigma-delta stream (or PDM), to build a bridge amplifier (class D?). With 3V3 output swing this should result (on an 8 Ohm speaker) in an output power of:

Peff = Ueff^2/R = (Up/sqrt(2))^2/R = = (3.3V/2*sqrt(2)/sqrt(2))^2/8Ohm = 340mW

First question: Is the multiplication with sqrt(2) correct? The idea is that it is a class D amplifier with rectangular output resulting in a sine wave that is sqrt(2) times higher than Up of the square wave.

Second question: Is the inductive load from the speaker an issue for the output drivers?

Martin

Reply to
Martin Schoeberl
Loading thread data ...

I think the thing you have forgotten is the output driver resistance (or drive current capability). Peak current would be ~400 mA! Would probably work ok with about 20 outputs in parallel...

(or one of those little PMOS/NMOS SOT23 MOSFET pairs)

Peter Wallace

Reply to
Peter C. Wallace

TI have a range of Class D amplifiers, so their data gives good info on Filterless Class D.

You are pushing things a little doing this straight into the FPGA [ I hope it's a cheap one :) ] If you work 3.3V / 8 Ohms, that's 412mA, into a bridge load, you are asking for - from a single IO pin.... ?!

Possibly on a whole port/bridge side ?

-jg

Reply to
Jim Granville

So you would have one pin driving a High into the 8 Ohm speaker, while the other pin sinks a Low. No pin would ever be negative, but you have the drive impedance plus the sink impedance in series with the speaker. Each of the three might be around 8 Ohm, for a total of 24 Ohm, and a peak current closer to

100 mA. If you pick the strongest output standard, you still will have limited aplitude. I agree with the suggestion of a low-cost Clas-D amplifier instead. Peter Alfke
Reply to
Peter Alfke

OK, I forgot the output resistance. So let's suppose Imax of 100mA:

Peff = (Imax/2)^2*R = 20mW

That's perhaps enough for a head phone.

However, the question if I will burn my FPGA still remains. Two issues: The maximum current: There is no maximum rating in the data sheet of the Spartan-3, in the Cyclone data sheet the absoulte maximum rating is

25mA.

The second: A speaker is an inductive load. When we switch the output the energy stored in the L will still drive the current resulting in high voltage peaks until the 'current finds it's way'. Will this damage the output driver? Shall I use external diodes to VCC and GND like the self-induction recuperation diode used on a relay?

Martin

Reply to
Martin Schoeberl

I used most of the Xilinx FPGAs over the years, and never broke any of them with a short to ground or Vcco. They just warm up a bit!

Provided you never tri-state the output pins, there's always a path for the current. However, as you switch, this happens:-

Immediately before switching Output_1 => Vout1 --this one is driving high Output_2 => Vout2 --this one is driving low

Immediately after switching (current in speaker remains constant) Output_1 => -Vout2 --this one now driving low Output_2 => 2Vcco - Vout1 --this one now driving high

Where Vcco is the IO supply. This assumes that the output resistance of the positive driving and negative driving IO pins stays constant with voltage. You could simulate with (or just read) the IBIS files to get exact answers. So, I reckon an 8 ohm speaker is gonna break your pins, unless you use a awful lot of them so that Rout

Reply to
Symon

FWIW, we did a pattern generator based on an FPGA. Some of the outputs ran through RS-422 drivers. As a goofy test, we cooked up a pattern that would use PWM to play music through the diff output. We used caps between the diff driver and the speaker as a DC block.

It sounded like an AM radio, but it worked.

-a

Reply to
Andy Peters

Reply to
Peter Alfke

Martin Schoeberl ( snipped-for-privacy@mail.tuwien.ac.at) wrote: : I'm playing around with sigma-delat ADC and DAC for audio. It's amazing : how good this works without any active components. Just Rs and Cs.

: The question now is: Can I hook a speaker direct to the output pins of : an FPGA?

Others have commented on the mismatched driver and speaker resistance which will limit power transfer - you might get better results from a single raw IO pin using a piezo sounder, as found in 'novelty' cards and crystal earpieces - I don't have any numbers to hand but I'm guessing these will have a higher capacitance, lower inductance and higher resistance, so will still provide low pass filtering, but will represent better power transfer from the FPGA.

After all you can build an AM reciever using one of these that is audiable where the only powre source is 15 meters antanna wire...

--
cds
Reply to
c d saunter

The sigma-delta works really well, and the faster you clock it the more equivalent bits you get. You'll have to parallel a bunch of pins to get enough drive for an 8 ohm speaker, and you'll still end up with a sizable loss due to the driver impedance. You could add a simple transistor stage to each pin to boost the current up and still keep the parts count low. The sigma-delta will drive a 600 ohm headset with no problem (I did that with the shortwave radio demo shown on my website). You can also drive a set of powered PC speakers through a single pin.

--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
 Click to see the full signature
Reply to
Ray Andraka

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.