Appendix: YM7128 Surround Processor (SP2)

Yamaha YM7128 (SP2) surround-processor datasheet and the bit-serial protocol used to program it.


Introduction

This section briefly describes how to program the Yamaha YM7128 Surround Processor (SP2) on the Gold Card.

A first section describes the method used to access the SP2 chip through the Control Chip on the Ad Lib Gold card.

The second part is a hardware description of the SP2 chip.

Sample source code is also available in the Developer Toolkit disk, in the <SURROUND> directory. This sample source code demonstates the procedure used to download a surround preset to the SP2.

Communicating with the SP2

Register 18H of the Control Chip is used to interface with the SP2 Surround Processor.

Communication with the SP2 is done using a bit-serial protocol.

Modifying a register value to the SP2 involves sending a "register address - register value" pair to the SP2 using a special bit-serial protocol through register 18H.

SP2 bit-serial protocol

Bit 0 of register 18H is the Data Bit (DATA).

Bit 1 of register 18H is the Clock Bit (CLK).

Bit 2 of register 18H is the Address Latch Bit (ADR).

Each bit of a message is sent to the SP2 by first sending a byte with the CLK bit low.

The message bit is sent in a byte with CLK low and the DATA bit containing the desired bit value.

By sending a third byte with CLK high, and DATA set to the correct value, the bit is "latched" into the SP2.

The ADR bit is used to differentiate the register-address-register value parts of the message.

When the bytes related to the register address part of the message are sent, ADR should be low. When all 8 bits of the address have been sent, a bit should be sent with ADR high, to latch the register address to the SP2.

ADR should then be high while the bytes related to the register value part of the message is sent.

Finally a last byte with ADR low should be sent, to latch the register value part of the message.

Sample code on how this procedure is accomplished is supplied on the Developer Toolkit diskette (in directory SURROUND).

While communicating with the SP2, we reccomend that interrupts be disabled, in order to avoid access conflicts with background applications that could access the OPL3 chip or the Control Chip.

YM7128

Surround Processor (SP2)

OUTLINE

This is an LSI which has quality digital surround sound capabilities realized by Yamaha's digital audio technology. The LSI has built-in A/D and D/A converters which enable digital surround sound processing for analog input/output. Its eight digital delay lines may provide delay time of up to 100 msec. for each, and digital adding up of delay line signals for two-channel output assures a wide range of application.

FEATURES

  • The built-in RAM realizes digital delay time of 100 msec. * at the maximum.

  • Feedback loop can be constructed for reverberation.

  • Various surround effect can be obtained by controlling this LSI with serial data from microprocessor.

  • Digital attenuator is built in for surround sound volume control.

  • Sampling frequency is 23.6 kHz * , and 14 bit floating A/D converter is built in.

  • Two-times oversampling digital filter and 14 bit floating D/A converter are built in.

  • 16 pin DIP package, silicone gate CMOS 5V power supply.

PIN CONFIGURATIONS

Figure 6.6

TOP VIEW

PIN DESCRIPTIONS

Pin No.NameI/OFunction
1VDD-Digital+5V power supply
2AVDD-Analog+5V power supply
3CHOSample/hold capacitor terminal
4AINIAnalog signal input
5CVOCenter voltage of A/D
6/TII+Test terminal(without connection)
7LOOL channel, analog out
8ROOR channel, analog out
9AVSS-Analog ground
10VSS-Digital ground
11XOOX'tal oscillator terminal(7.16 MHz typ.)
12XII
13SCIIBit clock for microprocessor interface
14A0IWord clock for microprocessor interface
15DINISerial data for microprocessor interface
16/ICI+Initial clear terminal

+; pulled up

BLOCK DIAGRAM

Figure 6.7

FUNCTION DESCRIPTION

As shown in the block diagram, analog signal input at AIN terminal are converted to 14 bit digital signal with the sampling frequency of 28.6 kHz using 14 bit floating type A/D converter, and then attenuated by the digital attenuator VM. Tap T0 output of digital delay passes through first order FIR type low pass filter and attenuated by VC. These signals are added before they are input to digital delay. Digital delay has nine output taps and tap positions can be switched by the registers T0 to T8. Outputs of eight taps from T1 to T8 are attenuated and added for each channel with the digital attenuator from GL1 to GL8 and GR1 to GR8 respectively, and attenuated by digital attenuator VL or VR to be input to two-times oversampling digital filter. Since this filter attenuates aliasing noise, it reduces the burden on external analog low pass-filter. Digital input to D/A converter shall be with doubled value, which is 47.1 kHz sampling rate.

MICROPROCESSOR INTERFACE

Digital attenuation value, delay time and FIR type low pass filter coefficients are all set by writing data into registers.

