Follow
Us
|

Table of Contents

Introduction

Setting
design specifications

From
specification to selection

Choosing
and controlling an audio processing scheme

Clocks,
clocks, clocks

Power
amplifiers, power supplies and ESD protection

Layout

Software's
role

References

About
the Author

www.ti.com/audio

June 2014

Introduction
Soundbar Design from Start to
Finish

The
product development process is a long and winding road, with more than a few
potholes along the way.

Through numerous customer meetings over the
years, I've worked through many product developments alongside product managers,
product designers, embedded programmers and industrial engineers. I've been
there through the happy times "Oh, it's awesome – we do all the processing in
your amplifier chip!" through to "Why doesn't my I2C bus work?" I've
seen products from the initial marketing specification, through the design
process, and over to the ramp production phase.

When I was going
through University over a decade ago, there were plenty of guides and university
textbooks that taught us how to set the value of resistors and capacitors for
analog filters, and how to bias a power transistor. What was missing was the
process of developing a product in the real world. The "hitchhikers guide to
product design," if you will, with big bold words on the back that read
something soothing like "Don't panic, you probably just mis-wired your speaker."

In 2009, in the middle of the hype for soundbars, we developed a
soundbar reference design (Value-Soundbar-RDK). It was a great opportunity to pull
together an entire TI-based solution from inputs, control, processing, and
amplification. These articles were published in Electronic Design. Actually,
they were really the memoirs of a product development, with all the ups and
downs, with all the decisions made, and the hindsight to say if it was a good
idea or not!

Once we went to market, we realized that the same design
could be repurposed for virtually any system that had loudspeakers, whether it
be PC or Bluetooth® speakers, guitar amplifiers, and so on. Looking
back, this guide should have been titled "Memoirs of an Audio Accessory Design!"

I hope this guide gives some value to those on the beginning of the
journey in product design. I wish I had something like this 15 years ago when I
started down this path.

– Keep the soldering irons hot and the signal
paths clean!

Dafydd

Back
to top

1. Setting design specifications

The future of consumer home audio has shifted. The priority has moved from
having speakers and wires all over the living room to a single, intelligent
product capable of emulating the audio experience of other multi-speaker
installations. This is normally referred to as a speakerbar or its aftermarket
term, a soundbar.

This article is intended to help you get started in designing your own
soundbar/active speaker dock by discussing the necessary requirements in putting
together the specification list. Future articles will discuss the subsequent
steps, including converting a marketing specification into a block diagram,
converting the block diagram into a list of devices, suggestions for layout, and
software architectures.
Set the specification

The flat-panel television, which started at around two or three inches thick,
rapidly has become thinner and thinner. The fact that televisions are now mere
millimeters thick is the deciding factor causing many manufacturers to push the
amplifiers and speakers out to a soundbar (Figure
1).

Figure 1. Now that
flat-panel televisions are only millimeters thick, many manufacturers are
pushing the amplifiers and speakers out to a soundbar.

Let's jump in feet first. Here's a specification straight off the plate of a
marketing team at a company I recently visited:

USB, S/PDIF, and three times stereo analog inputs

Stereo analog inputs should support 2 VRMS inputs

S/PDIF sources should be coax

Stereo output (two at 20 W each)

Analog subwoofer output

Wireless subwoofer option

Infrared (IR) remote control that supports the NEC or RC5 protocol

Audio processing features need to include speaker equalization (EQ),
volume, dynamic range control, and SRS WOW HD

The inspiration for these sorts of projects often happens instantly, leaving
the designer to record it on whatever's closest. The picture in Figure
2 may or may not be the actual first draft of the specs. I'll let you be
the judge of that.

Figure 2.
Specifications for a soundbar design can begin pretty informally.

Physical constraints

The total product will be 36 inches wide, with the processing board located
in the center, and the speakers located at the extremes of the enclosure. The
enclosure can be a maximum of 3 inches deep. Physical switches need to be placed
across the top of the product, allowing users to control power, volume and
effects.

LED feedback displaying volume status, effects status, and other factors
should be placed on the bottom right of the enclosure. This board also should
have an IR receiver on it to ensure that users can always contact the system
from the comfort of their couch.

It's crucial in today's home audio market that we provide a remote control of
some kind, as well as basic control functionality on the product itself. Those
of us with children and pets know all too well how poor product design can wreak
havoc on user accessibility when the remote control goes missing or when the
batteries are removed in favor of your child's latest toys. For our example,
we'll use a standard IR remote control with a handful of buttons, running
through a processor that generates IR codes in the NEC or RC5 protocol. If users
lose the remote, they can rely on the buttons on the product
itself.
Set cost targets

Let's pretend that the folks over in marketing tout a list of requirements
for the product and an end price, but have no idea if the engineering team can
actually make the product to meet the price.

If you're told, "The soundbar should resale for $99.99," this actually means
the item needs to sell for $79.99. Let's break that down in terms of a
real-world cost of build. From that $79.99 selling price, we need to take
away:

Retailer profit margin (probably around 15 to 20%)

Distributor profit margin (about another 15 to 20%)

Profit that you need to make on the product (about 15 to 20%)

Cost of shipping the product to market (for example, $8 for a product
shipped from the west coast to the east coast in the United States)

Cost of assembly and test

Cost of materials (printed circuit board or PCB, components, plastics,
speakers, and packaging)

"Front of building (FOB) cost" is the cost to build, test, and get the
product on a shipping pallet outside of your factory. In the real world, it's
very realistic to divide the street price by four to get to the FOB cost. So
with a street resale target of $79.99, that gives us a maximum FOB cost of
$20.
What are your competitors doing?

As part of developing your solution and getting to the right price point, one
of the tricks in your armory should be to look at, study, and have a healthy
respect for your competition. In short, buy their boxes, conduct your own
teardowns, make an effort to "cost" their product, and understand if you could
build it at that price to make the resale (and your profit) targets. Not only
will you learn quite a bit about their strategy, it will also prompt you to ask
yourself some other questions. For instance:

If your competitor releases a product at a lower price, do you have
enough profit in your design to lower your price and match it?

Is there anything in your architecture (such as digital signal processors
or DSP selection) that would make it difficult to move to a newer, lower-cost
platform (for example, legacy code on an old platform that doesn't have the
price roadmap that a newer platform may have)?

While copying their product would be highly unethical, and downright rude,
learning from their cost-cutting practices can ensure that you remain
competitive. Studying the weak points of their design can also give you hints on
what to improve in your own design, as well as ammunition to use with the sales
guys at Best Buy.
Design for cost

So you've got your specification, you have your target bill of material (BOM)
costs, and you've opened the competitors' boxes to have a look at what you're up
against. What now? What additional work can you do to reduce your risk and
time-to-market, improve profitability, and generally make your life easier?

First, talk to your suppliers. Chances are, they have applications support
people who are more than willing to do some legwork for you in finding the right
part for your solution. A number of them will have the skills to filter out many
of the incompatibilities that you may not spot immediately (for example, device
A cannot run on the same power rail as device B).

Partnering with a solutions provider can benefit you as you'll have much more
support for when things are not working. When device A doesn't work with device
B, there is much more accountability to solve the problem when you're partnering
with a single provider, rather than one supplier blaming the other supplier for
making shoddy products.

