Page 1 of 1

PCM5102 DAC Sound Output [Solved]

Posted: Sun Apr 28, 2024 6:38 pm
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).


Re: PCM5102 DAC Sound Output [Solved]

Posted: Mon Apr 29, 2024 6:59 am
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


Re: PCM5102 DAC Sound Output [Solved]

Posted: Tue Apr 30, 2024 5:46 pm
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.


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 8:56 am
by loki666

Maybe @Sorgelig can help?


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 9:34 am
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.


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 11:28 am
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


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 12:35 pm
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).


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 12:48 pm
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.


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 1:37 pm
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.


Re: PCM5102 DAC Sound Output [Solved]

Posted: Wed May 01, 2024 1:50 pm
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.


Re: PCM5102 DAC Sound Output [Solved]

Posted: Thu May 02, 2024 9:49 am
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 4707 times

Re: PCM5102 DAC Sound Output [Solved]

Posted: Sat May 04, 2024 7:40 pm
by sid

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