With A0 = 'L", 8 bit address data are sent synchronizing with SCI. At the rising edge of A0, register address is taken in. With A0 = 'H", 8 bit data are sent synchronizing with SCI, then register data are changed at the falling edge of A0.

Figure 6.8

  • At the time of initial clear, VM, VC, VL and VR registers are reset to 0. Other register values are not fixed.

REGISTER MAP

Address(HEX)DataFunctionAddress(HEX)DataFunction
7654321076543210
00xxGL1Lch Tap attenuation value(bit 5; sign)10xxVMAttenuation value(bit 5; sign)
01xxGL211xxVC
02xxGL312xxVL
03xxGL418xxVR
04xxGL514xxC0FIR coefficient
05xxGL615xxC1
06xxGL716xxxT0Tap position
07xxGL817xxxT1
08xxGR1Rch Tap attenuation value(bit 5; sign)18xxxT2
09xxGR219xxxT3
0AxxGR31AxxxT4
0BxxGR41BxxxT5
0CxxGR51CxxxT6
0DxxGR61DxxxT7
0ExxGR71ExxxT8
0FxxGR8

Note 1) x; Don't Care

Note 2) Don't write to the other address

REGISTER DATA DESCRIPTION

(1) Attenuation value setting (GL1 to GL8, GR1 to GR8, VM, VC, VL, VR)

  • Output polarity (bit 5)

When bit 5 - "1": Output signal is in phase with input signal.

When bit 5 = "0": Output signal is reversed phase with input signal.

  • Attenuation value (bit 4-0)
Level(dB)Data(HEX)
43210
011111F
-211111E
-411101D
-611101C
-811011B
-1011011A
-12110119
-14110018
-16101117
-18101116
-20101015
-22101014
-24100118
-26100112
-28100111
-30100010
Level(dB)Data
48210(HEX)
-82011110F
-84011100E
-38011010D
-38011000C
-40010110B
-42010100A
-440100109
-460100008
-480011107
-500011006
-520010105
-540010004
-560001108
-580001002
-600000101
-∞0000000

(2) Delay time setting (T0 to T8) (XI=7.16 MHz)

Delay time(ms)Data
43210(HEX)
0.0000000
8.2000101
6.5001002
9.7001103
12.9001004
16.1001005
19.3001106
22.6001107
25.8010008
29.0010009
82.301010A
35.501010B
38.701100C
41.901100D
45.201110E
48.401110F
Delay time(ms)Data
43210(HEX)
51.6100010
54.9100011
58.1100112
61.9100113
64.5101014
67.8101015
71.0101116
74.2101117
77.4110018
80.7110019
83.911011A
87.111011B
90.411101C
93.611101D
96.811111E
100.011111F

(3) FIR Low Pass Filter coefficient setting (C0, C1).

The lower 6 bits of coefficient register are used as the upper 6 bits of 12 bit 2's compliment data actually processed inside.

Figure 6.9

Decimal point

SYSTEM BLOCK DIAGRAM

Figure 6.10

EXTERNAL DIMENSIONS

Figure 6.11

Figure 6.12

Figure 6.13

ELECTRICAL CHARACTERISTICS

  • Absolute maximum ratings
ParameterSymbolRatingUnit
Supply voltageVDD-0.3~+7.0V
Operating temperatureTop-20~+85°C
Storage temperatureTatg-50~+125°C
  • Recommended operating conditions
ParameterSymbolMin.Typ.Max.Unit
Supply voltageVDD4.755.05.25V
Operating temperatureTop02570°C
  • DC characteristics (Conditions: )
ParameterSymbolConditionMin.Typ.Max.Unit
Supply currentIDD50mA
High-level input voltage(1)VIH12.0V*1
Low-level input voltage(1)VIL10.8V*1
High-level input voltage(2)VIH24.0V*2
Low-level input voltage(2)VIL20.8V*2
High-level output voltageVOHIOH=-0.4mA4.0V
Low-level output voltageVOLIOL=0.2mA0.4V
Input leakage currentIILVI=0~5V-1010µA
Input capacitanceC15.012.0pF
Output capacitanceCO10.0pF