Where possible, look for commodity or second source products. From a
purchaser's point of view, using multiple sources makes it easier to purchase
products. However, if a silicon vendor offers you a product that differentiates
you from the competition, take it if it reduces your cost or time-to-market
risk. In the consumer market, we're all looking for ways to differentiate
ourselves from competitors. Working with your suppliers really can help you do
this. It's a win-win for both parties.

Finally, designing for cost also includes getting the best value from your
R&D team.

In finance terms, that means getting as many products out of one
development as possible.

In product manager speak, it means "multiple" stock keeping units or
SKUs.

For the rest of the world, it means multiple end products that share one
design and one printed circuit board (PCB) with either firmware changes or
various stuffing options.

Stuffing options typically are found on PC motherboards and have a lot of
space with components that are not placed.

In a soundbar, this could be something like a fully featured system with USB,
S/PDIF, and analog inputs sharing the same PCB as the product that only has
analog inputs. This allows you to save on the electronics and have two products
released at the same time, at different price points. Lovely!
The
Value Soundbar/Active Dock

Now, we're ready to start our design process. In upcoming sections, I'll show
you how we took the above specification and turned it into a real reference
design that you can copy and take to production. Each step of development will
be covered, and all of our logic will be shared. Hopefully, you'll agree with
most of it!

Back
to top

2. From specification to selection

Consumer home audio is getting simpler, as a single soundbar can replicate
the audio experience of other multi-speaker installations. These devices are not
difficult to design either. Once you have your specifications, it's time to
select your parts. First, we'll break our requirements down in terms of the
audio signal chain (Figure 1).

Figure 1. In a
typical audio signal chain, analog inputs must first pass through an ADC before
heading to the processor, whereas digital inputs can bypass the converter and be
sent straight to processing.

Sources: Analog inputs

In the real world, with analog sources like televisions, Blu-ray™ players,
set-top boxes, and gaming consoles, most if not all manufacturers stick to a
maximum input level of 2 VRMS, or about
5.6 Vp-p. Anyone with a lot of design experience can tell you this standard is a
pain to deal with, as most classic audio converters run from a +5-V analog
supply.

Figure 2. The
topolgy of a typical analog front end.

When considering a front end for our analog-to-digital converter (ADC) (Figure
2), a few things must be done:

Attenuate: We need to bring a 5.6-Vpp (2 VRMS)
signal down to one that is small enough to max out the ADC only when the
signal is at its highest level. This ensures that we won't clip the input
stage, but at the same time, take advantage of the entire dynamic range of the
ADC.

DC block: Most ADCs are not split-supply, meaning a
ground-biased input must be ac-coupled to the ADC's input (that's floating at
mid-rail). Most folks use a dc-blocking capacitor at this point. Don't forget
that depending on the input impedance of the ADC or buffer, you are
potentially creating a high pass filter. Select the capacitance carefully.
Capacitor selection should be based on the input impedance of the buffer/ADC,
maximum voltage swing, size of the capacitor, and chemistry type.

Protect: Electrostatic discharge protection (ESD) diodes are
critical at this point in the design. As a connection directly into an ADC (or
buffer) from the outside world, we must assume that the users are walking on
carpet, wearing rubber-soled shoes, and buzzing with static electricity.
Static kills poor little ICs. We can protect them with external ESD protection
diodes.

Shield: Electromagnetic interference (EMI) is something that most
people won't even notice during development, then take their product to UL
certification labs (required to resell a product at the big resale stores) and
fail miserably, with EMI spouting out of the product, even on input
connectors. A simple ferrite bead near the input and output connectors can
make a world of difference.

Sources: Digital inputs

There are many types of digital audio interfaces available. The most common,
Sony Philips Digital InterFace (S/PDIF), comes in three physical formats:
optical, coaxial, and differential (a professional audio standard known as
AES/EBU. It is slightly different, but still compatible with other S/PDIF
solutions).

Originally, S/PDIF was only used to transmit stereo pulse code modulation
(PCM) data at 44.1 kHz or 48 kHz. That quickly got extended to 192 kHz. Today,
the S/PDIF output from a product also can be in a specially encoded format. A
typical example of this is Dolby Digital® AC-3, a multichannel format that
allows 5.1 channels of audio to be transmitted over a single wire.

All that coolness comes with a price, however. Any specially encoded data
also requires a decoder on the other end. This typically takes the form of a
dedicated decoder DSP of some kind. Regular PCM data generally does not require
a data decoder, only a basic S/PDIF decoder.

To clarify, a standard S/PDIF decoder such as TI's DIR9001 takes stereo PCM S/PDIF and outputs an
industry-standard I2S. Most Dolby Digital AC-3 decoder ICs can accept
encoded data received in I2S format, recognize that data as encoded,
and then decode it. The difficulty starts when we begin to consider the effects
of different sample rates and other factors.

In a standard consumer setup, digital audio transmitted over S/PDIF is sent
in one direction. In other words, there is no feedback from the receiver to the
transmitter, no screams of "Hey, I don't support that frequency!" or "Hey, not
that format please!" This problem really starts to rear its ugly head when you
switch sample rates on the fly. DVDs can do this easily. Some content will play
back at 44.1 kHz and then suddenly jump to 48 kHz when you jump to a different
chapter or content.

This has a direct influence on any processing you have running in your
system, as most DSPs are slaves to incoming data. Any filters you have set up
will have coefficients (settings) configured to work at specific sample rates
(for example, 44.1 kHz). If you suddenly bring in a 96-kHz signal, then all the
settings, such as a lovely 80-Hz high pass filter, will suddenly be working at a
different frequency. (Frequencies in digital processing are typically referenced
as a fixed division of the sample frequency.)

There are two ways to deal with switching sample rates in a receiver: sample
rate conversion and bank switching.

Sample rate converters (SRCs) have been on the market for a
number of years now. Assuming you're dealing with a proper I2S stream
(for example, not encoded with AC-3), they can effectively provide a black-box
interface that will perform a conversion between any input (32, 44.1, 48, 88.2,
96, 192 kHz) to 48 kHz or any other system sample frequency. They do, however,
add some system cost, and this is where the bank switching option can come in
handy.

In the bank switching technique, appropriate coefficients for each sampling
frequency are stored in memory. As the sampling frequency changes, new
coefficients are loaded into the program. In a system where the designer can be
certain that only specific sampling frequencies will be used, this is a great
way to keep costs down.

The selection between SRC and a bank-switching system requires careful
considerations regarding input data expectations and budget. An SRC almost
always will add more cost than a bank-switching system, though an SRC will be
ready for virtually any input data rate.
Sources:
Computer-based

In the consumer audio space, computer interfaces that require users to
install software drivers are severely frowned upon. Developers using USB should
always try and find class-compliant USB audio devices. In the real world, this
means that upon connection to a PC/Mac/Linux system, they will be recognized and
in many cases set as the default audio port.

Such functionality is wonderful, if you're making PC speakers or an audio
dock that are well-known plug-and-play devices. However, many devices also
require the ability to download and stream content, in which case they may need
drivers. It's best to offer two levels of service in this case. When first
connected, the product simply streams using the USB audio device, and after
additional drivers have been added, additional product functionality is
enabled.

For audio-only streaming, the PCM2xxx audio codecs are excellent and easy to use. If you
require additional functionality, TI offers a wide range of DSP and TM4Cx MCU
devices offering programmable USB interfaces that can act as system controllers,
processors, and USB interfaces for your audio product.
Sources:
Apple® Devices

