Embedding Audio into your RX Application Renesas Electronics America Inc.
Renesas Technology & Solution Portfolio 2
Microcontroller and Microprocessor Line-up 2010 2013 32-bit 8/16-bit 1200 DMIPS, Superscalar Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby 500 DMIPS, Low Power Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby 165 DMIPS, FPU, DSC Industrial, 90nm 242µA/MHz, 0.2µA standby 25 DMIPS, Low Power Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby 10 DMIPS, Capacitive Touch Industrial & Automotive, 130nm Wide Format LCDs 350µA/MHz, 1µA standby 1200 DMIPS, Performance Automotive, 40nm 500µA/MHz, 35µA deep standby 165 DMIPS, FPU, DSC Industrial, 40nm 242µA/MHz, 0.2µA standby Embedded Security, ASSP Industrial, 90nm 1mA/MHz, 100µA standby 44 DMIPS, True Low Power Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 3
Microcontroller and Microprocessor Line-up 2010 2013 32-bit 8/16-bit 1200 DMIPS, Superscalar Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby 500 DMIPS, Low Power Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby 165 DMIPS, FPU, DSC Industrial, 90nm 242µA/MHz, 0.2µA standby 25 DMIPS, Low Power Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby 10 DMIPS, Capacitive Touch Industrial & Automotive, 130nm Wide Format LCDs 350µA/MHz, 1µA standby 1200 DMIPS, Performance Automotive, 40nm 500µA/MHz, 35µA deep standby 165 DMIPS, FPU, DSC Industrial, 40nm 242µA/MHz, 0.2µA standby Embedded Security, ASSP Industrial, 90nm 1mA/MHz, 100µA standby 44 DMIPS, True Low Power Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 4
Microcontroller and Microprocessor Line-up 2010 2013 32-bit 8/16-bit 1200 DMIPS, Superscalar Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby 500 DMIPS, Low Power 32-Bit High Performance DSP, FPU with High Integration Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby 165 DMIPS, FPU, DSC Industrial, 90nm 242µA/MHz, 0.2µA standby 25 DMIPS, Low Power Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby 10 DMIPS, Capacitive Touch Industrial & Automotive, 130nm Wide Format LCDs 350µA/MHz, 1µA standby 1200 DMIPS, Performance Automotive, 40nm 500µA/MHz, 35µA deep standby 165 DMIPS, FPU, DSC Industrial, 40nm 242µA/MHz, 0.2µA standby Embedded Security, ASSP Industrial, 90nm 1mA/MHz, 100µA standby 44 DMIPS, True Low Power Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 5
Enabling The Smart Society Challenge: Improving the interface to the new smart machines is one of the important concepts of the Smart Society. Audio is an effective way of improving information delivery Solution: This class will show you how simple it can be to add various levels of audio to your next project 6
Agenda Discuss audio formats and requirements Embedded applications not high quality music players Hardware Requirements DAC PWM RX Audio Demo Components Basic decoding scheme Peripheral Blocks Lab Summary 7
Audio Experience BMW pursuing better acoustics to improve efficiency Audio used to compensate for low RPM rumble - At Mercedes-Benz...engineers record the sounds of those servo motors used to raise the windows and adjust the seats, then compare them with sounds made by a BMW and other competitor if it sounds well made, it probably is Do Your Products Sound Priceless? 8
Audio Considerations 9
Key Considerations What type of audio is needed Simple tones Speech Music What are characteristics and requirements File size Internal Flash External file storage File system MCU and Bus Bandwidth Transducer (speaker) Amplifier/filter requirements 10
Sample Rates and Quality 8kHz, 8 bits Telephone quality 11kHz passable voice 22kHz, 8 bits, good for a mix of mono speech and music. 44.1kHz, 16 bits Good for audio and quality speech 11 2010 Renesas Electronics America Inc. All rights reserved.
Telephone or Voice quality Bandwidth: 180 Hz to 3.2 khz Low end avoids 60 Hz region. Noise pickup Size of transformers High end bandwidth issue 8 khz sampling rate sufficient for speech intelligibility Signal to Noise: Approximately 45 db Spectrum of Audio Clip Human voice extends from 80 Hz to 14 khz Lab will investigate voice quality 12
Bandwidth, Storage and Dynamic Range 13
Dynamic Range How many bits? 144 db = 24 bit 96 db = 16 bit 60 db = 10 bit 48 db = 8 bit 14
Improving Dynamic Range Use signal compression techniques u-law or A-law 8 bit data, 8K sampling rate = 8kB/sec Compression ratio 2:1 15
Signal Compression - ADPCM PCM stores digitized audio - WAVE is a PCM file DPCM (Differentia) stores the difference from predicted last sample ADPCM Adaptive adapts step size for better compression (4:1} 16
Audio Data Compression Comparison Audio Files Format (compression type) Bitrate (Kbps) Filesize (KB/min) Uncompressed WAV 1411 105,000 MP3 128 960 MP3 (VBR) 112 840 RA 96 720 WMA 92 690 OGG 112 840 MPC 88 660 AAC 80 600 AC3 967 720 17
Hardware requirements 18
DAC or PWM Output Which is better? DAC is simple DAC resolution must be considered DAC settling time may limit actual audio range PWM very flexible, available on most MCUs PWM resolution may be limited depending on carrier 19
Filter Considerations DAC output should have filter Basically same requirement as anti-aliasing filter on ADC Should filter all frequencies above sampling rate/2 May cause amplitude distortion Buffer and filter can be combined Output resistance of the DAC should be considered in the filter design Simple RC acceptable in many applications Some systems like audio the speaker or listener filters many of the unwanted higher frequencies 20
PWM vs DAC Resolution At 10 khz DAC settling time (3 us) should not be a problem so all 1024 states of 10 bit DAC available Using 16 bit MTU timer 48 Mhz / 44.1 khz = 1088 Can utilize more that 10 bits (1024) Increased resolution just adds audio dynamic range If a lower resolution audio is used interrupts can be skipped while still using PWM carrier 21 2010 Renesas Electronics America Inc. All rights reserved.
DAC Output Resistance Important specification of DAC Relatively high for many MCU DACs May require buffering in many cases Some MCUs have internal buffer If no internal buffer Rload >> Ro to prevent loading Rload>2*Resolution* Ro for <1/2 bit error Ro on RX63N is 3.6K DAC Vload Ro Rload 22
DAC Filter Typically first order filter not enough Often use amplifier and filter 2.5 khz First Order Filter 1 500m 200m Gain / 100m 50m 20m 10m 500m 1 2 5 10 20 50 100 200 500 1k 2k 5k 10k 20k 50k 100k Frequency / Hertz 23
Filter Considerations 1 0.8 0.6 0.4 0.2-0 V -0.2-0.4-0.6-0.8-1 -1.2-0 1 2 3 4 5 Time/mSecs 1mSecs/div 24
RX Audio Demo 25
Renesas RX63N RDK User push buttons Graphics LCD J-Link debugger Speaker Stereo headphone jack SD-Card MIC and amplifier POT VR1 LED Ring 26
RX Audio Demo SD-Card stack & low-level drivers FAT file system browser Supports MP3 WAV ADPCM Stereo PWM output Software volume control YRDK RX63N 27
RX Audio Demo - supported formats MP3 MPEG-1/Audio(ISO/IEC11172-3)LayerIII MPEG-2/Audio(ISO/IEC 13818-3)LayerIII MPEG-2.5 (For Low Sampling Frequencies) ADPCM WAV (uncompressed PCM) 16-bit stereo or mono ( 1 or 2 channels) Sample rates (khz) 44.1, 33.075, 22.05, 11.025 28 2012 2012 Renesas Renesas Electronics Electronics America America Inc. All Inc. rights All reserved. rights reserved.
RX Audio Demo Decode path block diagram SD- Card RSPI MMC FAT MP3 Render Raw binary Blocks File I/O MP3 decode Timers 29
RX Audio Demo Rendering block diagram Render Ping Load next PCM sample Reload L DTC TPU Pong Sample Rate Ready for next PCM data sample R 30
Timer Operation Timer count value TPU1.TGRB clears all channels at the audio sample rate TPU1.TGRB Sets Playback Rate TPU0.TGRA TPU0.TGRB Elapsed time Channel A PWM Channel B PWM 31 2012 2012 Renesas Renesas Electronics Electronics America America Inc. All Inc. rights All reserved. rights reserved.
RX Audio Demo MCU peripherals used Two synchronizable "TPU" timer channels for PWM audio rendering. Data Transfer Controller (DTC) for streaming PWM timer data to the TPU timers. RSPI channel for SDCard communication 12-bit ADC to measure the potentiometer setting for audio playback volume 1 Compare Match Timer (CMT) channel for timed delays in SDCard driver code Real-time clock (RTC)--used for file time stamp 32 2012 2012 Renesas Renesas Electronics Electronics America America Inc. All Inc. rights All reserved. rights reserved.
Lab Time! 33
Summary Audio formats and requirements How good is voice quality Hardware DAC PWM Audio Various quality levels depending on need Trade-off File storage size Decode bandwidth Quality 34
Questions? 35
Enabling The Smart Society Challenge: Improving the interface to the new smart machines is one of the important concepts of the Smart Society. Audio is one of the most effective ways of improving information delivery Solution: This class will show you how simple it can be to add various levels of audio to your next project 36
Renesas Electronics America Inc.