vitalic
Posts: 32
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Wed Apr 24, 2019 10:14 am

Some more progress with the new dts:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

    [email protected] {
        target = <&sound>;
        __overlay__ {
            compatible = "simple-audio-card";
            simple-audio-card,name = "Dual";

            status="okay";

            capture_link: simple-audio-card,[email protected] {
                format = "i2s";

                r_cpu_dai: cpu {
                    sound-dai = <&i2s>;

                };

                r_codec_dai: codec {
                    sound-dai = <&codec_in>;
                };
            };

            playback_link: simple-audio-card,[email protected] {
                format = "i2s";

                p_cpu_dai: cpu {
                    sound-dai = <&i2s>;

                };

                p_codec_dai: codec {
                    sound-dai = <&codec_out>;
                };
            };
        };
    };

    [email protected] {
        target-path = "/";
        __overlay__ {
            codec_out: hifiberry {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "ti,pcm5102a";
                status = "okay";
            };
            codec_in: dabboard {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "ti,si468x";
                status = "okay";
            };
        };
    };

    [email protected] {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };
};
This ends up in:

Code: Select all


[email protected]:~ $ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: Dual [Dual], Gerät 0: bcm2835-i2s-pcm5102a-hifi pcm5102a-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
[email protected]:~ $ arecord -l
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 0: Dual [Dual], Gerät 1: bcm2835-i2s-si468x-hifi dabboard-1 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

Code: Select all

[email protected]:~ $ dmesg | grep i2s
[    3.716226] asoc-simple-card soc:sound: pcm5102a-hifi <-> 3f203000.i2s mapping ok
[    3.724329] asoc-simple-card soc:sound: dabboard <-> 3f203000.i2s mapping ok
[  165.620117] ASoC: dabboard <-> 3f203000.i2s No matching formats
[  187.235522] ASoC: dabboard <-> 3f203000.i2s No matching formats
[  352.159010] ASoC: dabboard <-> 3f203000.i2s No matching formats
So both cards are now registered. Playing sound over Hifiberry is possible :)

Now i need to find the right command, to record the stream from capture device and play it on the hifiberry. But this fails.

Code: Select all

arecord -D "plughw:0,1" -c 2 -r 48000 -f S16_LE -q | aplay -D "plughw:0,0" -c 2 -q &
The reason why i need to do this, the dabboard ist streaming sound to i2s.

vitalic
Posts: 32
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Wed Apr 24, 2019 3:33 pm

So after several tries i have to say that it does not work.

Both cards can exist at the same time like i have shown before. Both are connected to the I2S bus. The problem i face now, is recording from the DABboard.

I also tried just activating the DABboard alone and the build in BCM soundcard. HW 1 ist DABboard, HW:0 is onboard soundcard.

Code: Select all

[email protected]:~ $ arecord -D hw:1 -c 2 -r 48000 -f S16_LE -q | aplay -D hw:0 -c 2 -
arecord: main:788: Fehler beim Öffnen des Gerätes: Datei oder Verzeichnis nicht gefunden
aplay: playback:2787: Lesefehler
When i use the suggested audiosense-pi overlay instead of rpi-dabpi overlay, i can record from dabboard.

The question for me is, needs the codec you have changed for me to be written as playback instead of capture device? Or might this be a problem of the missing rest like, like gpio and i2c definitions.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2148
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Merge 2 DTS

Wed Apr 24, 2019 3:39 pm

Do you get one of these errors for each attempt?

Code: Select all

[  352.159010] ASoC: dabboard <-> 3f203000.i2s No matching formats
I suspect this is the problem.

vitalic
Posts: 32
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Wed Apr 24, 2019 4:08 pm

yeah that's true. getting this error in DMESG.

As soon as i enter the command to record i can read this error in dmesg.

Don't you think it's a problem with th codec it self? when i take a look at the audiosense-pi dts and driver, there are much more entries.

Also with your driver, the device is set to be capture device. doesn't it have to be a playback device when i want to record from it?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2148
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Merge 2 DTS

Wed Apr 24, 2019 4:17 pm

Also with your driver, the device is set to be capture device. doesn't it have to be a playback device when i want to record from it?
It's not my driver - I just hacked it for you until it compiled. The si4689 datasheet only mentions I2S playback, so it is strange that the driver describes it as a capture device. Why don't you email the author and see what he has to say?

vitalic
Posts: 32
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Wed Apr 24, 2019 4:25 pm

already tried to mail him, but he never responded to my question whether hifiberry and dabboard can cowork on I2S.

tried again with the merged overlay where hifiberry and dabboard are listed together on one card. the error in DMESG doesn't appear this way but still the same error when doing the record command. (readerror)

chris2019
Posts: 2
Joined: Wed Feb 06, 2019 5:43 pm

Re: Merge 2 DTS

Fri Apr 26, 2019 6:55 am

As the designer of the DABBoard https://ugreen.eu/product/ugreen-dab-board, I will try to help here:

*disclaimer*
I did not read and I probably would not understand all that was written here

I have the Hifiberry AMP2 working together with a DABBoard, where the I2S is routed directly from the DABBoard to the Hifiberry AMP2. To get this working, I solder-connected PIN 38 and PIN 40 (DOUT and DIN) of the Raspberry. Then I made the DABBoard produce I2S only output, not using the Hifiberry modules at all.

This will not work yet. Additionally to this, you have to program the Hifiberry DAC IC to use the right settings to understand the I2S from the Si468x.
I used the following commands:

Code: Select all

sudo i2cset -y 1 0x4d 2 0x10
sudo i2cset -y 1 0x4d 1 0x11
sudo i2cset -y 1 0x4d 40 0x00
sudo i2cset -y 1 0x4d 13 0x10
sudo i2cset -y 1 0x4d 37 0x08
sudo i2cset -y 1 0x4d 61 0x82
sudo i2cset -y 1 0x4d 62 0x82
sudo i2cset -y 1 0x4d 2 0x00
Then I started the radio_cli software:

Code: Select all

sudo ./radio_cli -b D -o 1 -f 33 -c 16 -e 17137 -p -l 60
I will write up some better instructions soon.

The procedure to combine the Hifiberry and the Audiosense modules will probably not work, because I think the Hifiberry modules will programm the Hifiberry DAC with some settings which are incompatible with the Si468x. Furthermore, the audiosense module expects that there is a ICS master on the ICS input, and radio_cli will program the Si468x to be I2S master. The hifiberry modules want the Raspberry Pi to be the I2S master though - so this is another problem (which can eventually be solved, though, because the Si468x can also be I2S slave or the hifiberry modules can be programmed to initialize the I2S as slave only)

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2148
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Merge 2 DTS

Fri Apr 26, 2019 7:54 am

Thank you, Chris. I hope that once we've figured out the best way to get this working we can support the DABBoard under Raspbian out of the box.

vitalic
Posts: 32
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Fri May 10, 2019 5:39 pm

Some update here.

I tried again with the 'stealth' mode. Like HiassofT wrote it is not necessary to load the hifiberry-dac overlay.

So right now i just load the audiosense-pi overlay.

What i found out, I have to start the radio_cli software. It loads the firmware to the ti ic. If I boot the SI468x with the argument D (load DAB Firmaware) and after that i run -u to scan for possible stations I can play everything i want, with hifiberry as output.

No need to arecord | aplay.

If i boot the SI468x with argument F (FM) I can only listen to FM radio, but therefor i have to start arecord and aplay.

I know it is possible to load the firmware for that chip on a separate ic, the problem is, you don't get this firmware.

Return to “Device Tree”