With customers demanding more and more functionality and quality in their
audio products, along with increased cell-phone interference, the need to move
to digital audio interfaces is slowly working its way into the market.

TI's TM4Cx MCU devices offer a solution for interfacing to Apple devices. If
you would like to develop accessories that are compatible with Apple devices,
and to find out more about the Made for iPod (MFi) licensing program, visit http://developer.apple.com/MFI.

Back
to top

3. Choosing and controlling an audio processing
scheme

Imagine the audio setup in your ideal home entertainment center. Do you want
speakers and wires all over your living room? Or would you prefer a single,
intelligent product that can emulate the audio experience of other multi-speaker
installations? You probably would like that single product, known as a soundbar – and you can build one yourself.

Previous articles have discussed the specifications and translated them into
a parts list. Now, let's talk about audio processing. Should we go analog,
digital, or dedicated processing?

It all depends on the complexity of the processing required by the system.
Some products require very simple audio frequency equalization (EQ) to
compensate for poor speaker enclosures or drivers (speakers themselves), while
others need HD decoders and multiple channels of special post-decode
processing.

For simple speaker system equalizing, (single cutoff frequency, or maybe
two), designers may be better off rolling up their analog design sleeves and
getting in there with a couple of passive devices. But for virtually any other
kind of audio processing, with anything more than EQ, digital processing really
is the way to go.
Digital solution

Many DSPs on the market today include graphic tools that allow designers to
drag and drop their audio processing signal chain. This is an excellent solution
for those requiring simplicity and speed in their design, along with complex
audio processing and branded algorithms from the likes of Dolby and Waves.

Digital solutions allow multiple effects to be created serially, all on-chip
and tweakable with a simple mouse click. They also allow dynamic effects (such
as dynamic range control, or "auto-volume" as some may know it) to be created
without expensive analog alternatives, like voltage-controlled amplifiers
(VCAs).

TI offers a wide range of solutions like this, from the TMS320C6747 low-power DSPs to the TAS3xxx multichannel audio processors, all the way down to
the baby of the family, the PCM3070, a stereo codec with integrated DSP.

Processing requirements drive the selection of dedicated processors, as
opposed to processors with integrated codecs (or codecs with integrated
processors). Typically, any mix of digital and analog on the same piece of
silicon requires a compromise on both devices.

For instance, the PCM3070, with its stereo codec, provides a more than 93-dB
signal-to-noise ratio (SNR) for its analog I/O. It also offers up to 110 MIPS of
performance across its dual miniDSPs. Compare that with a dedicated TMS320C6747
DSP, which doesn't include audio converters onboard, and the device racks up an over
2400 MIPS in its DSP alone!

Selecting the best solution will be based on cost requirements (Do you really
need a 2400-MIPs DSP for a few bands of EQ and dynamic range control? No!) and
channel I/O requirements. For example, the PCM3070 can handle up to four output
channels. But if you're driving a 5.1 system, it may not be the best solution
without some clever mixing.
System controllers

Once you've selected how you're going to process the data, the next challenge
is to figure out how on earth you are going to control the processing itself and
how your user is going to interface with your product. Let's jump in the deep
end and talk about the user interface itself. On our specification napkin, we
decided that we should offer an on-product interface, as well as a remote
control interface.

That means we need buttons (general-purpose I/O, or GPIO) and an infrared
receiver for the remote, immediately requiring multiple pins of I/O on the
processor. We also need to consider how we're going to communicate with the
other ICs in the system, which typically requires either I2C or SPI.
That takes another two pins (minimum) on our host.

So, if we count standby, volume up, volume down, input cycle, effect one, and
effect two, that's six buttons already. If we add specific buttons for inputs,
the number continues to climb.

Other inputs on the general-purpose microcontroller may include interrupts
from other ICs on the board. If the sample rate of the incoming Sony/Philips
Digital Interconnect Format (S/PDIF) signal is brought in on two pins, that's
another two inputs we need. Lock status from the S/PDIF input is another input
pin.

Once we've counted all the general-purpose inputs, we need to start looking
at the outputs. Outputs to consider include LEDs for user feedback, or direct
control of other devices that you might require within your design: things like
a "shutdown" control on the amplifier to save power, or minimized pop and click
on startup, or perhaps input multiplexers, so you can select from multiple
digital or analog sources.

Once you start adding up all these GPIO requirements, it is very easy to end
up with a 28-pin (or more) device. I/O expanders can reduce this somewhat, which
we will discuss deeper in this article. But in my experience, buying one IC is
always cheaper than buying multiple ICs for the same purpose, unless that one IC
includes many more unused features.

When you've got a good handle on the number of pins you need, start thinking
about the amount of RAM and storage memory you need (either as flash or external
EEPROM). In some cases, it may be more efficient to buy a host microcontroller
with a ton of flash memory onboard, enough to look after the housekeeping of the
system, as well as the program code required by the audio DSP.

To give you a rough idea of the memory requirements, we found that in a
typical application on the PCM3070, we can easily pack 6 kbits of code and
coefficients into the device.

In addition to that, the host controller itself will require code and
coefficients, especially if there is any kind of display to be used (other than
LEDs). Again, the amount of storage memory required begins to add up quickly,
and sharp designers must balance the cost of buying a larger flash memory
microcontroller or using an external EEPROM. Again, this is a balance between
cost, size, and used/unused functionality in the processors.

As a point of reference, for our value soundbar reference design, we selected an MSP430F2131 as the host microcontroller, along with an
external 16-kbit EEPROM. This gave us plenty of options in terms of having space
to have multiple programs for the miniDSP, as well as having options to shrink
the flash size in the MSP430™ MCU, if required. It also has just enough I/O to
make it worthy, all while keeping it reasonably priced.

The only expansion IC required is a simple I2C to GPIO expander,
which we use to drive the multiple-LED feedback on the front panel. All these
signals are outputs, which means we don't need to drive interrupts from them.
They are slow, too, making them ideal for being used offboard.

Finally, as part of a multiple stock keeping unit (SKU) strategy, designers
can choose whether or not they want the array of LEDs without changing the
layout of the rest of the system significantly (Figure
1).

Figure 1. A simple
GPIO expander can be used to increase the amount of ports without the need for
interrupts.

The unexpected

One of the best pieces of advice I received in my years of working on
customer systems was to always design for the unexpected. It is one thing to
design defensively, where you assume your design will have to be changed if
something doesn't work. It's another thing to try and stay one step ahead of
marketing.

Marketing folks are constantly looking for ways to get the right product to
the right customer. They are always searching for ways to get more products out
the door in a shorter time to a greater variety of end customers. They often
talk in SKUs, which essentially means a separate product.

Two products can have the same circuit board and components, but different
firmware for different functionalities. To the end customer, they're two
different products that may be sold next to each other on the same shelf, but
for different prices.

Each of those products is a separate SKU and typically will appeal to
different parts of the market. By designing with flexibility in mind, a good
design should be able to be expanded upon quickly and easily to create different
SKUs.

Consider adding stuffing options to your project that will allow add-on
cards, if needed, with access to the control and data buses directly from your
host processor. This will immediately enable you to add an extra pair of
channels, if needed, or to use a different amplifier in some SKUs but not others
simply by adding a card and changing the firmware. In our value soundbar
reference design, we added headers to take a wireless module and communicate
with a wireless subwoofer (Figure
2).

