SHUNXIN CODEC DEBUGGING PROCESS

  1. Confirm whether the I2C configuration in dts is correct

    For details, see the configuration of i2c-padmux in the i2c node, which should correspond to the hardware design.

  2. Confirm whether the i2c pin is switched correctly in padmux dts

    Check whether the pin that needs to be switched to i2c in padmux dtsi is filled in, and make sure that the mode and multiplexing functions are filled in correctly, which should correspond to the hardware design.

  3. Confirm whether i2c works normally through i2c-tools

    Confirmed by reading the chip id of the Shunxin codec through i2cget in i2c-tools.

    • 7243:

      The i2c address of 7243 is related to the wiring, confirm with the hardware engineer.

      因codec均挂载i2c1上,故i2cget -y -f 1 i2cAddr(7位) 0x0E,得到0x40,即说明与7243通信正常。

    • 8156:

      The i2c address of 8156 is related to the wiring, confirm with the hardware engineer.

      Repeat the operation of 7243, read out chip id, it proves that the main chip communicates with the codec i2c normally when matched successfully.

  4. Confirm whether the I2S setting in dts is normal

    Modify the i2s-padmux of the sound node in the dts to match the schematic, which can be confirmed with the hardware engineer. If the Sound node is not defined in dts, go and find in infinity2m.dtsi.

  5. Remove I2S pin related information in padmux

    The Shunxin codec will switch to the hardware mode as long as it receives the I2S clock first. In order to avoid the I2S signal at boot, remember not to fill in the definition of the I2S pin in padmux, and other multiplexing functions should also be removed from padmux.

  6. Add insmod when Insmod mhal.ko

    Add IS_MHAL_SUPPORT_ES_CODEC=1 when insmod mhal.ko to change mhal, no I2S signal when booting to adapt codec.

  7. Run the demo to confirm whether the two codecs are working properly

    The demo source code path is sdk/verify/mi_demo/geonosis/codec. Modify the i2c address (7 bits) in the header file according to the hardware design.

    • Test 8156:

      prog_codec –D 1 –O –i xxx.wav –V 0
      

      Note: Because the main chip cannot provide mclk, the sampling rate of xxx.wav must be greater than or equal to 16K.

      • Troubleshoot:

        1. cat/proc/mi_modules/mi_ao/mi_ao1, check whether data is being sent(whether TotalFrmCnt is increasing)

        2. Try to increase the -V parameter and the volume(-60 ~ 30).

        3. Measure the I2S waveform of the main chip with an oscilloscope and confirm BCLK.(bit clk, Clock frequency: 2 (channel number) ; * 16 (bit width); * Sampling Rate); WCLK(Left and right channel switching clock, the clock frequency is the sampling rate); Whether SDO has a waveform(or data change), if not, confirm whether I2S is configured correctly.

        4. Test the above waveform on the codec to confirm whether the I2S signal is received

        5. Measure the VRef voltage of the codec, through which can directly see whether the codec is working properly.

    • Test 7243:

      prog_codec –t 30 –I –o /tmp –d 2 –m 0 –c 2 –s 48000(To use with mic that is not attached to the codec, -d 4 -c 4 is needed)

      The command will generate two audio files under /tmp.

      • Troubleshoot:

        1. cat /proc/mi_modules/mi_ai/mi_ai, check whether data is being sent(whether ReadFrmCnt is increasing)

        2. Measure the I2S waveform of the main chip with an oscilloscope and confirm BCLK.(bit传输时钟 Clock frequency: 2 (channel number) ; * 16 (bit width); * Sampling Rate); WCLK(Left and right channel switching clock, the clock frequency is the sampling rate); Whether SDO has a waveform(or data change), if not, confirm whether I2S is configured correctly.

        3. Test the above waveform on the codec to confirm whether the I2S signal is received

        4. Measure the VRef voltage of the codec, through which can directly see whether the codec is working properly.

        Note: When measuring I2S signal, pay more attention to whether SDI/SDO has data.

    Note:

    Because of the Shunxin codec, it is recommended to initialize the Shunxin codec through I2C before initializing MI_AI/MI_AO.