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.

aic3204 beep not working

Hi,

I'm not able to get the beep generator working. The aic is configured for DAC Fs of 8000 samp/sec. I can play speech to the speaker just fin, but beep generator does not play a tone. In the aic3204 configuration, I set register 60 (DAC processing block) to 0x19 which should have enabled DAC processing block 25. Here is  the code I use to setup and enabled the beep generator. Any help would be greatly appreciated.

Thanks,

Jim

#define SIN_700_Q15             17121   // sin(2PI * 700/8000) * 32767
#define COS_700_Q15             27939   // cos(2PI * 700/8000) * 32767
#define TONE_GAIN_DB            6       // register value (0 ... 63) == gain of: (0 dB ... -63 dB)
#define TONE_DURATION_SECS      20ul
void aic3204_tonegen () {
Uint16 val;
Int16 hi, lo;
Uint32 samps;

    val = (TONE_GAIN_DB & 0x3F);
    AIC3204_rset( 0,  0x00);    // Select page 0

    AIC3204_rset( 71, val);  // set left channel volume and disable the generator
    AIC3204_rset( 72, val);  // set right channel volume

    samps = TONE_DURATION_SECS * 8000ul;  // DAC Fs == 8000 samp/sec

    // sample length bits 23:16
    val = (samps >> 16) & 0xFF;
    AIC3204_rset( 73, val);

    // sample length bits 15:8
    val = (samps >> 8) & 0xFF;
    AIC3204_rset( 74, val);

    // sample length bits 7:0
    val = samps & 0xFF;
    AIC3204_rset( 75, val);

    // sin (x)
    val = SIN_700_Q15;
    hi = (val >> 8) & 0xFF;
    lo = val & 0xFF;
    AIC3204_rset( 76, hi);
    AIC3204_rset( 77, lo);

    // cos (x)
    val = COS_700_Q15;
    hi = (val >> 8) & 0xFF;
    lo = val & 0xFF;
    AIC3204_rset( 78, hi);
    AIC3204_rset( 79, lo);

    // enable the generator    
    val = (TONE_GAIN_DB & 0x3F) | 0x80;
    AIC3204_rset( 71, val);  
}

  • Hi,

    Here is an example on how to get the tone generator working with the EVM:

    Initialization:

    ###############################################
    # Software Reset
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Initialize the device through software reset
    w 30 01 01
    #
    ###############################################
    
    
    
    ###############################################
    # Clock and Interface Settings
    # ---------------------------------------------
    # The codec receives: MCLK = 11.2896 MHz,
    # BLCK = 2.8224 MHz, WCLK = 44.1 kHz
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # PLL_clkin = MCLK, codec_clkin = PLL_CLK,
    # PLL on, P=1, R=1, J=8, D=0000
    w 30 04 03 91 08 00 00
    #
    # NDAC = 2, MDAC = 8, dividers powered on
    w 30 0b 82 88
    #
    # DOSR = 128
    w 30 0D 00 80
    #
    # NADC = 2, MADC = 8, dividers powered on
    w 30 12 82 88
    #
    # AOSR = 128
    w 30 14 80
    #
    ###############################################
    
    
    
    ###############################################
    # Configure Processing Blocks
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # PRB_P25 selected
    w 30 3C 19
    #
    # Select Page 44, Enable Adaptive filtering for DAC
    w 30 00 2c 04
    #
    ###############################################
    
    
    
    ###############################################
    # Configure Power Supplies
    ###############################################
    #
    # Select Page 1
    w 30 00 01
    #
    # Disable weak AVDD in presence of external
    # AVDD supply
    w 30 01 08
    #
    # Enable Master Analog Power Control
    w 30 02 00
    #
    # Set the input power-up time to 3.1ms (for ADC)
    w 30 47 32
    #
    # Set the REF charging time to 40ms
    w 30 7b 01
    #
    ###############################################
    
    
    
    ###############################################
    # Playback Setup
    ###############################################
    #
    # Select Page 1
    w 30 00 01
    #
    # De-pop
    w 30 14 25
    #
    # Route LDAC/RDAC to HPL/HPR
    w 30 0c 08 08
    #
    # Route LDAC/RDAC to LOL/LOR
    w 30 0e 08 08
    #
    # Power up HPL/HPR and LOL/LOR drivers
    w 30 09 3C
    #
    # Unmute HPL/HPR driver, 0dB Gain
    w 30 10 00 00
    #
    # Unmute LOL/LOR driver, 0dB Gain
    w 30 12 00 00
    #
    # Select Page 0
    w 30 00 00
    #
    # DAC => 0dB
    w 30 41 00 00
    #
    # Power up LDAC/RDAC
    w 30 3f d6
    #
    # Unmute LDAC/RDAC
    w 30 40 00
    #
    ###############################################
    
    
    
    ##########################
    # BEEP GENERATOR SETTINGS
    ##########################
    
    # Select Page 0
    w 30 00 00
    # Gain = -40dB
    w 30 47 28 28

    How to issue a beep:

    w 30 00 00              # Page 0
    w 30 40 0C              # Mute DACs
    f 30 26 xxx1xxx1        # Wait for mute flag
    w 30 0B 02              # Turn off NDAC
    w 30 47 8C              # Beep!
    w 30 0B 82              # Turn on NDAC
    w 30 40 00              # Un-mute DACs
    f 30 47 0xxxxxxx        # Wait for beep to finish

    Here is some information on how to calculate the frequency of the tone, etc:

    www.ti.com/.../slaa446

    Regards,

    J-