Figure
2. The board layout of the value soundbar reference design and its
expander port capabilities. (click to enlarge)

This simple addition allows end customers to quickly have two differentiated
products: a 2.0 stereo soundbar at one price, and a 2.1 wireless subsystem at
another price, all developed within one overall development cycle.

This has the immediate advantage of making it much simpler to pass various
CE, UL, and Federal Communications Commission certifications, based on your
primary design, as well as making inventory control simpler. Now you can use the
same board and components to build multiple products for multiple different
retail outlets and products.

Finally, such additional ports, especially those with I2C or SPI,
can be used as a programming port during production and prototyping. Very
useful!

Back
to top

4. Clocks, clocks, clocks

Clocks typically are the last thing we consider in audio
design. In many cases, they're the one thing that comes back to bite us.
Ignoring the significance of the three main clocks in traditional audio systems
can cause some devices to not play nicely with others.

The system/master clock (SMCK) typically has a sampling frequency of 128x,
256x, or 512x. In audio systems most of the clocks are a fixed 2 in multiples of
the audio sampling frequency. This clock drives most of the digital audio
processing and filtering within the audio signal chain. Analog-to-digital
converters (ADCs), digital-to-analog converters (DACs), and digital signal
processors (DSPs) usually require it.

The bit clock (BCK) generally has a sample rate of 64x or 128x. It is used in
the PCM / I2S audio stream as a clock that separates each bit in the
data stream. This is essential in 99 percent of I2S devices so the
receiver can tell the difference between a string of zeros and a single
zero.

The word clock (LRCK) is the heartbeat of any good audio system, and it
should be equal to the sampling frequency. In most systems, when this clock is
high, the left channel is being transmitted. When it is low, the right channel
is being transmitted. By synchronizing all processing and conversion to this
clock, you should have no issues with synchronization and jitter within your
audio system.

In most systems, the system/master clock is the main clock generated. From
there, dividers generate bit clock and word clock. There are caveats, however.
Some devices include a phase-locked loop (PLL) that can regenerate a local
system/master clock or, in some cases, an even bit clock from a reference clock
(such as LRCK or BCK). Bear in mind that audio PLLs bring some really great
advantages, but at some cost.

On-chip PLLs make EMI and layout issues much easier to manage. Not having to
route 24.576-MHz signals all over your PCB is going to make your life much
easier. But on the downside, audio performance occasionally can suffer as PLLs
inherently introduce some jitter.

Keep an eye on high-frequency distortion because jitter affects higher
frequencies first. Imagine moving the sampling point back and forth in time.
Lower frequencies do not change amplitude much, if you move the sampling point,
but higher frequencies may have significant differences in amplitude.

Power consumption also increases when using an on-chip PLL. This is not much
of a concern in a line-powered application like home audio. If you expect to
operate your audio system from a battery, though, it is worth
investigating.
Clock generation

First, let's start with a simple example (Figure
1). If you are working with a digital input such as S/PDIF, the receiver
probably regenerates all clocks from the input stream by using its own
integrated PLL to decode the S/PDIF into I2S. If this is the case,
unless you are using a SRC (more details later), treat the receiver as the
system's clock master. Now all other clocks and devices should sync to it.

Figure 1. Note the
clock relationship in this simple block diagram of a S/PDIF receiver driving a
processor and digital amplifier. The clocks for the entire system can be derived
from the incoming S/PDIF stream.

In an analog inputs only system, you the designer must generate an internal
master clock within your product. This master clock is used to drive the ADC,
processor and digital amplifier, if the digital amplifier requires
I2S. Most designers in the industry generate these clocks using one
of four methods:

Direct digital synthesis (DDS)
device: Some designs use a DDS device where a relatively inexpensive
IC generates a very high-speed clock. PC motherboards use this type of clock
generation. A DDS device can generate different rates on the fly. For example,
it can generate the master clock for 44.1 kHz for one setting, then switch to
96-kHz mode in another setting.

PLL circuit: Depending on
the type of PLL (fixed multiple, or multiply and divide structure), different
master clocks can be generated in a manner that is similar to DDS. PLLs
require a known clock rate to multiply/divide from or to use as a reference.
The reference can be a fixed-rate CMOS output oscillator or a Pierce
oscillator.

Fixed-rate CMOS output
oscillators: Many designers buy an off-the-shelf CMOS oscillator for
systems where the sampling rate is fixed. These simple devices tend to be very
reliable. Just add a power supply (3.3 V and GND), pull up the "enable" pin,
and you have a very clean master clock output at a fixed frequency.
Semiconductor manufacturers often use these oscillators on evaluation boards
and in systems that can afford the extra dollar or so.

Pierce oscillator: Used more in consumer audio systems, a
Pierce oscillator can be created using a simple crystal and a $0.10 piece of
logic. The Pierce oscillator is by far the cheapest way to generate a master
clock (Figure
2). Again, these systems usually have a fixed clock rate. Some
customers may use two different Pierce oscillator circuits because they are
low cost, if the system needs to support 44.1 kHz (and multiples) and 48 kHz
(and multiples: 96 kHz, 192 kHz).

Figure 2. Pierce
oscillators are easy to design. But if you expect to support multiple sample
frequencies, the solution size can increase.

Of course, nothing comes for free. While cheap in chip price, Pierce
oscillators involve other costs such as board space and a higher number of
components than CMOS oscillators. Also, the output clock from a Pierce
oscillator does not always have a perfect 50/50 duty cycle. It is actually
closer to 52/48 percent.

This doesn't cause a problem in many systems because the digital circuitry
most likely will be single-edge clocking, but it is something to consider. A
Pierce oscillator generates a single clock source. From there, it needs to be
divided down to BCK and LRCK, a task typically performed by the clock master in
your product.

Many experienced designers may have had different experiences and may have
additional advice with this next part, but this is what I have learned.

The ADC is the most critical part of any digital audio circuit. It is also
the part that is most sensitive to jitter. If you mess up the analog-to-digital
conversion, there is little you can do to compensate for it in the digital
domain. This is why the master clock is generated next to the ADC in many
professional audio systems. The ADC is used in master-mode, which causes the ADC
to divide down and distribute the SCK, BCK, and LRCK to the rest of the audio
signal chain (Figure
3).

Figure 3. In the
master and slave relationship, many designers allow the ADC to perform the clock
division from MCK to get the best ADC performance.

In our example where you have a digital input feeding a SRC, the SRC behaves
as a clock domain isolation barrier (Figure
4). The DSP and amplification system needs to run from its own clock
source, which is shared with the SRC output side.

Figure 4. Designers
can convert different clock rates to the system clock rate by
using an
SRC.

This type of system allows simple switching from analog to digital inputs, as
the data rate is synchronized from an ADC or SRC (S/PDIF source). This method is
nice and easy. Without the SRC, the system must mute, clear the processing
pipeline, switch the sample rate (bank switching), start running data through
the new pipeline, and unmute.

One final note: never, ever try to transfer data from one system to another,
such as going from a CD player S/PDIF output to a DAC input, without the slave
side locked in to the transmitter (Figure
5). In most systems, the DAC input slaves to the S/PDIF. If they do not,
users will have lots of noise issues with pops and clicks.

