SLAS666B January 2010 – October 2018 TLV320DAC3101
PRODUCTION DATA.
A special algorithm has been included in the digital signal processing block PRB_P25 for generating a digital sine-wave signal that is sent to the DAC. The digital sine-wave generator is also referred to as the beep generator in this document.
This functionality is intended for generating key-click sounds for user feedback. The sine-wave generator is very flexible (see Table 6-22) and is completely register programmable. Programming page 0 / register 71 through page 0 / register 79 (8 bits each) completely controls the functionality of this generator and allows for differentiating sounds.
The two registers used for programming the 16-bit sine-wave coefficient are page 0 / register 76 and page 0 / register 77. The two registers used for programming the 16-bit cosine-wave coefficient are page 0 / register 78 and page 0 / register 79. This coefficient resolution allows virtually any frequency of sine wave in the audio band to be generated, up to fS / 2.
The three registers used to control the length of the sine-burst waveform are page 0 / register 73 through page 0 / register 75. The resolution (bit) in the registers of the sine-burst length is one sample time, so this allows great control on the overall time of the sine-burst waveform. This 24-bit length timer supports
16 777 215 sample times. For example, if fS is set at 48 kHz, and the register value equals 96 000 d (01 7700h), then the sine burst lasts exactly 2 seconds. The default settings for the tone generator, based on using a sample rate of 48 kHz, are 1-kHz (approximately) sine wave, with a sine-burst length of five cycles (5 ms).
LEFT BEEP CONTROL | RIGHT BEEP CONTROL | BEEP LENGTH | SINE | COSINE | |||||
---|---|---|---|---|---|---|---|---|---|
MSB | MID | LSB | MSB | LSB | MSB | LSB | |||
REGISTER | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
BEEP FREQUENCY | BEEP LENGTH | SINE | COSINE | SAMPLE RATE | |||||
---|---|---|---|---|---|---|---|---|---|
Hz | MSB
(hex) |
MID
(hex) |
LSB
(hex) |
MSB
(hex) |
LSB
(hex) |
MSB
(hex) |
LSB
(hex) |
Hz | |
1000(1) | 0 | 0 | EE | 10 | D8 | 7E | E3 | 48 000 |
Two registers are used to control the left sine-wave volume and the right sine-wave volume independently. The 6-bit digital volume control used allows level control of 2 dB to –61 dB in 1-dB steps. The left-channel volume is controlled by writing to page 0 / register 71, bits D5–D0. The right-channel volume is controlled by writing to page 0, register 72, bits D5–D0. A master volume control that controls the left and right channels of the beep generator are set up by writing to page 0 / register 72, bits D7–D6. The default volume control setting is 2 dB, which provides the maximum tone-generator output level.
For generating other tones, the three tone-generator coefficients are found by running the following script using MATLAB™:
Sine = dec2hex(round(sin(2*π*Fin/Fs)*2^15))
Cosine = dec2hex(round(cos(2*π*Fin/Fs)*2^15))
Beep Length = dec2hex(floor(Fs*Cycle/Fin))
where,
Fin = Beep frequency desired
Fs = Sample rate
Cycle = Number of beep (sine wave) cycles that are required
dec2hex = Decimal to hexadecimal conversion function
NOTES:
Following the beep-volume control is a digital mixer that mixes in a playback data stream whose level has already been set by the DAC volume control. Therefore, once the key-click volume level is set, the key-click volume is not affected by the DAC volume control, which is the main control available to the end user. Figure 1-1 shows this functionality.
Following the DAC, the signal can be further scaled by the analog output volume control and power-amplifier level control.
To insert a beep in the middle of an already-playing signal over DAC, use the following sequence.
Before the beep is desired, program the desired beep frequency, volume, and length in the configuration registers. When a beep is desired, use the example configuration script.
w 30 00 00 # change to Page 0
w 30 40 0C # mute DACs
f 30 26 xxx1xxx1 # wait for DAC gain flag to be set
w 30 0B 02 # power down NDAC divider
w 30 47 80 # enable beep generator with left channel volume = 0dB, volume level could
# be different as per requirement
w 30 0B 82 # power up NDAC divider, in this specific example NDAC = 2, but NDAC could
# be different value as per overall setup
w 30 40 00 # un-mute DAC to resume playing audio
Note that in this scheme the audio signal on the DAC is temporarily muted to enable beep generation. Because powering down of NDAC clock divider is required, do not use the DAC_CLK or DAC_MOD_CLK for generation of I2S clocks.