PCM5102 DAC Sound Output [Solved]

For topics which do not fit in other specific forums.
Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

I did not want to reopen the old thread, so I created this new one.

Some time ago I tried to use a PCM5102 DAC connected as shown in this old thread: viewtopic.php?t=589.

Code: Select all

-GPIO1 PIN 2: BCK
-GPIO1 PIN 7: DIN
-GPIO1 PIN 8: LCK
-VIN: can be 3.3v or 5v, it does not matter.
-GND: any GND available
-The big switch near the ethernet port is ON

It didn't work for me back then, so i recently tried again and now it works :? .

The problem is, it does not work with some cores, like Megadrive, snes, PSX, ao486. But it works on others (the older genesis core has no problem).

Maybe this is not compatible with some new addon (used pins for IO boards or something?) and it only works on older cores... Or am I missing something else?.

I am using MiSTer_BGM to play music on main menu, and it looks like nothing is sent to the DAC through those pins... If I load a core I can hear the MiSTer_BGM music (only for a few seconds, before MiSTer_BGM stops and the core starts to output sound).

loki666
Posts: 8
Joined: Mon Oct 30, 2023 3:54 pm
Been thanked: 1 time

Re: PCM5102 DAC Sound Output [Solved]

Unread post by loki666 »

Could you detail what was the issue with the old config?

Also, any idea how to wire this without using the GPIO1 (like the Digital I/O board)

Thanks

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

I created a new SD with the SD installer, it worked. Then I run update, and the new main/menu/linux broke the sound again. I guess there really was a change in the way the io boards get the sound, so I'll try to find it.

I don't know if there are other ways to connect the board.

loki666
Posts: 8
Joined: Mon Oct 30, 2023 3:54 pm
Been thanked: 1 time

Re: PCM5102 DAC Sound Output [Solved]

Unread post by loki666 »

Maybe @Sorgelig can help?

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

loki666 wrote: Wed May 01, 2024 8:56 am

Maybe @Sorgelig can help?

I just created an issue on github, I hope somebody can help.

User avatar
sid
Posts: 33
Joined: Mon May 25, 2020 5:00 pm
Has thanked: 15 times
Been thanked: 10 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by sid »

Im getting the same issue. Im still using the pi top case and a dont get i2s sound anymore out of the pins. For some reasons the gameboy core for example works for me but the NES core dont. The issue occures since one the last recent updates

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

sid wrote: Wed May 01, 2024 11:28 am

Im getting the same issue. Im still using the pi top case and a dont get i2s sound anymore out of the pins. For some reasons the gameboy core for example works for me but the NES core dont. The issue occures since one the last recent updates

Most cores work for me, but NES, SNES, the new MegaDrive one, SMS, ao486, Minimig and PSX do not work (the ones I use more).

User avatar
pgimeno
Top Contributor
Posts: 709
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by pgimeno »

Looks like these are the ones whose framework was recently updated. viewtopic.php?p=85298#p85298

So it's likely to be a problem with the framework (which I believe is maintained in the Template_MiSTer repo).

Edit: Oops, in the issue you mention that replacing Main and menu.rbf makes the issue go away, so that's not probably it.

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

pgimeno wrote: Wed May 01, 2024 12:48 pm

Looks like these are the ones whose framework was recently updated. viewtopic.php?p=85298#p85298

So it's likely to be a problem with the framework (which I believe is maintained in the Template_MiSTer repo).

Edit: Oops, in the issue you mention that replacing Main and menu.rbf makes the issue go away, so that's not probably it.

Maybe it is still related to the framework, it looks like some variable (maybe linux related?) is shared by the cores and the main mister, and it is setting the volume off for the i2s pins. I don't know how the io boards work, I looked at the last analog board and the schematics look the same as my setup and use the same GPIO1 pins.

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

Comparing sys_top.v from a working core (Gameboy) and the Template_MiSTer or a non working core (MegaDrive):

Game Boy:

Code: Select all

	assign AUDIO_SPDIF = SW[3] ? 1'bZ : SW[0] ? HDMI_LRCLK : spdif;
	assign AUDIO_R     = SW[3] ? 1'bZ : SW[0] ? HDMI_I2S   : analog_r;
	assign AUDIO_L     = SW[3] ? 1'bZ : SW[0] ? HDMI_SCLK  : analog_l;

Template_MiSTer or MegaDrive (and I guess all non working cores):

Code: Select all

	assign AUDIO_SPDIF = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_LRCLK : spdif;
	assign AUDIO_R     = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_I2S   : analog_r;
	assign AUDIO_L     = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_SCLK  : analog_l;

Now.. what's av_dis?

I edited the megadrive core to include the same code as the gameboy, and it outputs the sound fine.

Mills
Posts: 90
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 32 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by Mills »

Sorgelig answered me on github, he says we have to ground "VGA_EN" pin (GPIO_1 10) for the analog output to work.

photo_2020-11-17_16-32-22.jpg
photo_2020-11-17_16-32-22.jpg (66.2 KiB) Viewed 4702 times
User avatar
sid
Posts: 33
Joined: Mon May 25, 2020 5:00 pm
Has thanked: 15 times
Been thanked: 10 times

Re: PCM5102 DAC Sound Output [Solved]

Unread post by sid »

Perfect! ive simply soldered the pin 10 to the 12. Now it works for me. 8-) thx

Post Reply