Figure 5. The
difference in clock rates as device A transmits to device B (both with their own
crystals) generate overruns and underruns in buffered audio memory due to their
asynchronous behavior. Eventually this will cause pops and clicks.

You may have two crystals that say they are both 48 kHz, but that does not
mean they are exactly the same. Any drift in specification causes the
transmitter to generate data faster or slower than the receiver. This
immediately causes buffer underruns or overruns, which cause lots of pops and
clicks (bad for speakers), and potentially can crash your system.

There are ways around this using buffers and generating interrupts once the
receiving buffer is mostly empty or mostly full. However, that is another
article waiting to be written. Designers involved with USB/FireWire® and other
non-time-guaranteed protocols typically have lots of experience with this.

Our multi-SKU (end product from same design) strategy drives the need for
multiple clock generation strategies. In the value soundbar reference design, we
have two stuffing options for clock mastering. We use the DIR9001 S/PDIF
receiver that, when locked, generates all clocks for us. When unlocked, it
simply uses an onboard crystal with some dividers to generate an "analog mode"
clock source (Figure
6).

Figure 6. The
DIR9001 circuit uses the CKSEL pin to select between the S/PDIF clock recovery
outputs, or the reference crystal to generate the clocks for the system. CKSEL
can be connected to the S/PDIF lock pin on the device for auto
switching.

For systems with digital inputs, the S/PDI receiver uses the crystal as a
reference to calculate the sampling rate. When the S/PDIF is unlocked, the
S/PDIF receiver (DIR9001) then generates the audio master clock for the
system.

For analog-only systems, use the same crystal footprint to save PCB space.
However, use an additional buffer in place of the DIR9001 to generate a fixed
24.576-MHz clock. This is divided down by the PCM3070 for use in its codecs and
multiplied to a higher frequency (using a PLL) for use in the miniDSP. Doing so
saves the cost between using the DIR9001 and using a $0.10 crystal buffer in the
systems.

Back
to top

5. Power amplifiers, power supplies and ESD
protection

We have analyzed inputs, signal processing and clocks, and used the analysis
to put together a workable soundbar design. We are now ready to get audio
signals into an amplifier and out to some speakers.
AB versus
D

The strengths and weaknesses of class AB and class D amplification have been
analyzed many times. For the soundbar reference design, size and heat generation
are the primary design considerations, so we'll limit the discussion to those
points.

Unless the product's form factor (such as an extremely thin TV) is
significant, class AB amplifiers should be fine for anything up to about 5 W per
channel. Above 5 W, heat dissipation might be a problem, unless the amplifier is
in a large enclosure (such as an AV receiver) and has heatsinks. A hot-running
amplifier is inherently less reliable and might result in a bad "user
experience," if the user unexpectedly contacts it.

The value soundbar reference design specification calls for two
channels of 15 W each. This requires class D amplification, because there is no
spare room for large transformers and heatsinks.
Chip or
discrete?

Now that we have decided on class D, should the amplifier be assembled from
discrete components, or use a single chip? Discrete components might be less
expensive, but time-to-market and having the prototype work the first time are
arguably more important than parts cost. A manufacturer-tested IC significantly
reduces the probability of extensive troubleshooting or product
redesign.
Analog or digital input?

The next step is to decide on what type of signal the amplifier will be
amplifying. Class AB amplifiers require an analog input. Class D amplifiers can
handle a variety of signal formats (though a given amplifier is usually designed
for only one):

Analog (including DAC output)

pulse-width modulation (PWM)

I2S

The single-chip TPA3110D2 amplifier selected for the soundbar has its own
PWM modulator and natively handles analog inputs. You can drive it with a
line-level signal, or the output of a DAC (Figure
1).

Figure 1. This is
the value soundbar reference design amplifier section. The speaker connections
are not shown.

Some class D amplifier chips omit the PWM modulator, "banishing" it to a
separate chip. This minimizes interaction between high- and low-level circuitry.
More importantly, it also allows the amplifier to be built with high-voltage
geometry. Outputs up to 600 W from a single IC become possible.

The newest type of switching amplifier accepts an I2S input,
converting the I2S data into a PWM drive signal. These amps are easy
to work with, as many DSPs and ADCs provide an I2S data stream at
little or no cost. Some even include EQ and dynamic-range control.

Figure 2
shows such a system. The PCM1808 ADC is the clock master, driving the TAS57xx. The MSP430 MCU loads the signal-processing
coefficients into the TAS57xx amplifier and monitors the analog inputs, using
its internal ADC to turn the system on when an input signal is present.

Figure 2. A simple
design using an ADC and switching amplifier. The amplifier directly accepts
digital data in I2S format.

Regardless of the kinds of inputs a switching amplifier accepts, it allows
simple two-channel home audio systems (such as those for TV sets) to have a one-
or two-chip solution – just the amplifier, or a low-cost ADC directly driving
the amplifier.
Design caveats

Most class D amplifiers have fixed gain. (The TPA3110D2 offers four preset gains.) If your DAC can't
supply sufficient voltage to drive the amplifier to full output, it is not
unlike driving a sports car with the parking brake on! Users then have three
options.

First, they can use a DAC with a larger output voltage swing. Second, they
can use an additional operational amplifier (op amp) to boost the signal before
the power amplifier. Third, they can use a class D amplifier that has external
gain control, allowing the customer to "dial in" the exact amount of gain to
take their maximum DAC voltage to maximum power amp output.

Also, most DACs are based on sigma-delta architectures, which generate
significant out-of-band (above 22 kHz) energy. This energy is removed with a
low-pass filter, so the class D amplifier doesn't "reflect" it (alias it) into
the audio band – not a nice sound at all! Figure
1 shows the connection between the audio codec (PCM3070) and the class D
stereo audio power amplifier (TPA3110D2) in the value soundbar reference design.
The LPF required is a simple RC filter.

Finally, a PWM data stream generated directly from an analog signal is fully
analog. (The pulse widths vary continuously. They are not quantized.) Yet pulse
waveforms represent the data. Rise and fall times and jitter become important.
Layout is critical to get the best performance.
Preventing ESD
damage

Real-world products require immunity to ESD. When people wear rubber-soled
shoes and walk across carpets, they generate static electricity that can damage
low-voltage devices (discrete and integrated).

Where possible, add ESD protection diodes at inputs and outputs. These
devices are designed specifically for ESD, with multiple diodes that conduct
high voltages to the power supply rails, or through a small resistor to the
ground rail.

In the value soundbar reference design, ESD diodes protect the ADC inputs of
the audio codec, the coaxial input of the S/PDIF receiver, and the external
GPIOs to the switches (Figure
3). These are critical points where ESD can attack low-voltage ICs. The
analog inputs are additionally protected by a shorting jack that grounds them
when the signal cable is disconnected.

Figure 3. The value
soundbar reference design uses diodes specifically designed for ESD
protection.

Power supply solutions

Switching amplifiers usually require two or three dc voltages. A higher
voltage rail typically is required for the output amplifier – either a single 24
V+ rail, or a split high rail supply. Usually there is a power rail for digital
(and low-level analog, if any) circuitry at 3.3 V or 5 V. The rail voltages are
usually obtained from a power supply connected to the ac power line. The digital
voltage is commonly derived from the positive rail voltage, using a
switched-mode power supply (SMPS) or linear regulator (Figure
4).

