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.

PCM3060: PCM3060 codec for a laser absorbtion spectrometer

Part Number: PCM3060

Hello,

I’m working on a laser absorbtion spectrometer.
I did a HAT with a pcm3060 to generate a current ramp for driving the laser with its dac.
The detectors voltage I plan to evaluate with the adc.
I sort of „abuse“ this codec for my task, but it fits all my requirements and is very cheap.

The actual linux kernel supports pcm3060 so I only had to include kernel module for rpi.

The pcm3060 has adc and dac on one chip.
I connected bclk and lrclk for i2s together and want to use pcm3060 ability to generate the clock from a master clock which comes from an oscillator on the HAT (see attached schematic).
The adc can be configured over i2c to be bitclk master and the dac to be slave.
Raspberry pi should be clk slave too (i2s consumer).

At the moment I struggle with the overlay where I use the simple-sound-card.
I already got it work that I can play a sine.
But playing and recording are not working with my actual overlay (see below).
I can't see the i2c command that sets the pcm3060 adc in bclk master mode.
With this overlay raspberry pi seems to be i2s master.
What could be the issue here?

I would be very thankful for help!


I would be very thankful for help!

// Definitions for pcm3060 audio card

/dts-v1/;

/plugin/;

/ {
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&i2s_clk_consumer>;
        __overlay__ {
            status = "okay";
        };
    };

    fragment@1 {
        target = <&i2c1>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";

            pcm3060: pcm3060@46 {
                #sound-dai-cells = <1>;
                compatible = "ti,pcm3060";
                reg = <0x46>;
                ti,out-single-ended = "false";
            };
        };
    };

    fragment@2 {
        target = <&sound>;
        slave_overlay: __overlay__ {
            compatible = "simple-audio-card";
            simple-audio-card,name = "pcm3060-soundcard";
            status = "okay";

            simple-audio-card,dai-link@0 {
                    format = "i2s";


                    cpu {
                            sound-dai = <&i2s_clk_consumer>;
                            dai-tdm-slot-num = <2>;
                            dai-tdm-slot-width = <32>;
                    };

                    pcm3060_dac: codec {
                            sound-dai = <&pcm3060 0>;
                            system-clock-frequency = <24576000>;
                    };
            };



            simple-audio-card,dai-link@2 {
                    format = "i2s";

                    bitclock-master = <&pcm3060_adc>;
                    frame-master = <&pcm3060_adc>;

                    cpu {
                            sound-dai = <&i2s_clk_consumer>;
                            dai-tdm-slot-num = <2>;
                            dai-tdm-slot-width = <32>;
                    };

                    pcm3060_adc: codec {
                            sound-dai = <&pcm3060 1>;
                            system-clock-frequency = <24576000>;
                    };
            };

        };
    };

    __overrides__ {
        alsaname = <&slave_overlay>,"simple-audio-card,name";
        compatible = <&pcm3060>,"compatible";
    };
};

 

  • Hi,

    Let me get our Linux expert to comment on your questions. It seems like you want the ADC to be master, but DAC to be slave, but you tied both clocks together, so this forfeits the use case. The best way to see the I2C transaction is to probe the lines and read back if they are indeed set to master mode.

    Regards.

  • Can you see the sound card register into your system? in the bootup log, have you seen some error during soundcard register? I'm not sure that simple audio card architecture can't support your requirement well, which master clock can be selected at will. Simple audio card seems to support only one bitclock-master and frame-master.

  • Ok,
    thank you for the quick response.
    I experimented a lot with simple sound card. 
    I could not see any error in the boot log.
    I checked I2C signals with logic analyzer and the problem is, when I start playing the pcm3060 is initialized correctly and when I start recording its configuration is overwritten.
    Maybe you are right and simple audio card is not able to configure pcm3060 which includes adc and dac and furthermore handle the bitclock requirement I have.
    Do you have any other approach how I can make it work? My requirement is that both adc and dac will be driven synchronously!

  • Maybe change both ADC and DAC to be in slave mode and see it works with your soundcard.