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.

PCM1865: Use with Raspberry Pi

Part Number: PCM1865
Other Parts Discussed in Thread: PCM1862

Hi, 

I want to record multi mic audio with PCM1865 and Raspberry Pi4.I find Codec Driver(pcm186x.c, pcm186x-i2c.c) in Linux KERNEL and make circuit. Next step, what should I do?

Please help me!

  • Kenji-san,

    Adding any of our Linux driver into a system requires:

    • Changes to DTS to map:
      • i2C processor pins to PCM1862 I2C pins
        • For example:
        • i2c0 {
                #address-cells = <1>;
                #size-cells = <0>;
                pcm1865: pcm1865@4a {
                  compatible = "ti,pcm1865";
                  #sound-dai-cells = <0>;
                      reg = <0x4a>;
                      avdd-supply = <&reg_3v3_analog>;
                      dvdd-supply = <&reg_3v3>;
                      iovdd-supply = <&reg_1v8>;
              };
          };
      • audio codec device to the list of devices supported
        • For example:
        • sound {
              compatible = "simple-audio-card";
              simple-audio-card,name = "TI BeagleBone Black";
              /*
               * you might need to add:
               * simple-audio-card,widgets
               * simple-audio-card,routing
               */
           
               simple-audio-card,dai-link@0 {
                  format = "dsp_a";
                  bitclock-master = <&sound0_0_master>;
                  frame-master = <&sound0_0_master>;
                  sound0_0_master: cpu {
                      sound-dai = <&mcasp0>;
                      clocks = <&clk_mcasp0>;
                      dai-tdm-slot-num = <8>;
                      dai-tdm-slot-width = <32>;
                      dai-tdm-slot-tx-mask = <1 1 1 1>;
                      dai-tdm-slot-rx-mask = <1 1 1 1>;
                  };
           
                  codec {
                      sound-dai = <&ti,pcm1865 0>;
                      dai-tdm-slot-num = <8>;
                      dai-tdm-slot-width = <32>;
                      dai-tdm-slot-tx-mask = <1 1 1 1>;
                      dai-tdm-slot-rx-mask = <1 1 1 1>;
                  };
              };
          };
    • Compile the kernel with the added drivers
    • Use a set of commands to configure the device or record
      • amixer
      • arecord

    These changes are highly dependent on your embedded linux, pins available, and functionality you would like to include. Thus, we can only offer general guidelines. The following application notes walk you through setting these parameters and provide more detailed information:

    This page has links to all our linux drivers, documentation, and general commands for debug and test:

    e2e.ti.com/.../2859004

    Best regards,
    Pedro

  • Hi, Mr. Pedro

    Thank you for reply.

     I did the following with reference to your answer.

    1) Wrote "dts" file and convert to "dtbo" file.

    2) Add "dtoverlay=DTSNAME" in /boot/config.txt.

    3) Add "snd_soc_pcm186x" and "snd_soc_pcm186x-i2c" in /etc/modules, executed the "depmod -a" command.

    4) Reboot.

    I ran "arecord -l" but didn't see anything.

    Can you tell me what to do?

    Best regards,

  • Kenji-san,

    The next debugging steps are:

    • Verify the driver is loaded. Check the message log for errors with regards to PCM devices:
      • dmesg | grep pcm
      • Errors here would indicate problems mapping I2C pins to PCM186x. Ensure the proper mapping is used in the DTS
    • If driver is loaded,
      • Verify the I2C communicates with the device:
        • i2cdetect  r 2 => shows devices connected on I2C bus 2
      • Dump register contents:
        • i2cdump -y -f 2 0x4a => show all registers at I2C bus 2 device 0x4a
      • Configure the device for recording using amixer controls:
        • amixer controls => list all controls
        • amixer contents => list all controls and contents
    • Once driver is properly loaded and configured, then issue the appropriate arecord command:
      • arecord -c 2 -f S16_LE -r 48000  --device="hw:0,1"

    Best regards,
    Pedro