Figure 4. The
left-hand side of the chassis holds the switching supply for the switching
amplifier on the right side.

The rail supplies can be linear or switching. Linear supplies typically
require large, heavy transformers, but their rectifiers and capacitors are
inexpensive. Switched-mode supplies use small, light transformers, but more and
more expensive electronic components are required.

Switching supplies are compact and cool-running – necessities if the supplies
are mounted within the product. Voltage regulation is an inherent part of their
architecture and does not require additional power-wasting components. They can
be designed to operate on line voltages from 100 to 250 V, without having to
rewire the transformer. This universality makes it easy for a single product to
serve domestic and foreign markets.

Switching supplies generate high-frequency noise. Close attention to board
layout and bypassing is needed to keep noise out of analog circuitry.

Texas Instruments offers reference power-supply designs for AV use. One is a
720-W class G supply that can power many of TI's class D amplifiers. A class G
power supply uses power rail switching to minimize idle power losses in the
power stage.

In this specific case, a logic input pin on the power supply can be used to
tell the power supply that either a 50-V or 25-V supply is required. Halving the
power supply voltage from 50 V to 25 V divides the idle power consumption by
four (P=V2/R)
"If we electrocute the user, he won't buy
any more of our stuff."

The ac line (100 to 250 V) often directly powers consumer electronics. Line
voltage is potentially lethal, so there are stringent Conformité Européenne (CE)
and Underwriters Laboratory (UL) safety standards for line-powered products.

On the other hand, if an amplifier is powered by an outboard supply or "wall
wart," only the supply has to meet tight safety standards. As 30 V (ac
or dc) is considered "safe" (it isn't high enough to produce a strong shock
sensation, and it definitely is not lethal), an amplifier powered by a 30-V
external supply has safety standards that are more relaxed and easier to meet.
You can start selling the product sooner, and there is less trouble getting
certification for international markets.

If you use an external power supply, you probably will want a commodity model
from a reputable manufacturer. Keep an eye on the following:

Output: If the amplifier has a continuous average output
of 50 W (100 W peak), a 24-V power supply has to deliver at
least 4.5
A.

Voltage regulation: Voltage regulation can be important
in systems that use open-loop class D amplifiers, which typically switch the
power rail directly to the speaker load, so any power supply unit (PSU) noise
couples to the speaker load. However, all of our analog input power amplifiers
are internally closed-loop amplifiers, and have good power supply rejection
ratio (PSRR).

Tolerance for abuse: How well does the supply tolerate
shorts (one or many, brief or sustained)? "Accidents happen." Good supplies
bounce back from abuse. Bad supplies die.

For the value soundbar reference design, we used an off-the-shelf 24 V
supply. Surprisingly, we had to go through three vendors to find a reliable
product. My office looked like the elephants' graveyard of power
supplies.
Selecting a regulator for the low-voltage
supply

Once you have found a reliable supply of the right capacity, you need to
decide on how to generate the low voltages. (Depending on the design, these
might power analog as well as digital stages.) You can use inexpensive commodity
linear regulators (such as the UA78M33) or an SMPS. A linear regulator is usually the least
expensive solution, but pay attention to the regulator's thermal and current
limits.

If the circuit needs 5 V, and the supply is 24 V, the regulator drops the
difference, 19 V. The current through the regulator is the current through the
load, so a 1-A load would require a linear regulator to dissipate a blistering
19 W. For heavy loads, an SMPS is therefore the best choice.

If the load draws only 100 mA, only 1.9 W need be disposed. A low-dropout
(LDO) linear regulator might be the best tradeoff between cost and wasted
power.

If the low-voltage circuits include analog processing, there is a good reason
for not using an SMPS. Switching noise can get into the analog circuitry. In
such cases, an SMPS can drop the voltage to within a few volts of the desired
value, with an LDO linear regulator finishing the job.

Each low-voltage stage can be powered with its own linear regulator. Though
this minimizes the amount of heat each regulator has to dissipate, it does not
reduce the total power wasted.

There is no single choice of regulator quantity and type that is appropriate
for every application. The best choice will vary with the design and its
budget.
Analyzing power consumption

Given the need to hold down cost and reduce energy waste, we analyzed the
3.3-V rail's power consumption. Moving the PCM2705 USB DAC to host-powering from
the PC provided a meaningful reduction.

There was no obvious way to reduce the LEDs' power use (5 to 10 mA each),
until we realized they did not have to be on all the time. They could be
illuminated during changes, then switch off after a few seconds. This did not
reduce the peak current required, but it significantly reduced long-term heat
dissipation.

Our frugality reduced current consumption to less than 100 mA (when the LEDs
were not on). This made it possible to use an inexpensive UA78M33 regulator to
drop 24 V to 3.3 V. Only about 2 W had to be dissipated, so the PCB could
perform heatsink duties. With a 30-W class D amplifier running at 90 percent
efficiency, the amplifier generated more heat than the regulator.

A single linear regulator was the least expensive solution. In retrospect, a
better solution would have been to use an SMPS to drop the voltage to around 5
V, followed with an LDO linear regulator to get 3.3 V. This would have given
better efficiency, at a slight increase in cost.

Some customers asked why we did not use an SMPS to directly produce 3.3 V. As
explained before, we did not want switching noise riding along the rails and
references into the analog circuits. A final LDO regulator suppresses most of
that noise.
Reducing standby power

There is increasing pressure (especially in the European Union) for reduced
standby power consumption. It is now required to be no more than 0.5 W.

The soundbar's external power supplies consume around 300 mW when idling, so
the soundbar itself can waste as much as 200 mW. This is less than 9 mA from a
24 V power supply, so there is almost no "reserve" after the 4.5 mA bias current
of the regulator. Fortunately, the MSP430 host controller draws just 0.1 µA
during standby, and the audio codec pulls a similar amount. The amplifier (when
shut down) draws just 200 µA.

Back
to top

6. Layout

Design reuse is a big part of modern product design, including home audio
systems. Reducing systems to sections that can be copied and pasted over and
over again is key to getting to market quickly. If the marketing team you are
working with suddenly decides to add a function, be it software or hardware, a
library of working circuits is always advantageous.
System
partitioning for simple upgrades

Considerations regarding form factor are always more than just what circuit
designers have in their backpack. In consumer products, the product's industrial
design, including the product/end-user interface, will influence your layout
considerations significantly.

Are all of the connectors on one end of the product? Are the inputs right
next to the outputs, or are they on completely separate ends of the product?
Such things will drive your solution significantly. For example, in a product
where input connectors are right next to output connectors (such as a laptop PC
with its headphone and input jacks), then it makes sense to use a codec with the
input and output pins near each other.

On the other extreme, in a system with multiple inputs on one side of the
unit and multiple inputs on the other side, it may make more sense to keep the
ADCs and DACs separate. This keeps the analog signal traces as short as
possible, making them less susceptible to interference and crosstalk.

Now that we are starting to worry about design reuse and how to apply it to a
circuit that may have a completely different form factor, let us throw another
consideration into the mix-system partitioning, which could be considered the
layout equivalent of a block diagram.

Designing with system partitioning really enables designers to quickly
replace sections, should the specification from above change or if new products
(more on the higher or lower end than yours) are needed. Good system
partitioning allows the development of a platform that can be the basis for a
whole family of products, spun from one initial design.

