Вы находитесь на странице: 1из 9

STM32 Journal

Volume 1, Issue 2

In this Issue:
ggBringing 32-bit Performance to 8- and 16-bit Applications
ggDeveloping High-Quality Audio for Consumer Electronics Applications
ggBringing Floating-Point Performance and Precision to Embedded Applications
gg



  


gg  
 !
" 

#
$ %
 
ggIntroducing a Graphical User Interface to Your Embedded Application
STM32 Journal

Developing High-Quality Audio for


Consumer Electronics Applications
By Paul Beckmann, CEO/CTO, DSP Concepts
Dragos Davidescu, Chief System Architect, STMicroelectronics
John Knab, Application Engineer, STMicroelectronics

With the falling cost of  


%&
"'


$ (


;& <
including graphic and parametric
 &
$ '
"
) !
 " '
&"
!


&!
!
+" / (
K
 

manufacturers are considering 


& /
& %
+"

 =
"

applications, developers may
adding digital audio functionality   

&'
.)'
advanced audio algorithms to even want to design their own
to more and more consumer '

&(
achieve full performance: equalization algorithms using a
devices and other embedded 
!
*(
In this article, we’ll show how Spatial enhancement: In
&&  (





 &

 
$  

!
  '

Peak limiting:
)&!
%

support the wide variety of media


based digital signal processing &!


 
>?>@
nonlinearity at louder sound
sources users want to access
0)4

5  &
"

& (

 


 (
*
&& 



such as an iPhone, Internet


(FPU) capabilities to enable spacious, rich sound, spatial gain and carefully controlling the
'
% 
)*
'


  
"
& !'
enhancement is required is &!
 '

 

& 

)
(
implement enhanced algorithms, to compensate for the close louder with a minimum amount
Achieving high-quality sound convert between multiple &% 


&!(

  (
output, however, is non-  !
'
 
 
Multi-channel audio: For Boost: When listening to music
 (
)"
+"  
&
speed communications without
systems supporting more than at low volume levels, much
greatly upon the final system impacting audio quality, optimize

&!'

 
&"
detail, and therefore depth, can
 " '
!

"
designs to balance quality and
signal requires processing to 
 (
* 





to design even when prototype cost, and manage other system


create the additional audio certain other frequencies at low


  (
.
!
"


&

 ( volume levels using loudness


addition, implementing real- user interface, all with a single
compensation or perceptual
time digital signal processing   ( Equalization:
)&!



volume-control techniques can


algorithms introduces a be equalized to achieve better
 = 
&
&

whole new set of concerns Consumer Audio "


+"  (
.

&!

"
+"  (

 &
"

$  Traditionally, introducing audio in use change, the equalization

 (

 "
to an embedded application 


J" 

 (
Level matching: Level matching
implementing advanced filters requires digital signal-processing Developers can employ a eliminates the need for users to
and processing algorithms, capabilities beyond the capabilities variety of equalization methods, J"

 "




11
STM32 Journal


"M
" 

 



 "( ART Accelerator™ Up to 1-Mbyte Flash memory
Digital audio has commonly System Up to 192-Kbyte SRAM
Power supply
been implemented in consumer 1.2 V regulator STM32 F4 FSMC/SRAM/NOR/NAND/CF/LCD
POR/PDR/PVD parallel interface
electronics and embedded Xtal oscillators
applications using a second 32 kHz + 4 ~26 MHz ARM Cortex-M4 80-byte + 4-Kbyte backup SRAM
Internal RC oscillators 168 MHz
&
 


!(
32 kHz + 16 MHz 512 OTP bytes
PLL


!

&"'
Connectivity
Clock control
however, manufacturers need to RTC/AWU
Floating-point unit (FPU) Camera interface
Nested vector 3x SPI, 2x I2S, 3x I2C
be able to process audio on the SysTick timer interrupt Ethernet MAC 10/100

$ ( 2x watchdogs controller (NVIC) with IEEE 1588
(independent and window) MPU 2x CAN 2.0B
51/82/114/140 I/Os
In general, it is easier to Cyclic redundancy
JTAG/SW debug/ETM 1x USB 2.0 OTG FS/HS
1x USB 2.0 OTG FS
& 
"


$
check (CRC)
SDIO
than it is to implement real-time Multi-AHB bus matrix
6x USART
responsiveness and connectivity 16-channel DMA LIN, smartcard, lrDA,
modem control


)(
)'
 
% 
Control
Crypto/hash processor
at processing audio, don’t have 2x 16-bit motor control Analog
PWM 3DES, AES 256
Synchronized AC timer 2-channel 2x 12-bit DAC
the peripherals or interrupt SHA-1, MD5, HMAC
10x 16-bit timers 3x 12-bit ADC
responsiveness required for real- 2x 32-bit timers 24 channels / 2.4 MSPS
True random number generator (RNG) Temperature sensor

 (
)
  "

are also typically designed for


high-end signal processing
and massive parallelism that Figure 1

)

%&
 
)R?
$ 



$ %
  "
 

 

   
&& 


 


 

$ 

& /
&'
'



 


&&  (
%

+" 



&
"
&&  (
.

capabilities required to handle architected to provide short and " 


&!'
!

addition, DSPs are not designed


not only basic audio processing deterministic interrupt latency as   '

&(


to support communication
but the advanced algorithms well as ultra low-power operation )R?
KZ'



#

 
!
)*'
)
'


required to improve quality as 


 &
&&  ( $ %Z

& 


NK'


)
!

 (
.
 '
 

"&

>[@
\/'
 
   

station would still require a 


)R?
$
X
"

requiring developers to hand- capabilities such as DSP


second processor to handle
  (

code assembly as is typical for Architecture  " 




5  &

)
 '
$ 
O

)R?
  "

unit to allow manufacturers
With the introduction of DSP ease-of-use and faster time-to- ST has been designed to to produce consumer audio
&  

$
 " 
!
" 
$
& 

R?
$
&  
&&  
O
+"  

 '
$ 




&&  
(
to a wide range of consumer & !





advanced math processing $ 



 
&= 
audio applications, including 0
K "
>4(

12
STM32 Journal

DSP application example: MP3 audio playback

Max
General Purpose MCUs Min

Discrete DSPs

Cortex-M4

Specialised Audio DSPs

0 5 10 15 20 25 30

MHz required for MP3 decode (smaller is better!)


DSP Concept

Figure 2
N 
 
$ %Z
'

)R?
KZ
O
% 
"
&
&  


%

&


 &"&
$ 

 
)(


)R?
KZ
O
% 
Digital Signal Processing
audio processing capabilities Instructions:
N 

)R?

0
K "
?4(
N 
 

KZ'
 &



peripheral integration, a single 


"&

>jk
)&=

)R?
KZ

&

   " (

 " 

O '
 &
 " 

include single-cycle multiply-
implementing embedded audio ""  
0$4'

that combines performance, saturated arithmetic, and both


ease-of-use, connectivity, and @

>[
).
  

signal processing to achieve & (


. 
  "


+"  
"
& !(
`
designed to enable high-quality
&  


)R?
KZ
audio in consumer electronics
for accelerating audio design, and embedded applications in a
enhancing performance, and 
 O 



lowering system cost include: 


& 
 
)(

13
STM32 Journal

Floating-Point Unit:

)R?

Cortex-M4 General- General-


KZ

 


with CPU purpose purpose
Ethernet USB OTG Bus masters
   
5  &
"
MAC 10/100 HS
DMA1 DMA2
0K 4(
N 
  &
120
168 MHz
MHz 8 channels 8 channels
DMA DMA

DMA_MEM1

DMA_P1

DMA_MEM2

DMA_P2
algorithms can be implemented 100 Mbit/s 480 Mbit/s

System
Instructions

Data
12.5 MByte/s 60 MByte/s
"
=%&
  '


&&

& % 
64 Kbytes SRAM

7-layer 32-bit multi-AHB bus matrix




"5

5
Bus Slaves



" 
 (
.

FSMC
 '
=%&
&

O


 

AHB2 peripheral
5  & '

& 
AHB1/APB1
AHB1 peripheral

"
" (
N 

AHB1/APB2
the integrated FPU, there is no SRAM 16 Kbytes
& 

 

&(

SRAM 112 Kbytes


$


5  &


Accelerator
672 MByte/s D D
also be substantially faster and

ART
Flash
+"



=% 672 MByte/s I I 1 Mbyte
&
(

  The bus Figure 3


"  
 %

  
)R?
$ 
 
&& 


 
" "

 
" & 

 

 
 "
+"
 


$ (

&
)R?
$ 
 

"
 

size of the processor has a & 



  
&&



 !


 
& 
&(
tremendous impact on both
performance and power
Multi-Layer Bus Fabric:  

&&  
!
"

$ (
K "

(


"


!

  
 

"
& !
&
3 shows the high level of
samples are streaming at 16
processing is maintaining 
 (
parallelism that can be achieved
bits, the system still needs

 
5(
.

through simultaneous transfers
32-bits to store intermediate 
)R?
  "


consumer audio device, over a multi-layer fabric:


&"  (

>[
$
designed to minimize this
'

$
"


)'

%& '
+"
problem so that developers gg

 


%" 


& 
0Z
" & 
move not only signal data but
do not need to spend time from Flash with data stored in

R
 4
J"

&  
manage program memory,
 
&  
5 (
)#
04

 
R?
%
R?
" &  (
communication ports, and other
This is achieved through the low
 
!(

& % 
gg The compressed audio stream

)R?
KZ

%" 
interrupt service overhead of
and real-time nature of audio is received over USB and

R?
$
0" & 

)R?


 

algorithms also requires  



)#
0 4(
accumulate) with only one the multi-layer bus fabric that
them to be integrated with
  
& (  
" & 

 
gg CPU with DSP and FPU
application code to ensure that functionality accesses the
to occur simultaneously without
>Z
STM32 Journal

compressed audio stream for +"  (






decompression and signal limitation, developers can utilize Complete audio system
processing (green) &  

0)#$4(
STM32 F2 STM32 F4 Flash RAM
)#$

 
""

 

gg

&
R
 

CPU load CPU load footprint footprint
 
"
&
0(('
 !




$

)#
MP3 decoder 17% 6% 23k 12344
domains) while maintaining audio
(yellow)
=  '
& 

  
MP3 encoder 22.5% 9% 25k 16060
gg Audio data is output to I2S  

 !
&'


" 

0 4 
%
"

O
WMA decoder 17.5% 6% 45k 36076
gg Graphical icons are transferred "(
K
&&  



)#$'

)R?
KZ
AAC+ v2 decoder 25% 11% 54k 87000
from Flash to the display
" 

0 "4 requires only 10% utilization,
Channel mixer 2.5% 2% 0.6k 16
leaving plenty of headroom for
Communications Interfaces:  
  &
!( Parametric Equalizer 16% 12% 2k 300
Users want to be able to access
"
 

O
"
Multiple Clock Sources:
Loudness Control 4.5% 3.5% 3.25k 632


O
 (
Consumer audio systems require
N 

 
%

  
"

O
 !
SRC 22.5% 10% 17.5k 1880
including USB (host and device),  "

$ '

 

. 
#'
)*'

.?) 

=%

Figure 4

N
&" 
>[

R?
)
" '
)R?
KZ
O

?k‚ƒj„

).€'

% 
 frequencies and need to be & (


" '
 

&
 
 &

 



 &

 
5% 
" 





J (
&

"

  

" 
&
"
+"  (

devices that support a wide 



"


 !

 

" 
 ( for each of these can impact
&(
K
%& '


In addition to being able to receive data
In addition to being able to straightforward to achieve a clean
receive data without loading  !

>[@
\/


$ '
without loading the CPU, developers need
the CPU, developers need to ZZ(>
`\/


.?)
 


be able to address the many Z@


\/

)*
"




to be able to address the many issues


issues related to streaming 
"

 
 !
"(
"'
 "

&! 


related to streaming audio, including lost


!

!
  (
K

)R?
KZ
   





 !
&! 

!

!
  (

%& '
)*
!
  

5%  (




"


&
"

5



 

 
 !

K
%& '
)*
!
  



"
"O


 

"


&  (

and the second PLL is available &
"

5


"

can result in lost or dropped 


 

" 
 !

&! 

&
"


 +"  
"(


 
"


&  (
15
STM32 Journal

$).)
)


  

 & (

$).)

DSP library includes a large


"

)

5  
point functions optimized for
the algorithms commonly used

"
&&  (




"&& 

#


processors built around the


$ %Z
&(
)

Concepts is the company that


 

$).)
)
(

They have leveraged their


  
!  





 

"
 !


!
"&

 
&

 
 '
"
N(

Audio Algorithm Design


Figure 5

"
N

)
$& 
O

‡ .
 &



 
 &

 

 
5


&&  

  
&
Audio Weaver enables
 !

 

"

 &
 (  &

+"! 
 

the audio processing portion



  

"
O
simplifying design, integrating & 


)R?
K?'



 †
(('
 

 !

 
 
the I2S interfaces reduces %& '
!
Rƒ
 (
N 
that goes on between receiving



)R?
  "
component count, board size, 
)R?
KZ'

& 
an audio signal and outputting
to maintain a permanent USB 
 
 ( 
&


 
 (
 (
"
N
O


connection and avoid audio When computing 16- and 32- GUI-based development
MCU Peripherals:

)R?

/ 
"( 
)
" '

)R?
environment that enables
architecture includes all of the
KZ
O

?kƒj„
0
K "
developers to design the signal
Integrated Audio Interfaces: real-time peripherals required for
Z4
& (


" '
5


&&  



)R?
KZ


"  



$ 
systems can drop into sleep   
&
 !

"& %
.?)
 
 

&&  (

mode faster to conserve power and connecting them using


 
O




 


)R?
or run more algorithms to further a drag-and-drop editor (see
j(k„
& 
+"
(

KZ…
&  
 


&
"
+"  (


 

% 
 !
K "
k4(

 !


level of performance to audio
input to the I2S peripheral if In addition to the integrated DSP optimized code behind it, and
&&  (



% 
 +"  
"
&  


)R?
KZ'
the tool automatically creates
a long 32-bit multiply or


&(
.
 

developers have access to the 
+"
 
 " "(

" & ""  


0$4

16
STM32 Journal

*"
& %
" 

complete reference designs are value-add of Audio Weaver is .)


+"


built from base audio functions, available, with assistance from  
 ! ( 
"
&
  (


=

%" 
 
DSP Concepts to tune them This enables engineers to

&




=
&" 
 (
Accelerating Optimization measure how much a particular
losses compared to hand- Companies that are comfortable To speed design, Audio Weaver improvement in sound quality will


 ( with audio processing can supports cross-platform cost in terms of CPU utilization
!
 
"
"
 & (

  

"

 




When algorithm code is written


 !

&

the same algorithms on a PC as use of processing resources
by hand, each design iteration
functionality and build them 

)R?
KZ

 
when many functions have to
requires substantial time
into higher-level processing a powerful environment in & 
" " (

investment since the code must


be optimized and tuned to
see what its actual impact on
sound quality and processing When algorithm code is written by hand, each design

(
N 
"
N'

the design cycle is much faster, iteration requires substantial time investment since the
giving developers the ability to
%& 

= " 

code must be optimized and tuned to see what its actual

O 


"

quality while reducing system &



"
+"  

&

(
N 
"

 (
$

  
& /


.)


" '
Weaver, the design cycle is much faster, giving developers
"&& 
5  &

&
"


)R?


  

%& 

= " 


O 


KZ'
O
5% 
& 

"
+"  
 
"
 
 (
modules, and does not require

#€)

& (



 "

>kj
O

  (

&  
which to design and tune the
"
 !'
 "
 $

"

O

companies can accelerate software in parallel with hardware 


= 

+" /


& 
.(
design using Audio Weaver as  & (
€
 
&!(


= '

N 
 
!
"
N'


&

!
 
hardware is available, the code 
%& '

&


has become possible to create core components that not only 

   


)R?
frequency response that is 3 dB
highly tuned audio applications J"&  
 
 
  
KZ

=
& / 
'
O



&
 


without engineers needing optimized code but provides a " 



 =
   

= 

O

 




&
!  
development environment that !
 ( >
*(

  
O


"
& (
K
facilitates fast prototyping and
"
=
& / '
in CPU utilization between
companies new to audio, " (
K

&


 &

&= 



= 


"

17
STM32 Journal

to determine where to allocate 


!

& /

 (
"
& /


)R?
For audio streaming accessories,
$
"

%/
K % 
"
 
& =
  "(
K
%& '
the Apple iAP application also
"
+"  ( the optimization process for )

 
& 
O

supports:
 &


"(
variety of evaluation boards
At the end of the day, however, gg Free USB Host Library USB
 
"
&  (
)
 

audio quality is not about Š 



"
&&  

Host Audio classes
O

!
  

response graphs but how it not comprised solely of audio


reference designs that provide gg

# 
‹‹

 " 
"

&& (
N 
& (

  
 

a representative design that control


many development systems, design, DSP Concepts also
can be used in a wide range of gg Digital audio streaming
 


!
&

% 
 



&&  (
J"  

'
& '
software functionality beyond its gg

"

%  
and download code before they % 
"
" 
'
K
&& 



0K.4





= " (
including: '
)
O

&& 
gg Flash card reader capabilities,
However, to assess the impact of iAP application, a complete such as using an SD card or
gg

#  
! $'



"



= 

+"  '

 " 


)R?
K?


%& '
 &



gg

 "
.‹€
  )R?
KZ


 

= 


(
€& /

 


 
= " 
gg

$‹
 
   +"  
"
%&(
decoders are provided for this
 
 

 (
The Apple iAP application purpose free of charge
gg Boot loader support both simple accessory
Audio Weaver solves this Today’s consumer audio devices
problem by supporting a gg Update manager and audio streaming accessory 
& %
 


for iPod, iPhone, and iPad require both high performance


tuning interface that can gg

K 
= 
 
(
$& 
 "Œ
 
= 
  

"&&
+"  
& !


  (
N 

  

System-level Design gg

 

)R??%‡

5%  


& 

= "

 
 

)R?Z%‡

 
!
%&  (

One of the challenges to


" & 
  
 

 !
adding audio to embedded to which developers connect With its high performance
of a button, developers can their Apple Authentication '

"  
"

 


 

$

&

 

&!
Coprocessor (ACP) circuit fabric enabling simultaneous
" "
O


+" / 



O
& 
designs, audio is typically data transactions, and the right
gg Free Apple “iPod Accessory %

$
&& 


& (
Š 


not one of the applications   <
04
=
 
  '

)R?
KZ


tuning interface is seamless "&& (


Lingoes for authentication and an ideal architecture for many
and transparent, compared to
To address this shortcoming,   ‹ 
  embedded and consumer audio
instrumenting code that can
&
+"  
"

% 
)

 
 = 

gg Free USB Host Library with &&  (
 &





$ ( creating digital audio resources USB Host HID class for control 
 
 
O

for its customers in order to and information data synchronized digital audio

  

"
+"! 

O
&  
"

& !


 
+"  

easily without recompiling can designs as well as tools that "



 
$ (

substantially shorten the time enable the design of quality


18

Вам также может понравиться