VS1001 K DATASHEET VS1001k - MPEG AUDIO CODEC Features Description • MPEG audio layer 3 decoder (ISO11172-3) • Supports MPEG 1 & 2, and 2.5 extensions, all their sample rates and bit rates, in mono and stereo • Supports PCM input • Supports VBR (variable bitrate) • Can be used as a slave co-processor • Operates with single clock 12..13 MHz or 24..26 MHz • Low-power operation • On-chip high-quality stereo DAC with no phase error between channels • Internal Op-Amp in BGA-49 and LQFP-48 packages • Stereo earphone driver capable of driving a 30Ω load. • Separate 2.5 .. 3.6V operating voltages for analog and digital • 4 KiB On-chip RAM for user code • Serial control and data interfaces • New functions may be added with software VS1001k is a single-chip solution for an MPEG layer 3 audio decoder. The chip contains a highperformance low-power DSP processor (VS DSP), working memory, 4 KiB program RAM and 0.5 KiB data RAM for user applications, serial control and input data interfaces, and a high-quality oversampling variable-sample-rate stereo DAC, followed by an earphone amplifier and a ground buffer. VS1001k receives its input bitstream through a serial input bus, which it listens to as a system slave. The input stream is decoded and passed through a analog/digital hybrid volume control to an 18-bit oversampling multi-bit sigma-delta DAC. The decoding is controlled via a serial control bus. In addition to the basic decoding, it is possible to add application specific features, like DSP effects, to the user RAM memory. VS1001 audio stereo ear− phone driver stereo DAC DREQ DCLK SDATA BSYNC SO SI SCLK XCS serial data interface SCI Bus X Bus 2004-02-10 x−RAM y−RAM Y Bus I Bus program RAM Version 4.14, output x−ROM SDI Bus VS_DSP serial control interface L R y−ROM program ROM 1 VLSI DATASHEET y Solution VS1001 K CONTENTS Contents 1 License 7 2 Characteristics & Specifications 7 2.1 Analog Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Power Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3 DAC Interpolation Filter Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 DAC Interpolation Filter Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.5 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.6 Recommended Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.7 Digital Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.8 Switching Characteristics - Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.9 Switching Characteristics - DREQ Signal . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.10 Switching Characteristics - SPI Interface Output . . . . . . . . . . . . . . . . . . . . . . 10 2.11 Switching Characteristics - Boot Initialization . . . . . . . . . . . . . . . . . . . . . . . 10 Packages and Pin Descriptions 11 3.1 SOIC-28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2 BGA-49 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3 LQFP-48 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 4 Example Connection Diagrams 14 4.1 Connection Diagram, SOIC-28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.2 Connection Diagram, BGA-49 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.3 Connection Diagram, LQFP-48 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Version 4.14, 2004-02-10 2 VLSI DATASHEET y Solution 5 CONTENTS SPI Buses 17 5.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.2 SPI Bus Pin Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3 Serial Protocol for Serial Data Interface (SDI) . . . . . . . . . . . . . . . . . . . . . . . 17 5.4 Serial Protocol for Serial Command Interface (SCI) . . . . . . . . . . . . . . . . . . . . 18 5.4.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.4.2 SCI Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.4.3 SCI Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 SPI Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 5.5 6 VS1001 K Functional Description 21 6.1 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.2 Data Flow of VS1001k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.3 Serial Data Interface (SDI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.4 Serial Control Interface (SCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.5 SCI Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.5.1 MODE (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6.5.2 STATUS (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.5.3 INT FCNTLH (-) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.5.4 CLOCKF (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.5.5 DECODE TIME (R) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.5.6 AUDATA (R) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.5.7 WRAM (W) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.5.8 WRAMADDR (W) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.5.9 HDAT0 and HDAT1 (R) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Version 4.14, 2004-02-10 3 VLSI DATASHEET y Solution 6.6 7 8 VS1001 K CONTENTS 6.5.10 AIADDR (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.5.11 VOL (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.5.12 RESERVED (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.5.13 AICTRL[x] (RW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Stereo Audio DAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Operation 29 7.1 Clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.2 Powerdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.3 Hardware Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.4 Software Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.5 Play/Decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.6 Sanity Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.7 PCM Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.8 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7.8.1 Memory Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.8.2 SCI Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.8.3 Sine Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Writing Software 33 8.1 When to Write Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.2 The Processor Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.3 User’s Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.4 Hardware Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.4.1 SCI Registers, 0x4000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.4.2 Serial Registers, 0x4100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Version 4.14, 2004-02-10 4 VLSI DATASHEET y Solution 8.5 8.6 9 VS1001 K CONTENTS 8.4.3 DAC Registers, 0x4200 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8.4.4 Interrupt Registers, 0x4300 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 System Vector Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.5.1 AudioInt, 0x4000..0x4001 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.5.2 SpiInt, 0x4002..0x4003 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.5.3 DataInt, 0x4004..0x4005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.5.4 UserCodec, 0x4008..0x4009 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 System Vector Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.6.1 WriteIRam(), 0x4010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.6.2 ReadIRam(), 0x4011 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.6.3 DataWords(), 0x4012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 8.6.4 GetDataByte(), 0x4013 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 8.6.5 GetDataWords(), 0x4014 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 VS1001 Version Changes 38 9.1 Changes Between VS1001h and Production Version VS1001k, 2001-08 . . . . . . . . . 38 9.2 Changes Between VS1001g and VS1001h, 2001-05 . . . . . . . . . . . . . . . . . . . . 38 9.3 Changes Between VS1001d to VS1001g, 2001-03 . . . . . . . . . . . . . . . . . . . . . 38 10 Document Version Changes 39 10.1 Changes Between Version 4.13 and 4.14 for VS1001k, 2004-02 . . . . . . . . . . . . . 39 10.2 Changes Between Version 4.12 and 4.13 for VS1001k, 2003-11 . . . . . . . . . . . . . 39 10.3 Changes Between Version 4.11 and 4.12 for VS1001k, 2003-10 . . . . . . . . . . . . . 39 10.4 Changes Between Version 4.10 and 4.11 for VS1001k, 2003-09 . . . . . . . . . . . . . 39 10.5 Changes Between Version 4.08 and 4.10 for VS1001k, 2003-07 . . . . . . . . . . . . . 39 10.6 Changes Between Version 4.07 and 4.08 for VS1001k, 2003-03 . . . . . . . . . . . . . 39 Version 4.14, 2004-02-10 5 VLSI Solution DATASHEET y VS1001 K LIST OF FIGURES 11 Contact Information 40 List of Figures 1 Pin Configuration, SOIC-28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Pin Configuration, BGA-49. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3 Pin Configuration, LQFP-48. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4 Typical Connection Diagram Using SOIC-28. . . . . . . . . . . . . . . . . . . . . . . . 14 5 Typical Connection Diagram Using BGA-49. . . . . . . . . . . . . . . . . . . . . . . . 15 6 Typical Connection Diagram Using LQFP-48. . . . . . . . . . . . . . . . . . . . . . . . 16 7 BSYNC Signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 8 SCI Word Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 9 SCI Word Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 10 SPI Timing Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 11 Data Flow of VS1001k. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 12 Built-In Bass/Treble Enhancer Frequency Response at 44.1 kHz. . . . . . . . . . . . . . 24 13 User’s Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Version 4.14, 2004-02-10 6 VLSI DATASHEET y Solution 1 VS1001 K 1. LICENSE License MPEG Layer-3 audio decoding technology licensed from Fraunhofer IIS and Thomson. 2 Characteristics & Specifications Unless otherwise noted: AVDD=2.9..3.6V, DVDD=2.3..3.6V, TA=-30..+85◦ C, XTALI=24.576MHz, FullScale Output Sinewave at 1.526 kHz, measurement bandwidth 20..20000 Hz, analog output load 30Ω (no ground buffer) or 100Ω (with ground buffer), bitstream 128 kbits/s, local components as shown in Figures 4 and 5. Note, that some analog values are in practice better than in these tables if chips are used within a limited temperature range and not too close to lower voltage limits. 2.1 Analog Characteristics Parameter DAC Resolution Total Harmonic Distortion Dynamic Range (DAC unmuted, A-weighted) S/N Ratio (full scale signal) Interchannel Isolation Interchannel Gain Mismatch Frequency Response Frequency Response, AVDD = 2.8V Full Scale Output Voltage (Peak-to-peak) Deviation from Linear Phase Out of Band Energy Out of Band Energy with Analog Filter Analog Output Load Resistance, no ground buffer Analog Output Load Resistance, ground buffer Analog Output Load Capacitance Symbol THD IDR SNR AOLR1 AOLR2 Min 70 50 -0.5 -0.1 -0.3 1.4 16 16 Typ 16 0.1 90 87 75 1.81 Max 0.2 0.5 0.1 0.3 2.0 5 -60 -90 302 1002 1000 Unit bits % dB dB dB dB dB dB Vpp ◦ dB dB Ω Ω pF 1 3.6 volts can be achieved with +-to-+ wiring for mono difference sound. 2 AOLR1/2 may be much lower, but below Typical distortion performance may be compromised. Version 4.14, 2004-02-10 7 VLSI VS1001 K DATASHEET2. CHARACTERISTICS & SPECIFICATIONS y Solution 2.2 Power Consumption Parameter Power Supply Rejection Power Supply Consumption AVDD, Reset Power Supply Consumption AVDD, no load Power Supply Consumption AVDD, output loaded at 30Ω Power Supply Consumption AVDD, o. @ 30Ω + GND-buf. Power Supply Consumption DVDD, Reset Power Supply Consumption DVDD 2.3 Symbol Min 3.0 4.0 6.0 Typ 40 0.6 4.5 5.5 7.5 3.7 15.0 Max 5.0 6.0 40.0 40.0 100.0 Unit dB µA mA mA mA µA mA DAC Interpolation Filter Characteristics Parameter Passband (to -3dB corner) Passband (Ripple Spec) Passband Ripple Transition Band Stop Band Stop Band Rejection Group Delay Symbol Min 0 0 Typ 0.420Fs 0.580Fs 90 Max 0.459Fs 0.420Fs ±0.056 0.580Fs 15/Fs Unit Hz Hz dB Hz Hz dB s Fs is conversion frequency 2.4 DAC Interpolation Filter Characteristics Parameter -3 dB bandwidth Passband Response at 20 kHz 2.5 Symbol Typ Max Unit kHz dB Absolute Maximum Ratings Parameter Analog Positive Supply Digital Positive Supply Current at Any Digital Output Voltage at Any Digital Input Operating Temperature Functional Operating Temperature Storage Temperature Version 4.14, Min 300 -0.05 2004-02-10 Symbol AVDD DVDD Min -0.3 -0.3 DGND-1.0 -30 -40 -65 Max 3.6 3.6 ±50 DVDD+1.0 +85 +95 +150 Unit V V mA V ◦C ◦C ◦C 8 VLSI VS1001 K DATASHEET2. CHARACTERISTICS & SPECIFICATIONS y Solution 2.6 Recommended Operating Conditions Parameter Analog and Digital Ground Positive Analog Ambient Operating Temperature 1 Symbol AGND DGND AVDD Min 2.51 -30 Typ 0.0 3.0 Max 3.6 +85 Unit V V ◦C If AVDD is below 2.8 V, distortion performance may be compromised. The following values are to be used when the clock doubler is active: Parameter Positive Digital Input Clock Frequency Internal Clock Frequency1 1 Symbol DVDD XTALI CLKI Min 2.3 Typ 2.7 12.288 24.576 Max 3.6 13 26 Unit V MHz MHz The maximum sample rate that may be decoded with correct speed is CLKI/512. The following values are to be used when the clock doubler is inactive: Parameter Positive Digital Input Clock Frequency Internal Clock Frequency1 1 Symbol DVDD XTALI CLKI Min 2.3 Typ 2.7 24.576 24.576 Max 3.6 26 26 Unit V MHz MHz The maximum sample rate that may be decoded with correct speed is CLKI/512. Note: With higher than typical voltages, VS1001k may operate with CLKI upto 30..32 MHz. However, the chips are not qualified for this kind of usage. If necessary, VLSI Solution Oy can qualify chips for higher clock rates for quantity orders. 2.7 Digital Characteristics Parameter High-Level Input Voltage Low-Level Input Voltage High-Level Output Voltage at IO = -2.0 mA Low-Level Output Voltage at IO = 2.0 mA Input Leakage Current Version 4.14, 2004-02-10 Symbol Min 0.7DVDD Typ Max 0.3DVDD 0.7DVDD 0.3DVDD 1.0 Unit V V V V µA 9 VLSI VS1001 K DATASHEET2. CHARACTERISTICS & SPECIFICATIONS y Solution 2.8 Switching Characteristics - Clocks Parameter Master Clock Frequency 1 Master Clock Frequency 2 Master Clock Duty Cycle Clock Output 1 2 Symbol XTALI XTALI Min 40 XTALO Typ 12.288 24.576 50 XTALI Max 60 Unit MHz MHz % MHz Clock doubler active. Clock doubler inactive. 2.9 Switching Characteristics - DREQ Signal Parameter Data Request Signal 2.10 Symbol DREQ Symbol Max 200 Unit ns Min Typ Max 0.25×CLKI 100 Unit MHz ns Switching Characteristics - Boot Initialization Parameter RESET active time RESET inactive to software ready Version 4.14, Typ Switching Characteristics - SPI Interface Output Parameter SPI Input Clock Frequency Rise time for SO 2.11 Min 2004-02-10 Symbol Min 2 Max 50000 Unit XTALI XTALI 10 VLSI DATASHEET y Packages and Pin Descriptions AGND LEFT AVDD RCAP AGND RIGHT AVDD AGND TEST2 TEST1 TEST0 SOIC-28 XRESET 3.1 DGND 3 3. PACKAGES AND PIN DESCRIPTIONS DVDD Solution VS1001 K 28 27 26 25 24 23 22 21 20 19 18 17 16 15 8 9 10 11 12 13 14 DGND XCS SCLK SI SO DGND 7 DVDD 6 XTALI 5 XTALO 4 DVDD DCLK 3 BSYNC 2 SOIC − 28 SDATA 1 DREQ VS1001 Figure 1: Pin Configuration, SOIC-28. Pin Name DREQ DCLK SDATA BSYNC DVDD1 DGND1 XTALO XTALI DVDD2 DGND2 XCS SCLK SI SO TEST0 TEST1 TEST2 AGND1 AVDD1 RIGHT AGND2 RCAP AVDD2 LEFT AGND3 XRESET DGND3 DVDD3 Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Pin Type DO DIO DI DI PWR PWR CLK CLK PWR PWR DI DI DI DO3 DI DO DO PWR PWR AO PWR AIO PWR AO PWR DI PWR PWR Function data request, input bus serial input data bus clock serial data input byte synchronization signal digital power supply digital ground crystal output crystal input digital power supply digital ground chip select input (active low) clock for serial bus serial input serial output reserved for test, connect to DVDD reserved for test, do not connect! reserved for test, do not connect! analog ground analog power supply right channel output analog ground filtering capacitance for reference analog power supply left channel output analog ground active low asynchronous reset digital ground digital power supply Pin types: Type DI DO DIO DO3 Description Digital input, CMOS Input Pad Digital output, CMOS Input Pad Digital input/output Digital output, CMOS Tri-stated Output Pad Type AI AO AIO PWR Description Analog input Analog output Analog input/output Power supply pin SOIC-28 package dimensions can be found at http://www.vlsi.fi/vs1001/soic28.pdf . Version 4.14, 2004-02-10 11 VLSI DATASHEET y Solution 3.2 VS1001 K 3. PACKAGES AND PIN DESCRIPTIONS BGA-49 A1 BALL PAD CORNER 1 2 4 3 5 6 7 A D 7.00 0.80 TYP C 4.80 B E F G 0.80 TYP 4.80 1.10 REF 1.10 REF 7.00 TOP VIEW Figure 2: Pin Configuration, BGA-49. Pin Name BSYNC DVDD1 DGND1 XTAL0 XTALI DVDD2 DGND2 XCS SCLK SI SO TEST0 TEST1 TEST2 AGND1 AVDD1 RIGHT AGND34 GBGND GBUF GBVDD RCAP AVDD45 LEFT AGND56 XRESET DGND3 DVDD3 DREQ DCLK SDATA Ball E3 F3 F4 G3 E4 F5 F6 G6 D6 E7 D5 C6 C7 B6 C5 B5 A6 B4 A5 C4 A4 B3 A3 B2 A2 B1 D2 D3 E2 E1 F2 Pin Type DI PWR PWR CLK CLK PWR PWR DI DI DI DO3 DI DO DO PWR PWR AO PWR PWR AO PWR AIO PWR AO PWR DI PWR PWR DO DIO DI Function byte synchronization signal digital power supply digital ground crystal output crystal input digital power supply digital ground chip select input (active low) clock for serial bus serial input serial output reserved for test, connect to DVDD reserved for test, do not connect! reserved for test, do not connect! analog ground analog power supply right channel output analog ground analog ground for ground buffer ground buffer analog power supply for ground buffer filtering capacitance for reference analog power supply left channel output analog ground active low asynchronous reset digital ground digital power supply data request, input bus serial input data bus clock serial data input Not connected are: A1, A7, B7, C1, C2, C3, D1, D4, D7, E5, E6, F1, F7, G1, G2, G4, G5 and G7. For “Pin Types”, see Chapter 3.1. BGA-49 package dimensions are at http://www.vlsi.fi/vs1001/bga49.pdf . Version 4.14, 2004-02-10 12 VLSI DATASHEET y Solution 3.3 VS1001 K 3. PACKAGES AND PIN DESCRIPTIONS LQFP-48 48 1 Figure 3: Pin Configuration, LQFP-48. Pin Name nc XRESET DGND0 nc DVDD0 nc DREQ DCLK SDATA nc BSYNC DVDD1 nc DGND1 XTALO XTALI DVDD2 DGND2 DGND3 DGND4 XCS nc SCLK SI SO nc TEST0 TEST1 TEST2 nc AGND0 AVDD0 RIGHT AGND1 GBGND GBUF GBVDD RCAP AVDD1 LEFT AGND2 nc Pin 1,2 3 4 5 6 7 8 9 10 11,12 13 14 15 16 17 18 19 20 21 22 23 24. . . 27 28 29 30 31 32 33 34 35,36 37 38 39 40 41 42 43 44 45 46 47 48 Pin Type DI PWR PWR DO DI DI DI PWR PWR AO AI PWR PWR PWR PWR DI DI DI DO3 DI DO DO PWR PWR AO PWR PWR AO PWR AIO PWR AO PWR - Function active low asynchronous reset digital ground digital power supply data request, input bus serial input data bus clock serial data input byte synchronization signal digital power supply digital ground crystal output crystal input digital power supply digital ground digital ground digital ground chip select input (active low) clock for serial bus serial input serial output reserved for test, connect to DVDD reserved for test, do not connect! reserved for test, do not connect! analog ground, low-noise reference analog power supply right channel output analog ground analog ground ground buffer analog power supply filtering capacitance for reference analog power supply left channel output analog ground For “Pin Types”, see Chapter 3.1. LQFP-48 package dimensions are at http://www.vlsi.fi/vs1001/lqfp48.pdf . Version 4.14, 2004-02-10 13 VLSI DATASHEET y Solution 4 VS1001 K 4. EXAMPLE CONNECTION DIAGRAMS Example Connection Diagrams 4.1 Connection Diagram, SOIC-28 In this connection diagram, a SOIC-28 -packaged VS1001k is used. Figure 4: Typical Connection Diagram Using SOIC-28. Ground buffer is not available for the SOIC-28 package; hence it is not used. Version 4.14, 2004-02-10 14 VLSI DATASHEET y Solution 4.2 VS1001 K 4. EXAMPLE CONNECTION DIAGRAMS Connection Diagram, BGA-49 In this connection diagram, a BGA-49 packaged VS1001k is used. In this picture, ground buffer is active. Figure 5: Typical Connection Diagram Using BGA-49. Ground buffer GBUF can be used for common voltage (1.37 V) for earphones. This will eliminate the need for large isolation capacitors on line outputs, and thus the audio output pins from VS1001k may be connected directly to the earphone connector. If GBUF is not used, GBGND and GBVDD should not be connected. In addition, LEFT and RIGHT must be provided with 100 µF capacitors. Version 4.14, 2004-02-10 15 VLSI DATASHEET y Solution 4.3 VS1001 K 4. EXAMPLE CONNECTION DIAGRAMS Connection Diagram, LQFP-48 In this connection diagram, a LQFP-48 packaged VS1001k is used. In this picture, ground buffer is active. Figure 6: Typical Connection Diagram Using LQFP-48. Ground buffer GBUF can be used for common voltage (1.37 V) for earphones. This will eliminate the need for large isolation capacitors on line outputs, and thus the audio output pins from VS1001k may be connected directly to the earphone connector. If GBUF is not used, GBGND and GBVDD should not be connected. In addition, LEFT and RIGHT must be provided with 100 µF capacitors. Version 4.14, 2004-02-10 16 VLSI DATASHEET y Solution 5 VS1001 K 5. SPI BUSES SPI Buses 5.1 General The SPI Bus - that was originally used in some Motorola devices - has been used for both VS1001k’s Serial Data Interface SDI (Chapters 5.3 and 6.3) and Serial Control Interface SCI (Chapters 5.4 and 6.4). 5.2 SPI Bus Pin Descriptions SDI Pin - SCI Pin XCS DCLK SCK SDATA - SI SO 5.3 Description Active low chip select input. A high level forces the serial interface into standby mode, ending the current operation. A high level also forces serial output (SO) to high impedance state. There is no chip select for SDI, which is always active. Serial clock input. The serial clock is also used internally as the master clock for the register interface. SCK can be gated or continuous. In either case, the first rising clock edge after XCS has gone low marks the first bit to be written (clock 0 in the following figures). Serial input. SI is sampled on the rising SCK edge, if XCS is low. Serial output. In reads, data is shifted out on the falling SCK edge. In writes SO is at a high impedance state. Serial Protocol for Serial Data Interface (SDI) The serial data interface can operate in either master or slave mode. In master mode, VS1001k generates the DCLK signal, which can be selected to be either 512 or 1024 kHz. In slave mode, the DCLK signal is generated by an external circuit. The data (SDATA signal) can be clocked in at either the rising or falling edge of the DCLK. (Chapter 6.5). The VS1001k chip assumes its input to be byte-sychronized. I.e. the internal operation of the decoder does not search for byte synchronization of the frames from the data stream, but instead assumes the data to be correctly byte-aligned. The bytes can be transmitted either MSB or LSB first, depending of contents of SCI register MODE (Chapter 6.5). BSYNC SDATA D7 D6 D5 D4 D3 D2 D1 D0 DCLK Figure 7: BSYNC Signal. To ensure correct byte-alignment of the input bitstream, the serial data interface has a BSYNC signal. Version 4.14, 2004-02-10 17 VLSI DATASHEET y Solution VS1001 K 5. SPI BUSES The first DCLK sampling edge (rising or falling, depending on selected polarity), during which the BSYNC is high, marks the first bit of a byte (LSB, if LSB-first order is used, MSB, if MSB-first order is used). If BSYNC is not used, it must be tied to VCC externally and the master of the input serial interface must always sustain the correct byte-alignment. Using BSYNC is strongly recommended. For more details, look at the Application Notes for VS10XX. The DREQ signal of the data interface is used in slave mode to signal if VS1001k’s FIFO is capable of receiving more input data. If DREQ is high, VS1001k can take at least 32 bytes of data. When there is less than 32 bytes of free space, DREQ is turned low, and the sender should stop transferring new data. Because of the 32-byte safety area, the sender may send upto 32 bytes of data at a time without checking the status of DREQ, making controlling VS1001k easier for low-speed microcontrollers. Note: DREQ may turn low or high at any time, even during a byte transmission. Thus, DREQ should only be used to decide whether to send more bytes. It should not abort a transmission that has already started. 5.4 5.4.1 Serial Protocol for Serial Command Interface (SCI) General The serial bus protocol for the Serial Command Interface SCI (Chapter 6.4) consists of an instruction byte, address byte and one 16-bit data word. Each read or write operation can read or write a single register. Data bits are read at the rising edge, so the user should not update data at the rising edge. The operation is specified by an 8-bit instruction opcode. The supported instructions are read and write. See table below. Name READ WRITE Instruction Opcode Operation 0000 0011 Read data 0000 0010 Write data Note: After using the Serial Command Interface, it is not allowed to send SCI or SDI data for 5 microseconds. 5.4.2 SCI Read VS1001k registers are read by the following sequence. First, XCS line is pulled low to select the device. Then the READ opcode (0x3) is transmitted via the SI line followed by an 8-bit word address. After the address has been read in, any further data on SI is ignored. The 16-bit data corresponding to the received address will be shifted out onto the SO line. XCS should be driven high after the data has been shifted out. In that case, the word address will be incremented and data corresponding to the next address will be shifted out. After the last word has been shifted out, XCS should be driven high to end the READ sequence. Version 4.14, 2004-02-10 18 VLSI Solution VS1001 K DATASHEET y 5. SPI BUSES Word read is shown in Figure 8. XCS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 30 31 SCK SI 0 0 0 0 0 0 1 1 7 6 5 4 instruction (READ) 3 2 1 0 don’t care address data out high impedance 15 SO 14 1 0 X Figure 8: SCI Word Read 5.4.3 SCI Write VS1001k registers are written by the following sequence. First, XCS line is pulled low to select the device. Then the WRITE opcode (0x2) is transmitted via the SI line followed by an 8-bit word address. After the word has been shifted in, XCS should be pulled high to end the WRITE sequence. XCS low to high transition must occur after SCLK high to low transition corresponding to LSB of the last word. Single word write is shown in Figure 9. XCS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 29 30 31 SCK SI 0 0 0 0 0 0 instruction (WRITE) 1 0 7 6 5 4 3 2 1 0 address 15 14 2 1 0 don’t care data in Figure 9: SCI Word Write Version 4.14, 2004-02-10 19 VLSI DATASHEET y Solution 5.5 VS1001 K 5. SPI BUSES SPI Timing Diagram tWL tXCSS tWH tXCSH XCS 0 1 14 15 tXCS 16 SCK SI tSU tH SO tZ tV tDIS Figure 10: SPI Timing Diagram. Symbol tXCSS tSU tH tZ tWL tWH tV tXCSH tXCS tDIS Min 5 10 42 Max 42 100 100 42 10 2 1 Unit ns ns ns ns ns ns ns ns XTALI cycles XTALI cycles Note: As tXCS must be at least 2 clock cycles, the maximum speed for the SPI bus is 1/4 of VS1001k’s internal clock speed. For details, see Application Notes for VS10XX. Version 4.14, 2004-02-10 20 VLSI DATASHEET y Solution 6 VS1001 K 6. FUNCTIONAL DESCRIPTION Functional Description 6.1 Main Features VS1001k is based on a proprietary digital signal processor, VS DSP. It contains all the code and data memory needed for MPEG audio decoding, together with serial interfaces, a multirate stereo audio DAC and analog output amplifiers and filters. VS1001k can play all MPEG 1 and 2 layer 3 files, as well as so-called MPEG 2.5 layer 3 extension files with all sample rates and bitrates. In addition, variable bitrate (VBR) is also supported. With VBR, and depending on the song, near-cd quality can be achieved with approximately 100 kbits/s for stereo music sampled at 44100 Hz, whereas old encoders required 128 kbits/s for the same task. As both commercial and free (http://www.mp3dev.org/) high-quality VBR encoders are nowadays widely available, MP3 format is getting better as it is maturing. 6.2 Data Flow of VS1001k SDI Bitstream FIFO 16384 bits MP1/2/3 decoding SM_BASS = 0 A1ADDR = 0 Bass/treble enhancer User application Volume control Audio FIFO SM_BASS = 1 A1ADDR != 0 VOL 512 stereo samples L S.rate.conv. and DAC R Figure 11: Data Flow of VS1001k. First, MP3 data is input through the SDI bus. After decoding, data may be sent to the Bass/treble enhancer depending on SCI register MODE’s bit SM BASS. Then, if SCI register AIADDR is non-zero, application code is executed from the address pointed to by AIADDR. For more details, see Chapters 6.5.10 and Application Notes for VS10XX. After the optional user application, the signal is fed to the volume control unit, which also copies the data to the Audio FIFO. The Audio FIFO holds the data that is read by the Audio interrupt (Chapter 8.5.1) and fed to the sample rate converter and DACs. The size of the audio FIFO is 512 stereo (2×16-bit) samples The sample rate converter converts all different sample rates to CLKI/512 and feeds the data to the DAC, which in order makes a stereo in-phase signal. This signal is then forwarded to the earphone amplifier. Version 4.14, 2004-02-10 21 VLSI DATASHEET y Solution 6.3 VS1001 K 6. FUNCTIONAL DESCRIPTION Serial Data Interface (SDI) The serial data interface is meant for transferring compressed MPEG audio data. Also several different tests may be activated through SDI as described in Chapter 7. 6.4 Serial Control Interface (SCI) The serial control interface is compatible with the SPI bus specification. Data transfers are always 16bits. The VS1001k is controlled by writing and reading the registers of the interface. The main controls of the control interface are: • • • • • • 6.5 control of the operation mode uploading user programs access to header data status information access to decoded digital data feeding input data SCI Registers Name MODE STATUS INT FCTLH CLOCKF DECODE TIME AUDATA WRAM WRAMADDR Type RW RW RW R R W W addr 0 1 2 3 4 5 6 7 HDAT0 HDAT1 AIADDR R R RW 8 9 10 VOL RESERVED AICTRL[x] RW RW 11 12 13+x Function mode control status of VS1001k internal register, never use clock freq + doubler decode time in seconds misc. audio data RAM write program base address for RAM write read header data read header data start address of application volume control reserved for VS1002 use, don’t touch 2 application control registers x = [0 .. 1] All registers are filled with zeros at hardware reset. Version 4.14, 2004-02-10 22 VLSI Solution DATASHEET y 6.5.1 VS1001 K 6. FUNCTIONAL DESCRIPTION MODE (RW) MODE is used to control the operation of VS1001k. Bit 0 Name SM DIFF Function differential 1 SM FFWD fast forward 2 SM RESET soft reset 3 4 SM UNUSED1 SM PDOWN set to 0 powerdown 5 6 7 SM UNUSED2 SM UNUSED3 SM BASS set to 0 set to 0 bass/treble enhancer 8 SM DACT 9 SM BITORD DCLK active edge Byte order on serial input bus 10 SM IBMODE input bus mode 11 SM IBCLK input bus clk when VS1001k is master Value 0 1 0 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 Description normal in-phase audio left channel inverted normal playback fast forward on no reset reset Set to 0 power on powerdown Set to 0 Set to 0 off on rising falling MSB first MSB last slave master 512 kHz 1024 kHz When SM DIFF is set, the player inverts the left output. For a stereo input, this creates a virtual surround, and for a mono input this effectively creates a differential left/right signal. By setting SM FFWD the player starts to accept SCI data at a high speed, and just decodes the audio headers silently without playing any data. This can be used to fast-forward data with safe landing. Register DECODE TIME is updated during a fast-forward just as normal. By setting SM RESET to 1, the player is reset. SM UNUSED1 should always be set to 0. Bit SM PDOWN overrides any other: it turns VS1001k into powerdown mode, where the only operational part is the control bus. (not implemented) SM UNUSED2 and SM UNUSED3 should always be set to 0. Bit SM BASS turns on the built-in Bass and Treble enhancer. The frequency response of the enhancer when the sample rate is 44.1 kHz is shown in Figure 12. For other sample frequencies the response frequence axis must be adjusted accordingly. Example: If the sample rate is 48 kHz, the 1 kHz frequency in the figure is actually 1 kHz × 48 kHz / 44.1 kHz = 1.09 kHz. For details of how much extra processing Version 4.14, 2004-02-10 23 VLSI Solution VS1001 K DATASHEET y 6. FUNCTIONAL DESCRIPTION power is needed when activating this feature, see Application Notes for VS10XX. ampl/dB +3 +2 +1 0 −1 −2 −3 f/Hz 10 20 50 100 200 500 1k 2k 5k 10k 20k Figure 12: Built-In Bass/Treble Enhancer Frequency Response at 44.1 kHz. SM DACT defines the active edge of data clock for SDI. SM BITORD defines the data bit order inside a byte for SDI. When clear the most significant bit of a byte is sent first and when set, the least significant bit is sent first. Bytes are, however, still sent in the default order. This register bit has no effect on the SCI bus. SM IBMODE sets input bus to master mode. Master mode has not been tested, and its use is not recommended. SM IBCLK sets the bus clock speed when VS1001k is the master. Version 4.14, 2004-02-10 24 VLSI Solution DATASHEET y 6.5.2 VS1001 K 6. FUNCTIONAL DESCRIPTION STATUS (RW) STATUS contains information on the current status of the VS1001k. Bits 1 and 0 are used to control analog output volume: 0 = -0 dB, 1 = -6 dB, 3 = -12 dB. Bit 2 is analog powerdown bit. When set to 1, analog is put to powerdown. Note: writing to register VOL will automatically set the analog output volume, and muting if necessary. Thus, the user needn’t worry about this register. 6.5.3 INT FCNTLH (-) INT FCTLH is not a user-accessible register. 6.5.4 CLOCKF (RW) CLOCKF is used to tell if the input clock XTALI is running at something else than 24.576 MHz. XTALI is set in 2 kHz steps. Thus, the formula for calculating the correct value for this register is XT ALI/2000 (XTALI is in Hz). Values may be between 0..32767, although hardware limits the highest allowed speed. Also, with lower-than 24.576 MHz speeds all sample rates and bit-stream widths are no longer available. Setting the MSB of CLOCKF to 1 activates internal clock-doubling. A clock of upto 15 MHz may be doubled depending on the voltage provided to the chip. Note: CLOCKF must be set before beginning decoding MP3 data; otherwise the sample rate will not be set correctly. Example 1: For a 26 MHz clock the value would be 26000000/2000 = 13000. Example 2: For a 13 MHz external clock and using internal clock-doubling for a 26 MHz internal frequency, the value would be 0x8000 + (13000000/2000) = 39268. Example 3: For a 24.576 MHz clock the value would be either 24576000/2000 = 12288, or just the default value 0. For this clock frequency, CLOCKF doesn’t need to be set at all. 6.5.5 DECODE TIME (R) When decoding correct data, current decoded time is shown in this register in full seconds. Version 4.14, 2004-02-10 25 VLSI Solution DATASHEET y 6.5.6 VS1001 K 6. FUNCTIONAL DESCRIPTION AUDATA (R) When decoding correct data, the current bitrate in kbits/s can be found in bits 8..0 of AUDATA. For a variable bitrate bitstream, the current bitstream width is displayed. Bits 12..9 contains an index to the sample rate. The indices are shown in the table below. Bits 14..13 are not in use and always set to 0. Bit 15 is 0 for mono data and 1 for stereo. Bits 12..9 0b0000 0b0001 0b0010 0b0011 0b0100 0b0101 0b0110 0b0111 0b1000 0b1001 6.5.7 Sample Rate/Hz Unknown 44100 48000 32000 22050 24000 16000 11025 12000 8000 WRAM (W) WRAM is used to upload application programs to program RAM. The start address must be initialized by writing to the WRAMADDR register prior to the first call of WRAM. value will be used. As 16 bits of data can be transferred with one WRAM write, and the program word is 32 bits, two consecutive writes are needed for each program word. The byte order is big-endian (i.e. MSBs first). After each full-word write, the internal pointer is autoincremented. 6.5.8 WRAMADDR (W) WRAMADDR is used to set the program address for following WRAM writes. User program space is between addresses 0x4000 .. 0x43ff (with addresses 0x4000 .. 0x401f being reserved by the system), but for writes through the WRAM mechanism, they are visible at addresses 0x4000 higher. Thus, if the programmer wish to write his application to address 0x4167, he should write 0x4167 + 0x4000 = 0x8167 to WRAMADDR. Version 4.14, 2004-02-10 26 VLSI Solution DATASHEET y 6.5.9 VS1001 K 6. FUNCTIONAL DESCRIPTION HDAT0 and HDAT1 (R) Bit HDAT1[15:5] HDAT1[4:3] Function syncword ID HDAT1[2:1] layer HDAT1[0] protect bit HDAT0[15:12] HDAT0[11:10] bitrate sample rate HDAT0[9] pad bit HDAT0[8] HDAT0[7:6] private bit mode HDAT0[5:4] HDAT0[3] extension copyright HDAT0[2] original HDAT0[1:0] emphasis Value 2047 3 2 1 0 3 2 1 0 1 0 3 2 1 0 1 0 3 2 1 0 1 0 1 0 3 2 1 0 Explanation stream valid ISO 11172-3 1.0 MPG 2.0 (1/2-rate) MPG 2.5 (1/4-rate) MPG 2.5 (1/4-rate) I II III reserved No CRC CRC protected ISO 11172-3 reserved 32/16/8 kHz 48/24/12 kHz 44/22/11 kHz additional slot normal frame not defined mono dual channel joint stereo stereo ISO 11172-3 copyrighted free original copy CCITT J.17 reserved 50/15 microsec none When read, HDAT0 and HDAT1 contain header information that is extracted from MPEG stream being currently being decoded. Right after resetting VS1001k, 0 is automatically written to both registers, indicating no data has been found yet. The “sample rate” field in HDAT0 is interpreted as follows: if the “ID” field in HDAT1 is ’1’, the highest sample rate is used. If “ID” is ’0’, half sample rate is used. For ’2’ and ’3’, the lowest sample rate is used. Note: The sample rate, stereo/mono and bitrate information can more easily be read from register AUDATA. Version 4.14, 2004-02-10 27 VLSI DATASHEET y Solution 6.5.10 VS1001 K 6. FUNCTIONAL DESCRIPTION AIADDR (RW) AIADDR indicates the start address of the application code written earlier through WRAMADDR and WRAM registers. If no application code is used, this register should not be initialized, or it should be initialized to zero. For more details, see Application Notes for VS10XX. 6.5.11 VOL (RW) VOL is a volume control for the player hardware. For each channel, a value in the range of 0 .. 255 may be defined to set its attenuation from the maximum volume level (in 0.5 dB steps). The left channel value is then multiplied by 256 and the values are added. Thus, maximum volume is 0 and total silence if 65535. Example: for a volume of -2.0 dB for the left channel and -3.5 dB for the right channel: (4*256) + 7 = 1031. Note, that at startup volume is set to full volume. Resetting the software does not reset the volume setting. Note: Setting the volume to total silence (255 for both left and right channels), will turn analog power off. This will save power, but also cause a slight snap in the earphones. If you want to turn the volume off but don’t want this snap, turn the volume only to 254 for both channels (0xFEFE). 6.5.12 RESERVED (RW) This register has been reserved for future use. 6.5.13 AICTRL[x] (RW) AICTRL[x] -registers ( x=[0 .. 1] ) can be used to access the user’s application program. 6.6 Stereo Audio DAC The decoded digital data is transformed into analog format by an 18-bit oversampling multi-bit sigmadelta DA-converter. The oversampled output is low-pass filtered by an on-chip analog filter. The output rate of the DA-converter is always 1/4 of the clock rate, or 128 times the highest usable sample rate. For instance for a 24.576 MHz clock, the DA-converter operates at 128x48 kHz, which is 6.144 MHz. If the input sample rate is other than 48 kHz, it is internally converted to 48 kHz by the DAC. This removes the need for complex PLL-based clocking schemes and still allows the use of several sample rates with one fixed master clock frequency. The outputs can be separately muted by the user. If the output of the decoder is invalid or input data is not received fast enough, analog outputs are automatically muted. The analog outputs have buffers that are capable of driving 30Ω loads with a maximum of 50nF capacitance. Version 4.14, 2004-02-10 28 VLSI DATASHEET y Solution 7 VS1001 K 7. OPERATION Operation 7.1 Clocking The VS1001k chip operates typically on a single 24.576 MHz fundamental frequency master clock. This clock can be generated by external circuitry (connected to pin XTALI) or by the internal clock chrystal interface (pins XTALI and XTALO). This clock is sufficient to support a high quality audio output for almost all the standard sample rates and bit-rates (see Application Notes for VS10XX). Note: Oscillators above 24.576 MHz are usually so-called 3rd harmonic clocks, which have a fundamental frequency of 1/3 of the nominal clock frequency. With such an oscillator, VS1001 would be running at the base frequency, if working at all. Thus, for instance, if you run VS1001 with a 32 MHz 3rd harmonic clock, you usually end up running the chip at 32 MHz / 3 = 10.67 MHz. 7.2 Powerdown In powerdown mode the chip only monitors the control bus. The analog output drivers are turned off and the processor remains in hold-state. 7.3 Hardware Reset When the XRESET -signal is driven low, VS1001k is reset and all the control registers and internal states are set to the initial values. XRESET-signal is asynchronous to any external clock. The reset mode doubles as a full-powerdown mode, where both digital and analog parts of VS1001k are in minimum power consumption stage, and where clocks are stopped. Also XTALO and XTALI are grounded. After a hardware reset (or at power-up), set the basic software registers such as VOL for volume (and CLOCKF if the input clock is anything else than 24.576 MHz) before starting decoding. 7.4 Software Reset Between any two MP3 files, the decoder software has to be reset. This is done by activating bit 2 in SCI’s MODE register (Chapter 6.5.1). Then wait for at least 2 µs, then look at DREQ. DREQ will stay down for at least 6000 clock cycles, which means an approximate 250 µs delay if VS1001k is run at 24.576 MHz. When DREQ goes up, write at least one zero to SDI. After this, you may continue playback as usual. If you want to make sure VS1001k doesn’t cut the ending of low-bitrate data streams, it is recommended to feed 2048 zeros to the SDI bus before activating the reset bit (DREQ must be respected just as with normal SDI data). This will make sure all frames have been decoded before resetting the chip. Version 4.14, 2004-02-10 29 VLSI DATASHEET y Solution 7.5 VS1001 K 7. OPERATION Play/Decode This is the normal operation mode of VS1001k. The SDI data is decoded. Decoded samples are converted to analog domain by the internal DAC, If there are errors in the decoding process, the error flags of SCI’s HDAT0 and HDAT1 are set accordingly. In case there are serious errors in the input data, decoding is still continued, but the analog outputs are muted. When there is no valid input for decoding, VS1001k goes into idle mode (lower power consumption than during decoding) and actively monitors the serial data input for valid data. The data input does not need to be clocked (DCLK) when no data is sent. The software needs to be reset between MPEG audio stream files. See for the Chapter “Testing” to see how it is done. 7.6 Sanity Checks Although VS1001k checks extensively for bad MP3 streams, it may happen that it encounters a bitstream that makes the firmware’s recovery code fail. This may particularly happen during fast forward and fast backwards operations, where the data where the microcontroller lands the MP3 decoder may not be a valid header. The microcontroller should keep a look at the data speeds VS1001k requires. If data input either stops completely (DREQ always inactive) for a whole second, or if VS1001k requires more than 60 KiB data in any single second, it is the responsibility of the microcontroller to either reset the software. If that doesn’t help, a hardware reset should be issued. 7.7 PCM Mode VS1001k can be used as a Digital-to-Analog converter (DAC) by feeding PCM data. A convenient way to use VS1001k as a DAC is to load SDI PCM Extension for VS1001k software from VLSI Solution’s home page at http://www.vlsi.fi/vs1001/software/. The SDI PCM Extension makes it possible for the user to use SDI to feed 8-bit or 16-bit PCM samples in mono or stereo at any sample rate upto 48 kHz (with nominal 24.576 MHz operating frequency). 7.8 Testing There are several test modes in VS1001k, which allow the user to perform memory tests, SCI bus tests, and several different sine wave tests ranging from 250 Hz to 1500 Hz. All tests are started in a similar way: VS1001 is hardware reset, and then a test command is sent to the SDI bus. Each test is started by sending a 4-byte special command sequence, followed by 4 zeros. The sequences are described below. Version 4.14, 2004-02-10 30 VLSI Solution DATASHEET y 7.8.1 VS1001 K 7. OPERATION Memory Test Memory test mode is initialized with the 8-byte sequence 0x4D 0xEA 0x6D 0x54 0 0 0 0. After this command (and its required 4 zeros), wait for 500000 clock cycles. The result can be read from the SCI register HDAT0, and ’one’ bits are interpreted as follows: Bit(s) 0 1 2 3 4 5 6 7 Meaning Good X ROM Good Y ROM (high) Good Y ROM (low) Good Y RAM Good X RAM Good Instruction RAM (high) Good Instruction RAM (low) Unused All tests are non-destructive and interrupts are disabled during testing. Thus, no user software or data is harmed by the tests. Instruction ROM cannot be tested with software. 7.8.2 SCI Test Sci test is initialized with the 8-byte sequence 0x53 0x70 0xEE n 0 0 0 0, where n − 48 is the register number to test. The content of the given register is read and copied to HDAT0. If the register to be tested is HDAT0, the result is copied to HDAT1. Example: if n is 48, contents of SCI register 0 (MODE) is copied to HDAT0. Version 4.14, 2004-02-10 31 VLSI Solution DATASHEET y 7.8.3 VS1001 K 7. OPERATION Sine Test Sine test is initialized with the 8-byte sequence: 0x53 0xEF 0x6E n 0 0 0 0, where n (48..119) defines the sine test to use. If we define F sIdx = (n − 48)mod9 and F Sin = (n − 48)/9, the following tables may be used: FsIdx 0 1 2 3 4 5 6 7 8 Fs 44100 Hz 48000 Hz 32000 Hz 22050 Hz 24000 Hz 16000 Hz 11025 Hz 12000 Hz 8000 Hz FSin 0 1 2 3 4 5 6 7 Length of Sin 32.000 samples 16.000 samples 10.667 samples 8.000 samples 6.400 samples 5.333 samples 4.571 samples 4.000 samples Example: Sine test is called with a test value of 62. 62-48 = 14, FsIdx = 5 and FSin = 1. From the tables we get the sample rate 16000 Hz, and the sine wave length, which is 16 samples. Thus, we’ll get a 1 kHz voice. To exit the sine test, send the sequence 0x45 0x78 0x69 0x74 0 0 0 0. Note: The sine test signals go through the digital volume control, so it is possible to test channels separately. Version 4.14, 2004-02-10 32 VLSI DATASHEET y Solution 8 VS1001 K 8. WRITING SOFTWARE Writing Software 8.1 When to Write Software User software is required when a user wishes to add some own functionality like DSP effects or tone controls to VS1001k. Some tone controls are available from VLSI Solution, but if a user wishes to go further than that or use VS1001k in some unexpected way, this is how to do it. However, most of the users of VS1001k don’t need to worry about writing their own code, or this chapter. 8.2 The Processor Core VS DSP is a 16/32-bit DSP processor core that can very well also be used as an all-purpose processor. The VLSI Solution’s free VSKIT Software Package contains all the tools and documentation needed to write, simulate and debug Assembly Language or Extended ANSI C programs for the VS DSP processor core. The VSKIT Software Package is available on request from VLSI Solution. 8.3 User’s Memory Map User’s Memory Map is shown in Figure 13. 8.4 Hardware Registers All hardware registers are located in X memory. 8.4.1 SCI Registers, 0x4000 All SCI registers described in Chapter 6.5 can be found here between 0x4000..0x40FF. 8.4.2 Serial Registers, 0x4100 SER DATA (0x4100) contains the last data value read from the data bus. The LSB of SER DREQ (0x4101) defines the status of the DREQ signal. Version 4.14, 2004-02-10 33 VLSI Solution VS1001 K DATASHEET y Instruction (32−bit) 0000 0097 X (16−bit) Y (16−bit) Stack Stack 0000 0097 User Space 0780 07FF 0780 07FF User Space 1380 13FF 4000 4020 8. WRITING SOFTWARE 1380 13FF System Vectors User Instruction Space 4000 4020 Hardware Registers 43FF 43FF 8000 8020 Instruction Shadow Memory Instruction Shadow Memory MSBs LSBs 8000 8020 83FF 83FF Figure 13: User’s Memory Map. 8.4.3 DAC Registers, 0x4200 DAC data should be written at each audio interrupt to DAC LEFT (0x4200) and DAC RIGHT (0x4201) as signed values. INT FCTLL (0x4202) is not a user-serviceable register. 8.4.4 Interrupt Registers, 0x4300 INT ENABLE (0x4300) controls the interrupts. Bit 0 switches the DAC interrupt on (1) and off (0), bit 1 controls the SCI interrupt, and bit 2 controls the DATA interrupt. It may take upto 6 clock cycles before changing this register has any effect. By writing any value to INT GLOB DIS (0x4301) adds one to the interrupt counter and effectively disables all interrupts. It may take upto 6 clock cycles before writing this register has any effect. Writing any value to INT GLOB ENA (0x4302) subtracts one from the interrupt counter. If the interrupt counter becomes zero, interrupts selected with INT ENABLE are restored. An interrupt routine should always write to this register as the last thing it does, because interrupts automatically add one to the interrupt counter, but subtracting it back to its initial value is on the responsibility of the user. It may take upto 6 clock cycles before writing this register has any effect. By reading INT COUNTER (0x4303) the user may check if the interrupt counter is correct or not. If the register is not 0, interrupts are disabled. This register may not be written to. Version 4.14, 2004-02-10 34 VLSI DATASHEET y Solution 8.5 VS1001 K 8. WRITING SOFTWARE System Vector Tags The System Vector Tags are tags that may be replaced by the user to take control over several decoder functions. 8.5.1 AudioInt, 0x4000..0x4001 Normally contains the following VS DSP assembly code: j dac_int stx mr1,(i6)+1 ; sty i7,(i6) The user may, at will, replace the first instruction with either a j or jmpi command to gain control over the audio interrupt. It is not recommended to change the instruction at 0x4001. 8.5.2 SpiInt, 0x4002..0x4003 Normally contains the following VS DSP assembly code: j spi_int stx mr1,(i6)+1 ; sty i7,(i6) The user may, at will, replace the first address with either a j or jmpi command to gain control over the SCI interrupt. It is not recommended to change the instruction at 0x4003. 8.5.3 DataInt, 0x4004..0x4005 Normally contains the following VS DSP assembly code: j data_int stx mr1,(i6)+1 ; sty i7,(i6) The user may, at will, replace the first address with either a j or jmpi command to gain control over the MP3 data interrupt. It is not recommended to change the instruction at 0x4005. 8.5.4 UserCodec, 0x4008..0x4009 Normally contains the following VS DSP assembly code: jr nop Version 4.14, 2004-02-10 35 VLSI DATASHEET y Solution VS1001 K 8. WRITING SOFTWARE If the user wants to take control away from the standard decoder, the first instruction should be replaced with an appropriate jump command to user’s own code. Unless the user is feeding MP3 data at the same time, the system activates the user program in less than 1 ms. After this, the user should steal interrupt vectors from the system, and then insert user programs. 8.6 System Vector Functions The System Vector Functions are pointers to some functions that the user may call to help implementing his own applications. 8.6.1 WriteIRam(), 0x4010 VS DSP C prototype: void WriteIRam(register i0 u int16 *addr, register a1 u int16 msW, register a0 u int16 lsW); This is the only supported way to write to the User Instruction RAM. This is because Instruction RAM cannot be written when program control is in RAM. Thus, the actual implementation of this function is in ROM, and here is simply a tag to that routine. Note: Instruction RAM is shadowed 0x4000 addresses higher in the X and Y RAMs. Thus, if you want to write to instruction address 0x4020, addr must be 0x4020 + 0x4000 = 0x8020. 8.6.2 ReadIRam(), 0x4011 VS DSP C prototype: u int32 ReadIRam(register i0 u int16 *addr); This is the only supported way to read from the User Instruction RAM. This is because Instruction RAM cannot be read when program control is in RAM. Thus, the actual implementation of this function is in ROM, and here is simply a tag to that routine. A1 contains the MSBs and a0 the LSBs of the result. Note: Instruction RAM is shadowed 0x4000 addresses higher in the X and Y RAMs. Thus, if you want to read from instruction address 0x4020, addr must be 0x4020 + 0x4000 = 0x8020. Version 4.14, 2004-02-10 36 VLSI Solution DATASHEET y 8.6.3 VS1001 K 8. WRITING SOFTWARE DataWords(), 0x4012 VS DSP C prototype: u int16 DataWords(void); If the user has taken over the normal operation of the system by switching the pointer in UserCodec to point to his own code, he may read data from the Data Interface through this and the following two functions. This function returns the number of data words (each containing two bytes of data) that can be read. If there is not enough data available, data acquisition functions GetDataByte() and GetDataWords() may NOT be called! 8.6.4 GetDataByte(), 0x4013 VS DSP C prototype: u int16 GetDataByte(void); Reads and returns one data byte from the Data Interface. Before calling this function, always check first that there are at least 1 word waiting with function DataWords(). 8.6.5 GetDataWords(), 0x4014 VS DSP C prototype: void GetDataWords(register i0 y u int16 *d, register a0 u int16 n); Read n data byte pairs and copy them in big-endian format (first byte to MSBs) to d. Before calling this function, always check first that there are at least 1+n words waiting with function DataWords(). Version 4.14, 2004-02-10 37 VLSI DATASHEET y Solution 9 VS1001 K 9. VS1001 VERSION CHANGES VS1001 Version Changes This chapter describes changes between different generations of VS1001. Note: VS1001k is the final, production version of VS1001. 9.1 Changes Between VS1001h and Production Version VS1001k, 2001-08 • When the chip is reset with pin XRESET, XTALO and XTALI are driven to ground. • Running with normal clock earlier required slightly different clock generation than for clockdoubled (see Chapters 4.1 and 4.2). This is no longer the case. • Lots of new SCI register MODE bits: SM DIFF, SM FFWD, SM BASS. For details, see Chapter 6.5.1. • Default is now to only decode MP3. • 20..60 mV DAC offset corrected. • A firmware bug made it impossible to decode 320 kbits/s MP3 data. This has been corrected. • A hardware bug made it practically impossible to load code to RAM. This has been corrected. 9.2 Changes Between VS1001g and VS1001h, 2001-05 • Analog voltage requirements have been lowered. Now full gain can be achieved with a 2.7 V analog input voltage, whereas 3.4 V was needed before. 9.3 Changes Between VS1001d to VS1001g, 2001-03 • Clock is now adjustable, in VS1001d only 24.576 MHz could be used. • Clock doubler added. • VS1001d played 48 kHz instead of 12 or 24 kHz, this is corrected. Version 4.14, 2004-02-10 38 VLSI DATASHEET y Solution 10 VS1001 K 10. DOCUMENT VERSION CHANGES Document Version Changes This chapter describes the most important changes to this document. 10.1 Changes Between Version 4.13 and 4.14 for VS1001k, 2004-02 • New pin names for pins 41 (GBGND) and 43 (GBVDD) in LQFP-48 Pin Description, Chapter 6.5.1. • Renamed SM BYTEORD to SM BITORD, see Chapter 3.3. 10.2 Changes Between Version 4.12 and 4.13 for VS1001k, 2003-11 • Changed pin 42 (VCM) to GBUF in Chapter 3.3. • Added example connection diagram for LQFP-48, Chapter 4.3. 10.3 Changes Between Version 4.11 and 4.12 for VS1001k, 2003-10 • In Chapter 3.3, TEST1 and TEST2 were told to be connected to pin 32 in LQFP-48 packaging, now corrected to pins 33 and 34, respectively. 10.4 Changes Between Version 4.10 and 4.11 for VS1001k, 2003-09 • Minor modifications to front page. • Moved all Application Notes to a separate document, VS10XX Application Notes. 10.5 Changes Between Version 4.08 and 4.10 for VS1001k, 2003-07 • Added LQFP-48 packaging, Chapter 3.3. • Removed package figure for BGA-49 and provided an URL instead. 10.6 Changes Between Version 4.07 and 4.08 for VS1001k, 2003-03 • Removed MP1 and MP2 functionality due to firmware problems. • Removed Chapter Errata. Version 4.14, 2004-02-10 39 VLSI Solution DATASHEET y 11 VS1001 K 11. CONTACT INFORMATION Contact Information VLSI Solution Oy Hermiankatu 6-8 C FIN-33720 Tampere FINLAND Fax: +358-3-316 5220 Phone: +358-3-316 5230 Email: [email protected] URL: http://www.vlsi.fi/ Note: If you have questions, first see http://www.vlsi.fi/vs1001/faq/ . Version 4.14, 2004-02-10 40