For example, Figure 1 shows an
MP3 dock with a Bluetooth and analog interface. Here we look at
partitioning the amplifier, signal processing, control and interface. Dividing
the system and the PCB like this permits sections to be debugged independently
and easily replaced without disturbing the rest of the circuitry significantly.
In the IC world, we call this floorplanning.

Figure 1. By
designing the PCB in such a way, rather than a "whatever fits and makes an easy
layout," various sections can be replaced without destroying the entire layout
effort. It also allows each section to be tested and debugged
individually.

When it comes to the value soundbar reference design kit, a number of things
need to be considered.
Form factor

The form factor is essentially a long cabinet that is 32 inches wide, 4
inches tall, and about 4 inches deep. With speakers at both ends of the speaker
cabinet, the only empty space available is a gap in the middle.

Let us assume we want a reasonable amount of cabinet space at both ends of
the unit, along with cabinet porting and other features. On both ends of the
soundbar we allow 10 inches of room for speakers and acoustic space. That leaves
12 inches of PCB width and about 3.5 inches of front-to-back depth.

All of the connectors in our soundbar are on the same plane as we do not have
that many connectors. Also, doing so helps users connect wires from awkward
angles. Imagine trying to connect various wires with no real idea of where along
the back panel they are!

In this case, the soundbar has multiple inputs and a single subwoofer line
out. Other outputs such as the amplifier outputs are inside the case.

We discussed mounting the PCB vertically or horizontally. Some may disagree,
but unless the PCB can be strongly supported, don't mount external connectors
vertically on the PCB because the PCB will flex. On the value soundbar reference
design kit, we mounted the connectors horizontally to minimize this
flexing.
Multi-SKU design

The best way to maximize the return on investment (ROI) of a design is to
spin it into as many products as possible. This may be as simple as adding extra
analog inputs and an alarm clock function to one product, or as complicated as
upgrading the power amplifiers used and changing those little 2-inch mid-tweeter
loudspeakers to 4-inch full-range speakers.

By designing as many options as possible onto one PCB, you allow as much of
the design as possible to pass various safety certifications as possible, on the
initial qualification. This allows designers to get multiple SKUs designed and
qualified in as short a time possible and save significant amounts of money on
one qualification instead of three or four.

Options can be added to the PCBs that are enabled by stuffing options (Figure 2). The
signal paths can be modified by changing which resistors are added in series
with the tracks being enabled. On a simpler level, specific devices can be
stuffed one way or the other. Think of designs used to create exclusive
products.

Figure 2. Stuffing
options allow the same design and PCB layout to be used for an analog-only SKU
versus a mixed analog and digital input SKU. In this case, an analog-only SKU
does not require the DIR9001. By using the stuffing option, we remove the
DIR9001, but reuse the footprint for the external crystal that the DIR9001 to
generate the clocks for the analog SKU (along with the crystal
oscillator).

In the value soundbar reference design kit, we propose two different clock
sources, depending on the setup. In an analog-only build SKU, the DIR9001
(S/PDIF receiver) is not necessary. However, we still need an audio clock source
to drive the audio codec. The same reference crystal is used (Y2) in the
diagram. A crystal buffer driver (OSC) is used instead to create a nice 3.3-V
CMOS clock source that drives the converters and DSP in the PCM3070. If both
devices are inserted, we have contention on the MCLK bus. But in the case where
it is one or (XOR) the other, we should have no issue.

Figure 3
depicts another example. The S/PDIF receiver (DIR9001) has an external two-input
multiplexer that we use to select from two different S/PDIF sources. But in our
design, we have three sources (USB to S/PDIF converter, coax, and S/PDIF).

Figure 3. The
schematic shows the stuffing resistors used to select which S/PDIF inputs are
available to end users in the VALUE-SB-RDK (value soundbar reference design).
The stuffing resistors allow two or three potential inputs to be available for
that SKU, rather than needing to redesign the circuit for each product
variation.

Stuffing resistors are used during assembly using the same PCB. Different
components, though, are placed to route the signals appropriately to U2 (S/PDIF
multiplexer). Hardware also can be modified by adding pin headers or
connectors.
Hardware debug capability

In a perfect world, every circuit works the first time. All the devices talk
to each other perfectly, and you can be ready to demonstrate to upper management
within hours of getting the boards back from the assembler. However, the real
world is very different. Systems rarely work on initial power up, and debugging
is as big a skill for a designer as schematic capture.

In the value soundbar reference design kit, we added the following to aid
with debugging:

Inline resistors and a pinheader on each side where possible between
sections defined in the floorplanning: Each section then can be removed from
the circuit and individually debugged.

Pin headers for the I2C and control interfaces within each
section: Again, this helps with debugging individual sections.

Zero-Ω resistors on the I2C output pins from the
microcontroller: This addition quickly lets you ignore any I2C
settings coming from your microcontroller by simply removing those resistors.
I2C instructions then can be inserted to the board from an external
I2C tool such as a bus pirate. (See R30 and R31 in the
schematics.)

We also added an I2S header out of the codec to allow customers to
evaluate their algorithms without the DAC and amplifier.
In-circuit
programming

On the value soundbar reference design kit, two key items need programming:
the MSP430 host controller with flash memory, and the bulk EEPROM that holds the
code for the PCM3070. The MSP430 MCU is programmed using a two-wire interface,
known as spi-bi-wire. The EEPROM is programmed using I2C.

As part of the value soundbar reference design kit, we developed a
programming board that can be used on the production floor. We used a standard
schematic and software design for the TAS1020 to create I2C streams. In addition, an
extension for the MSP430 USB FET tool was designed onto the schematic.
Programming this board (with pogo pins) could be permanently connected to a PC.
Now, designers can program simply by holding the freshly soldered PCB on the
programming board and hitting "go."
Lessons learned

Make sure you program the EEPROM before you program the microcontroller
flash. Otherwise, the MSP430 MCU will boot up and dominate the I2C
bus and I2C does not like having two masters on the bus!

Make sure that you use different I2C addresses for the EEPROM on
the programmer, versus the EEPROM on the soundbar board. Otherwise, you can
easily overwrite the programmers EEPROM in error.

Back
to top

7. Software's role

Soundbar design encompasses many divergent yet essential steps. For example,
the marketing team's specification must be decoded into component selections.
Various converter and amplifier topologies must be examined, and there is
in-circuit and production line programming.

In terms of hardware, the soundbar reference design we have been developing
uses a 16-bit ultra-low-power MSP430 MCU to handle the control, user interface,
and housekeeping duties. The PCM3070's dual miniDSPs manage the audio processing
(Figure
1).

Figure 1. The final
soundbar reference design hardware includes the miniDSP codec, microcontroller,
USB, S/PDIF receiver, audio power amplifier, and power supply.

The code for the miniDSPs is kept externally on an additional EEPROM, as we
had some concerns regarding the number of different process flows required for
the miniDSP. By process flow, I refer to a different audio processing flow for,
say, S/PDIF content versus analog input, or different audio processing for
44.1-kHz content versus 48 kHz. Each process flow requires its own code and
coefficients, increasing the amount of flash space required on the
microcontroller, if we decide to keep everything in the microcontroller.

In practice (and hindsight), we found that customers typically have two
process flows (44.1 and 48 kHz). In fact, most have one process flow, with
different coefficients for 44.1 kHz and 48 kHz.

