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.

AIC3254



Dear Sirs

About AIC3254 register setting issue.

I use Interrupt and Headset detection function.

The register map setting is shown as follow:

P0R48 = 0x80=>INT1 Interrupt for Headset Insertion Event:1: Headset Insertion even will generate an INT1 interrupt

P0R55 = 0x08=>0100: MISO is INT1 output

P0R56 = 0x02=>01: SCLK pin is enabled for SPI clock in SPI Interface mode or when in I2C Interface enabled for Secondary Data Input or Secondary Bit Clock Input or Secondary Word Clock or Secondary ADC Word Clock or Digital Microphone Input

P0R67 = 0x80=>1: Headset Detection Enabled

 

1.When I read the P0R44, then read P0R67=> Headset detection will be disable. And Headset Type Flag state is wrong.

Why the Headset detection will be disable?

If I do not read P0R44,only read P0R67=>Headset detection will still be Enable. And Headset Type Flag state is right.

 

2.AI3254 pin11 work ok (INT1 output),plug in&out =>Interrupt output still work. Plug in and I read P0R44=>D5 = 1(1: Button Press detected),That should be D4= 1?

D5: Headset Button Press 0: Button Press not detected 1: Button Press detected (will be cleared when the register is read)

D4: Headset Insertion/Removal Detect Flag 0: Insertion/Removal event not detected 1: Insertion/Removal event detected (will be cleared when the register is read)

Please help me, thanks~

BRs

Nat

  • Hi Nat,

    Below is the script I use to test this. It seems to function properly. Make sure that the read buffer in you MCU is properly storing the proper register. If unsure, use an I2C analyzer to verify.

    A button press condition occurs if a mic is detected (e.g. 1kohm to GND) and MICDET is set to GND momentarily. If inserting a stereo headset, you can ignore button presses. However, P0_R67 should return either 0x80 (no headset) or 0xA0 (stereo headset).

    ###############################################
    # Headset Detection
    # ---------------------------------------------
    ###############################################
    
    
    
    ###############################################
    # Software Reset
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Initialize the device through software reset
    w 30 01 01
    #
    ###############################################
    
    
    
    ###############################################
    # Clock Settings
    # ---------------------------------------------
    # The codec receives: MCLK = 11.2896 MHz,
    # BLCK = 2.8224 MHz, WCLK = 44.1 kHz
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # NDAC = 1, MDAC = 2
    w 30 0b 81 82
    #
    # NADC = 1, MADC = 2
    w 30 12 81 82
    #
    ###############################################
    
    
    
    ###############################################
    # Signal Processing Settings
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Set the DAC Mode to PRB_P1
    w 30 3c 01
    #
    # Set the ADC Mode to PRB_P1
    w 30 3d 01
    #
    ###############################################
    
    
    
    ###############################################
    # Initialize Codec
    ###############################################
    #
    # 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 powerup time to 3.1ms (for ADC)
    w 30 47 32
    #
    # Set the REF charging time to 40ms
    w 30 7b 01
    #
    ###############################################
    
    
    
    ###############################################
    # Recording Setup
    ###############################################
    #
    # Select Page 1
    w 30 00 01
    #
    # Powerup MIC BIAS at 2.5V
    w 30 33 60
    #
    # Route IN3L to LEFT_P with 10K input impedance
    w 30 34 04
    #
    # Route Common Mode to LEFT_M with impedance of 10K
    w 30 36 40
    #
    # Unmute Left MICPGA
    w 30 3b 00
    #
    # Select Page 0
    w 30 00 00
    #
    # Power up LADC
    w 30 51 80
    #
    # Unmute LADC
    w 30 52 08
    #
    ###############################################
    
    
    
    ###############################################
    # 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
    #
    # Power up HPL/HPR drivers
    w 30 09 30
    #
    # Unmute HPL/HPR driver, 0dB Gain
    w 30 10 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
    #
    ###############################################
    
    
    
    ###############################################
    # Headset Detection
    ###############################################
    #
    # Select Page 0
    w 30 00 00
    #
    # Enable Headset Detection
    w 30 43 80
    #
    ###############################################
    
    d 1000
    
    # Configure Interrupts
    w 30 00 00 # Page 0
    w 30 30 80 # INT1 = Headset Insertion
    w 30 37 08 # MISO = INT1 output
    
    # Read status
    w 30 00 00 # Page 0
    r 30 2c 01 # Should be 0x10 or 0x30
    r 30 43 01 # Should be 0x80 or 0xA0 or 0xE0

    Regards,

    J-

  • Dear Sirs

    About P0R56, what value do I need to set?

    5.2.53 Page 0 / Register 56: SCLK/MFP3 Function Control Register - 0x00 / 0x38 (P0_R56)

    D7-D3 R 0 0000 Reserved. Write only default values
    D2-D1 R/W 01 SCLK function control
    00: SCLK pin is disabled
    01: SCLK pin is enabled for SPI clock in SPI Interface mode or when in I2C Interface enabled for
    Secondary Data Input or Secondary Bit Clock Input or Secondary Word Clock or Secondary ADC
    Word Clock or Digital Microphone Input
    10: SCLK is enabled as General Purpose Input
    11: Reserved. Do not use
    D0 R X Value of SCLK input pin when used as General Purpose Input

    BRS
    Nat
  • Nat,

    Default is fine.

    Regards,
    J-
  • Dear Sirs
    Thank you very much~
    BRS
    Nat