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.

CODEC 3204: cannot change volume

 

Hi

I use this code to change the volume at CODEC init. But later on while the codec is running I do the same thing and the CODEC ignores it..

Please recommend what I should be doing. Is there a sequence to change volume.

        ;Volume contol Left; (-12.0bB)0x68 to (20.0dB)0x28, 7 bits: D6 - D0

        AC1 = 83

        AR1 = 0x28 ;0x28: 20.0dB

        call i2c_WriteData8

 

        ;Volume contol Right

        AC1 = 84

        AR1 = 0x28

        call i2c_WriteData8

  • Hi microt,

     

    Registers 83 and 84 (on page 0) control the Left and Right ADC Channel Volume. You can change volume on the fly, just make sure to change the Page Select Register to page to 0 before accessing registers on page 0:

               

                ; Set Page Select Register to Page 0

                AC1 = 0

                AR1 = 0

                call i2c_WriteData8    

     

    If you want to control the volume of the DAC outputs, then you will need to configure these registers:

                Page 0 / Register 64: DAC Channel Setup Register 2

                Page 0 / Register 65: Left DAC Channel Digital Volume Control Register

                Page 0 / Register 66: Right DAC Channel Digital Volume Control Register

     

    I was able to change the DAC volume on the fly on the VC5505 eZDSP.

                                                                                                                                                      

    See the AIC3204 Datasheet (specifically 6.1 Register Map Summary)

     

    Hope this helps,

    Mark

  • Hi Mark

     

    Thanks..I just realized that I should have been changing the DAC volume. I will try that.

    I am also confused. What does the ADC volume control do. When I changed it nothing was really happening.

    It is not clear from the data sheet.

    I have setup the AGC and ADC volume like in the code below

    --

            ;AGC Target Left

            AC1 = 86

            AR1 = 0x80

            call i2c_WriteData8

     

            ;AGC Target Right

            AC1 = 94

            AR1 = 0x80

            call i2c_WriteData8

     

             ;AGC Max Left

            AC1 = 88

           AR1 = 0x3F

            call i2c_WriteData8

     

            ;AGC Max Right

            AC1 = 96

            AR1 = 0x3F

            call i2c_WriteData8

     

            ;Volume contol Left

            AC1 = 83

            AR1 = 0x28

            call i2c_WriteData8

     

            ;Volume contol Right

            AC1 = 84

            AR1 = 0x28

            call i2c_WriteData8

     

            ;AGC Noise thre. & Hyste. Left            

            AC1 = 87                                

            ;AR1 = 0x7E      ; -90 dB treshold and 2 dB hysteresis

            AR1 = 0x7C      ; -88 dB treshold and 2 dB hysteresis                             

            call i2c_WriteData8

     

            ;AGC Noise thre. & Hyste. Right         

            AC1 = 95                                 

            AR1 = 0x7C      ; -88 dB treshold and 2 dB hysteresis  

            call i2c_WriteData8

    --

    Please explain..

    Thanks

  • Hi microt,

    The ADC volume control (Page 0, Regs 83 & 84) just amplifies the inputs to the codec by a gain specified in the AIC3204 datasheet. In order to hear the effect, you must input an audio signal to the codec. See Table 5-2. Digital Volume Control for ADC.

    Additionally, Section 5.7 ADC Gain Setting describes the Analog Programmable Gain Amplifier (PGA), Digital Volume Control, and Automatic Gain Control (AGC) features of the codec. Definitions for Target Level (Page 0, Regs 86 & 94), Max PGA (Page 0, Regs 88 & 96), Hysteresis/Noise threshold (Page 0, Regs 87 & 95) also appear in this section.

    Quoting the datasheet, "AGC can be used to maintain a nominally-constant output level when recording speech. As opposed to manually setting the PGA gain, in the AGC mode, the circuitry automatically adjusts the PGA gain as the input signal becomes overly loud or very weak, such as when a person speaking into a microphone moves closer or farther from the microphone. The AGC algorithm has several programmable parameters, including target gain, attack and decay time constants, noise threshold, and max PGA applicable, that allow the algorithm to be fine tuned for any particular application."

    Out of curiosity, what is your application?

    You might find more answers by searching or posting on the Audio Converters E2E Forum.

    Hope this helps,
    Mark

  • Hi Mark

    I am working on a voice recording and play back application.

    May be I am messing up the registers

    So would you please recommend the registers to set during recording and playback. I have put the registers I can think of.

    This is on top of the register setting the USBSTK 5505 code already has

    ********************Recording*****************

    ;AGC Target Left

            AC1 = 86

            AR1 = 0x80

            call i2c_WriteData8

     

            ;AGC Target Right

            AC1 = 94

            AR1 = 0x80

            call i2c_WriteData8

     

             ;AGC Max Left

            AC1 = 88

           AR1 = 0x3F

            call i2c_WriteData8

     

            ;AGC Max Right

            AC1 = 96

            AR1 = 0x3F

            call i2c_WriteData8

     

            ;Volume contol Left **********is this needed

            AC1 = 83

            AR1 = 0x28

            call i2c_WriteData8

     

            ;Volume contol Right**********is this needed

            AC1 = 84

            AR1 = 0x28

            call i2c_WriteData8

     

            ;AGC Noise thre. & Hyste. Left            

            AC1 = 87                                

            ;AR1 = 0x7E      ; -90 dB treshold and 2 dB hysteresis

            AR1 = 0x7C      ; -88 dB treshold and 2 dB hysteresis                             

            call i2c_WriteData8

     

            ;AGC Noise thre. & Hyste. Right         

            AC1 = 95                                 

            AR1 = 0x7C      ; -88 dB treshold and 2 dB hysteresis  

            call i2c_WriteData8

    -Playback

    Only set DAC volume registers

     

    Thanks