In the rest of this article, we discuss the software that was developed to
boot the code for the miniDSP codec from an external source. Mainly because that
is what was done, but also because it provides a good example of such software
management, should you have multiple process flows in your product.

The software in an audio system, such as a soundbar or PC speaker, can be
split into a few different sections: control and user interface (decoding IR,
receiving button presses and de-bouncing them), housekeeping (boot up and
maintenance of multiple devices), and audio signal chain processing (audio
processing that sits between the input and speaker
amplifiers).
Control and user interface

A separate daughter card with physical button interfaces was created to fit
in with the typical industrial design of soundbars. The physical user interface
is simply a bunch of switches connected to general-purpose I/O (GPIO) pins on
the microcontroller, along with a bunch of ESD diodes.

Software-wise, it is painfully simple. An interrupt detects one of the
buttons pushed (with a signal pulled to ground), a small timer is run (for
debounce), and the I/O port is checked again to see which button was pulled to
ground. Based on which button is pulled to ground, a function is run (such as
switch to USB input).

The IR remote control is a tougher challenge.1 There are two
different consumer IR protocols, NEC and RC-5. Both work using a similar
physical layer. The protocol really has more to do with timing and word depths.
Credit where it is due, the NEC format (or Japanese format) is mainly attributed
to the team at NEC, while RC-5 was developed by Phillips.

IR transmitters and receivers typically have to be matched in frequency. For
example, the ones used in the soundbar reference design run at 38 kHz. Data is
amplitude modulated into the transmitter and filtered out by the receiver. At
the receive end, the system will not see the carrier frequency, only content
that looks like UART serial stream data. For instance, with RC-5, we end up with
content coming out of the receiver at 1.778 Mspb (64/38 kHz).

From a code perspective on the microcontroller, an IR decoding function is
started when the serial stream's starting bits trigger the microcontroller's
GPIO pin. Once a valid, relevant code has been received, the appropriate
button-press function is run, essentially making the IR command emulate a
physical button press.
Housekeeping

The same MSP430 MCU is used for all housekeeping duties, such as booting up
the PCM3070, ensuring the TPA31xx amplifier is muted, and keeping an eye on the
lock status of the digital audio receiver (DIR9001). The PCM3070 has pages of
registers that look after the hardware side of things such as clock
configuration and input channel multiplexer selection. Then, another specific
set of pages looks after the instruction and coefficient data.

The microcontroller's code base maintains the hardware registers for the
miniDSP codec, since they tend to be fixed for all inputs and usage cases across
Texas Instruments' customer base (analog versus digital input). Once initially
booted, only a few register changes are needed. For example, changing from
analog input 1 to analog input 2 is a matter of a few register writes.

The miniDSP code for the miniDSP codec is much bigger and likely to change
from customer to customer. In that case, we put each process flow and related
coefficients into an external EEPROM, which can be loaded by the microcontroller
in a “copy and paste” fashion.

For instance on startup, the microcontroller reads the register from the
EEPROM and writes it directly to the miniDSP codec. It is a little simple, but
it works well, and we did not see audible latency in startup. Other interrupts
in the system such as S/PDIF lock signals were brought into the microcontroller
to alert us when we have lost lock and to change to the analog input by default,
if needed.

On input changes such as analog 1 to analog 2, the shutdown pin of the
amplifier is initially set to mute. Then the various register changes are made
in the miniDSP codec, followed by an unmute of the amplifier. This provides a
pop-free experience. That is what good housekeeping is all
about!
Audio signal chain processing

The audio signal chain (or process flow used on the PCM3070) can be the
same, regardless of audio source (analog or digital), since the miniDSP on board
the device simply sees the data as PCM digital data at a specific clock
rate.

The default audio signal chain initially was tuned using the PCM3070
evaluation module (EVM) and PurePath™ Studio home software (PPS). Once the
prototype of your process flow is sounding good, the next step is to document
the interface and export the configuration file for use in the EEPROM on the
board.

Documenting the interface ensures that you know the register addresses for
the coefficients you want to modify in the system. For instance, if you want the
ability to bypass an effect (such as SRS WOW HD), then you need to know the
register address for the software multiplexer in the process flow (Figure
2).

Figure 2. Designers
can find the I2C address and register to control a multiplexer in
their process flow. This is essential for the microcontroller to perform the
correct action on button-press.

That register address will be used in your MSP430 MCU software, specifically
in your button-action code. Other examples may be in equalization settings,
allowing users to change between pop, jazz, and classical mode EQs.2
Multiple images (or configuration files or CFGs) can be stored on the EEPROM and
can be loaded from the microcontroller with a simple call.

Getting into production

You now have an MSP430 MCU hex file, along with an external EEPROM hex file.
How on earth are you going to get the code into their respective places? In the
soundbar reference design kit, we opted to have a separate board with pogo pins
that the soundbar board could be placed upon in the factory (or screwed onto in
the development environment).

This programming board has headers for the standard MSP430 MCU 14-pin
programming spi-bi-wire, as well as a TAS1020B USB streaming device used to send
I2C commands. Using this tool, the microcontroller and the external
EEPROM can be programmed separately, with separate tools.

The caveat to all this is that the MSP430 MCU wants to be the I2C
master, once it has been flashed/programmed. However, the TAS1020B also wants to
be the I2C master. As such, the sequence of programming is very
important. The EEPROM must be programmed first via the TAS1020. Next,
temporarily disconnect the TAS1020, then program the microcontroller.

In hindsight, putting all code in the microcontroller's onboard flash would
have saved a lot of the heartburn associated with two I2C masters
fighting on the same bus. Additionally, I would have specified a simple UART
interface on the microcontroller to be connected to a simple USB serial port
cable that could be used for debug.

The soundbar reference design kit has been quite successful in different
form factors as soundbars, MP3 docks, and PC speakers. The combination of
easy-to-use tools for the MSP430 MCU, PurePath™ Studio, and SRS WOW HD
royalty-free makes the package rather compelling!

Back
to top

References

•

I found a great resource for IR
knowledge that you might find interesting: www.sbprojects.com/knowledge/ir/nec.php.

•

To find out more about the platform
head, check out this value soundbar reference design kit.

•

Download these datasheets: PCM3070, TAS1020 and TPA3116D2.

•

For audio support, visit the TI E2E™ Community forum for audio
amplifiers.

More information about:

•

Personal Electronics

•

Analog-to-Digital Converters (ADCs)

•

Electrostatic Discharge (ESD)

•

Electromatic Interference (EMI)

•

Sample Rate Converters (SRCs)

•

Audio ADCs

•

Clocks

•

Clock Generators

•

Digital-to-Analog Converters (DACs)

•

MSP430™ Microcontrollers

Back
to top

About the Author
Dafydd Roche is
one of TI's Audio Systems Engineers. When he's not busy trying to define
smarter, easy-to-use products so customers can stand out from the crowd, he's
busy shaking his cubicle walls doing listening tests with TI's DACs and
amplifiers. Dafydd enjoys Tex-Mex food (a change from his native Wales), talking
with customers about their development issues, and putting the world in order on
TI's E2E™ audio forum (e2e.ti.com). He can be reached at [email-masked].

Back
to top

Content provided courtesy
of Electronic Design.
© Copyright 2014 TI. All rights reserved.