Note 1: Applicable to the input terminals except XI Note 2: Applicable to XI terminal

  • AC characteristics (Conditions:
ParameterSymbolMin.Typ.Max.Unit
XIInput frequencyfc8.67.168.6MHz
Duty405060%
Rise timeTCR50ns
Fall timeTCF50ns
SCIInput frequencyfsfc/8MHz
On-off timeTS600ns
Rise timeTSR200ns
Fall timeTSF200ns
  • ANALOG characteristics (Conditions:
ParameterSymbolConditionMin.Typ.Max.Unit
Analog input voltageVIAAIN terminal4.5Vp-p
Analog output voltageVOALO, RO terminal4.5Vp-p
DC offset voltageCV2.5V
Total harmonic distortionTHDoutput voltage 0dB0.30.4%
-10dB0.40.5%
-20dB0.40.5%
-30dB0.60.8%
S/NS/NS=0dB7580dB

Note) 0dB=1.5Vrms

REFERENCE CHARACTERISTICS 2 times oversampling filter

Figure 6.14

FREQUENCY

Output vs THD+NOISE

Figure 6.15

OUTPUT [Vrms]

The specifications of this product are subject to improvement changes without prior notice.

Figure 6.16

YAMAHA CORPORATION

Address inquiries to: Semi-conductor Sales Department

Head Office 203. Matsunokijima, Toyooka-mura, Iwata-gun, Shizuoka-ken, 438-01 Electronic Equipment business section Tel. 0639-62-4918 Fax. 0639-62-5054

Tokyo Office 8-4, Surugadal Kanda, Chlyoda-ku,

Tokyo, 101

Ryumeikan Bldg. 4F

Tel. 03-265-4481 Fax. 03-255-4488

Osaka Office 3-12-9, Minami Senba, Chuo-ku.

Osaka City, Osaka, 642

Shinsaibashi Plaza Bldg. 4F

Tel. 08-252-7980 Fax. 08-252-5615

U.S.A. YAMAHA Systems Technology. 652 Ridder Park Drive San Jose, CA95131 Tel. 408-437-3133 Fax. 408-437-8791

The following source code demonstrates how to program a Surround preset.

Function Write_Srnd_Reg writes the specified value to the YM7128 through the control chip register 18H. The sample code assumes that the control chip is located at address 38AH.

Function Write_Surround sends the 32 bytes of a suuround preset to the YM7128 using the bit-serial protocol. For each byte of the Surround preset, the register number (variable addr) is sent first , followed by the register value (variable data).


/*

    SURR.C

    Write a preset to the surround chip.

    Copyright 1992, Ad Lib Inc.

*/

unsigned control_io = 0x38a;        /* address of control chip section */

/* Write 'val' to the surround register in the control chip. */

static void _fastcall Write_Srnd_Reg (unsigned val)

{

    _asm {

        mov     dx, control_io

l10:

            in     al, dx

            test    al, 0c0h          ;status bits indicating chip is busy

            jnz     l10

            mov     ax, 18h          ;surround register number

            out     dx, al

            mov     ax, val

            inc     dx

            out     dx, al

    }

}

/* NOTE: When writing a byte to the control chip, it is very important that the transfer not be interrupted. Therefore, interrupts are disabled while the preset is being sent. */

void Write_Surround (unsigned char *preset);

{

unsigned addr, data, cmd;

int i, k;

_asm {

    pushf                        ;preserve the current interrupt state

    push     dx

    cli                        ;disable interrupts

    mov       dx, control_io

    mov       al, 0ffh            ;disable OPL3, enable control bank

    out       dx, al

}

/* Send the 31 array elements: */

for (i = 0; i < 31; i++) {

    cmd = 0;                        /* clock LOW, A0 LOW */

    addr = i;

    for (k = 7; k >= 0; k--) {

        cmd &= ~2;                    /* clock LOW */

        Write_Srnd_Reg (cmd);

        cmd = (cmd & ~1) | ((addr >> k) & 1);

        Write_Srnd_Reg (cmd);

        cmd |= 2;                    /* clock HIGH */

        Write_Srnd_Reg (cmd);

    }

    cmd |= 4;                        /* Set A0 to 1 */

    Write_Srnd_Reg (cmd);

    data = preset [i];

    for (k = 7; k >= 0; k--) {

        cmd &= ~2;                    /* clock LOW */

        Write_Srnd_Reg (cmd);

        cmd = (cmd & ~1) | ((data >> k) & 1);

        Write_Srnd_Reg (cmd);

        cmd |= 2;                    /* clock HIGH */

        Write_Srnd_Reg (cmd);

    }

    cmd &= ~4;                        /* Set A0 to 0 */

    Write_Srnd_Reg (cmd);

}

_asm {

    mov       dx, control_io

120:

    in       al, dx

    test     al, 0c0h            ;status bits indicating chip is busy

    jnz      l20

    mov       al, 0feh            ;enable OPL3, disable control bank

    out      dx, al

    pop      dx

    popf        ;restore previous interrupt state

}

}

Ad Lib Gold © Ad Lib Inc.1992 Confidential Mon, Mar 23,1992

PIN OUT FOR JOYSTICK-MIDI CONNECTOR OF THE Ad Lib GOLD CARD

Figure 6.17