This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320DAC3101: Not able to generate BEEP in TLV320DAC3101.

Part Number: TLV320DAC3101

Hello,


We'r currently using TLV3210DAC3101 dac in one of our projects. I intend to generate a BEEP sound so as to clear the DAC hardware interface. Iam generating the MCLK from FPGA and feeding it to dac. The wclk and bclk signals will be output from the dac. I have written a initial setup code to be run in u-boot as per the script file mentioned in the TLV3210DAC3101 datasheet. I have attached the setup code also.

My current issue is iam able to hear a faint pop-sound but not able to hear any beep when i run the code in uboot. I have ensured all the registers are written with the correct values. I request the support the team to kindly review the setup code and let me know if any step is being missed.

TLV320DAC3101.c
Fullscreen
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*DAC register setting implementation implementation
* Function name :DAC TLV320DAC3101 related
* By:Vikram.R
* Description :This code is used for register setting of TLV320DAC3101
* Mode:Master, Codec interface: i2s, Word length: 16, MCLK of 16MHz and DIN given from FPGA
*
*/
#include <common.h>
#include <command.h>
#include <i2c.h>
#define DAC_I2C_ADDR 0x18
#define DAC_SW_RESET 0x01
#define PLL_CLKIN_CODEC_CLKIN 0x03
#define PLL_POWER_P_R 0x91
#define DAC_PLLJ 0x05
#define DAC_D_MSB 0x0E
#define DAC_D_LSB 0xB0
#define DAC_NDAC 0x82
#define DAC_MDAC 0x87
#define DAC_DOSR_MSB 0x00
#define DAC_DOSR_LSB 0x80
#define DAC_CODEC_IF_CNTRL 0x0l
#define DAC_PRB_SELECT 0x19
void dac_i2c_write(uchar , uchar);
void dac_tisbc_setup()
{
dac_i2c_write(0x0, 0x0); /*Set register page to 0*/
dac_i2c_write(0x1, DAC_SW_RESET); /*Initiate SW reset (PLL is powered off as part of reset)*/
dac_i2c_write(0x4, PLL_CLKIN_CODEC_CLKIN); /*PLL_clkin = MCLK,codec_clkin = PLL_CLK*/
dac_i2c_write(0x5, PLL_POWER_P_R);/*PLL Power up, P = 1, R = 1 */
dac_i2c_write(0x6, DAC_PLLJ);/*J = 5*/
dac_i2c_write(0x7, DAC_D_MSB);/*D=3760=>0x0EB0*/
dac_i2c_write(0x8, DAC_D_LSB);/*D=3760=>0x0EB0*/
dac_i2c_write(0x0B,DAC_NDAC);/*NDAC is powered up and set to 2*/
dac_i2c_write(0x0C,DAC_MDAC);/*MDAC is powered up and set to 7*/
dac_i2c_write(0x0D,DAC_DOSR_MSB);/*DOSR MSB is 0*/
dac_i2c_write(0x0D,DAC_DOSR_LSB);/*DOSR LSB is 0x80 => DOSR value is 128*/
dac_i2c_write(0x1B,0x0C);/*mode is i2s, wordlength is 16, master mode*/
dac_i2c_write(0x3C, 0x19); /*select processing block PRB_P25*/
dac_i2c_write(0x00, 0x08); /*Select Page 8*/
dac_i2c_write(0x01, 0x04); /*Adaptive filtering anabled in DAC processing block*/
dac_i2c_write(0x00, 0x00); /*Change to page 0 */
/* BEEP Settings*/
dac_i2c_write(0x47,0x83); /* vol of -1dB Left */
dac_i2c_write(0x48, 0x43);/* vol of -1dB Right*/
dac_i2c_write(0x49, 0x03);/*BEEP length MSB*/
dac_i2c_write(0x4A, 0xC9);/*BEEP length Middle*/
dac_i2c_write(0x4B, 0x80);/*BEEP length LSB*/
dac_i2c_write(0x4C, 0x10);/*Sine Coeff*/
dac_i2c_write(0x4D, 0xD8);/*Sine Coeff*/
dac_i2c_write(0x4E, 0x7E);/*Cosine Coeff*/
dac_i2c_write(0x4F, 0xE3);/*Cosine Coeff*/
dac_i2c_write(0x74, 0x80);/*volume control thru pin enable*/
/*Program analog blocks*/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Regards,

Vikram.R

  • Hi, Vikram,

    The beep sounds are related to the clock settings and the registers configuration. Could you provide additional information, please?

    Are you getting the correct BCLK and WCLK values from your DAC3101? In order to generate the beep tone, you need to have at least few BCLK pulses.
    Which MCLK frequency are you using and which is the sampling rate that you are configuring?
    Which output are you trying to use?

    Thank you.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hello Luis Fernando Rodríguez,

    Thanks for the reply.

    I am not getting any output on BCLK and WCLK even though I have set these clocks to be output from the DAC. I am giving 48Mhz MCLK clock from FPGA to DAC(verified using oscilloscope ) and a sampling frequency is set as 48KHz. I am trying to drive HPL/HPR output.  I am able to read and write I2C registers from uboot. So DAC register access is not an issue. Please let me know if anything I have missed.

    P.S: Register settings file is attached in previous post.

    Regards,

    Vikram.R

    Senior Engineer

    Bharat Electronics Limited

  • Hi, Vikram.

    This should be related with the sampling rate calculation. It seems that the PLL values are not correctly configured to get 48KHz. I would recommend to configure the PLL and dividers values according to the Table 5-28 of datasheet. Specifically, I would recommend to configure the values as:

    P = 4
    R = 1
    J = 7
    D = 1680
    MDAC = 7
    NDAC = 2
    DOSR = 128

    Best regards,
    Luis Fernando Rodríguez S.
  • Hello Luis,


    Thanks for the reply. I had mentioned wrongly that MCLK is 48Mhz, wherein it was 16Mhz(and values according to table 5-28 of the datasheet). Nevertheless I tried using 48Mhz and values you had mentioned. Still the issue remains the same. Is there anything else I can check ? Thanks for the support.

    Regards,

    Vikram.R

    Senior Engineer

    Bharat Electronics Limited

  • Hello, Vikram,

    You would require to generate WCLK and BCLK from the DAC. Both clocks seem to be configured as outputs in your register configuration (page 0 / register 0x1b). However, you still need to configure the BCLK output with page 0 / registers 0x1d & 0x1e. These registers are used to select the BCLK output (DAC_CLK or DAC_MOD_CLK) and to enable the BCLK-N Divider. Basically, this divider must be enabled to generate the BCLK output. DAC_CLK or DAC_MOD_CLK will be routed with page 0 / register 0x1d and the frequency will be divided by BCLK-N.

    Could you try this, please? Let me know if the problem persists.

    Best regards,
    Luis Fernando Rodríguez S.
  • Dear Rodríguez,


    Thanks for the info. I have enabled the clock register 0x1d and set the divider value as 1 in register 0x1e of page 0. Still the issue remains. Please let me know if any other parameters ,hardware/software, I need to check.

    Thanks for your prompt responses.

    P.S: I feel the script file in the datasheet can be updated to include the above two register settings mentioned by you.

    Regards,

    Vikram.R

  • Hi, Vikram,

    Could you try with the following script? It is a complete example script that contains all the configuration of the TLV320DAC3101. I modified the PLL and Beep values in order to adapt it to your code.

    Beep_Master_Mode_Script.txt
    Fullscreen
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    # Key: w 30 XX YY ==> write to I2C address 0x30, to register 0xXX, data 0xYY
    # # ==> comment delimiter
    #
    # The following list gives an example sequence of items that must be executed in the time
    # between powering the # device up and reading data from the device. Note that there are
    # other valid sequences depending on which features are used.
    # 1. Define starting point:
    # (a) Power up applicable external hardware power supplies
    # (b) Set register page to 0
    #
    w 30 00 00
    #
    # (c) Initiate SW reset (PLL is powered off as part of reset)
    #
    w 30 01 01
    #
    # 2. Program clock settings
    # (a) Program PLL clock dividers P, J, D, R (if PLL is used)
    #
    # PLL_clkin = MCLK,codec_clkin = PLL_CLK
    w 30 04 03
    # J = 5
    w 30 06 05
    # D = 3760, D(13:8) = 0x0E, D(7:0) = 0xB0
    w 30 07 0E B0
    #
    # (b) Power up PLL (if PLL is used)
    # PLL Power up, P = 1, R = 1
    #
    w 30 05 91
    #
    # (c) Program and power up NDAC
    #
    # NDAC is powered up and set to 2
    w 30 0B 82
    #
    # (d) Program and power up MDAC
    # MDAC is powered up and set to 7
    w 30 0C 87
    #
    # (e) Program OSR value
    #
    # DOSR = 128, DOSR(9:8) = 0, DOSR(7:0) = 128
    w 30 0D 00 80
    #
    # (f) Program I2S word length if required (16, 20, 24, 32 bits)
    # and master mode (BCLK and WCLK are outputs)
    #
    # mode is i2s, wordlength is 16, master mode
    w 30 1B 0C
    # BDIV_CLKIN = DAC_MOD_CLk; BCLK & WCLk active
    W 30 1D 05
    # BCLK_N = 2
    w 30 1E 82
    #
    # (g) Program the processing block to be used
    #
    # Select Processing Block PRB_P25
    w 30 3C 19
    w 30 00 08
    w 30 01 04
    w 30 00 00
    #
    # (h) Miscellaneous page 0 controls
    #
    # DAC => volume control thru pin disable
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best regards,
    Luis Fernando Rodríguez S.

  • Hello Rodriguez,

    Thanks for the script file. I will try it and let you know the status.

    Regards,

    Vikram.R

  • Hello Luis,

    Sorry for the delayed response.

    I tried the script file and there was no improvement.

    But recently I did try connecting the MICBIAS pin to VOL control pin (please see the schematics attached earlier in the previous threads). After this Iam getting BCLK and WCLK now. Still iam not getting the beep sound. Is this connection OK ?? I had left the MICBIAS pin floating all these days.

    In this regard I would like to know if the coefficients registers also have to be written ? Also I would like to know how to verify the BCLK and WCLK frequency Iam getting is correct.

    Regards,
    Vikram R
  • Hi, Vikram,

    Could you verify if Page 0 / Register 116 / Bit D7 is '1' on your register configuration? When DAC volume is controlled by a VOL pin, it is necessary to have a voltage level at VOL pin. So, I would recommend to place this bit as '0'.

    BCLK and WCLK frequencies should be as below:
    - WCLK is the sampling rate that you are trying to configure.
    - BCLK should be at least WCLK x (# channels) x (word length).

    Could you tell me what you refer with coefficients registers? If you refer to beep registers, it is necessary to write all them.

    Best regards,
    Luis Fernando Rodríguez S.
  • Hello Luis,

    I have tried both '0' and '1' for Page 0 / Register 116 / Bit D7. Still iam not able to hear any beep sound.

    By coefficient registers , I meant the page 8 coefficient registers for Buffers.

    I feel in software only Iam missing some register settings.  Is there any other registers I have to initialize ?

    Regards,

    Vikram.R