Moode Forum
[How to do instruction] 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9)
+--- Thread: [How to do instruction] 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi (/showthread.php?tid=155)



RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - The Herb Guy - 03-11-2020

Hello,
because I want to add a volume control rotary encoder I had to disassemble my setup.
So I thought why not test if the display will work correctly without the Hifiberry DAC. Therefore I reconfigure moOde to use the internal soundcard and connect the display to the I2C bus.
Everything works as expected! Start, Stop, Pause, Change source all is working fine.
So it's 100% sure that the Hifiberry DAC+ Pro and the display on the same I2C bus seems to be the Problem.

What I will try next (after reassemble the stuff) is the idea with the additional I2C bus. Even when the current library will not support it, I can test if the display works in general.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 03-11-2020

I think I have identified the cause of the issue.

It seems that the library I use for I2C with mpd_oled (https://www.airspayce.com/mikem/bcm2835/) is not compatible with the I2C interface provided by the kernel (which is presumably used by the DAC driver)

  https://www.raspberrypi.org/forums/viewtopic.php?t=262589

I updated the BCM2835 library to the latest vesion recently to provide support for the RPi4, but looking at the diff now I can see that where there used to be calls to open /dev/i2c-1 etc, these are now gone. It may be that I had a modified version of the library that used the kernel interface for I2C, in which case I may be able to add this back in. I will take a look.

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - The Herb Guy - 03-11-2020

(03-11-2020, 09:06 AM)adrii Wrote: I think I have identified the cause of the issue.

It seems that the library I use for I2C with mpd_oled (https://www.airspayce.com/mikem/bcm2835/) is not compatible with the I2C interface provided by the kernel (which is presumably used by the DAC driver)

  https://www.raspberrypi.org/forums/viewtopic.php?t=262589

I updated the BCM2835 library to the latest vesion recently to provide support for the RPi4, but looking at the diff now I can see that where there used to be calls to open /dev/i2c-1 etc, these are now gone. It may be that I had a modified version of the library that used the kernel interface for I2C, in which case I may be able to add this back in. I will take a look.

Adrian.

Nice found. Looking forward to your results.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 03-11-2020

Hi The Herb Guy

If you would like to test the changes (uses /dev/i2c-1 for now, so cannot use a Pi 1, I will make the bus number an option after testing)

Disable the mpd_oled service and restart the machine
Code:
sudo systemctl disable mpd_oled
sudo reboot

Log back in and grab the test branch and build it
Code:
git clone https://github.com/antiprism/mpd_oled.git mpd_oled_test
cd mpd_oled_test
git fetch
git checkout old_i2c
PLAYER=MOODE make

Then try a test command, e.g. if you have an SH1106
Code:
sudo ./mpd_oled -o 6 -b 21 -g 1 -f 15

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - The Herb Guy - 03-11-2020

(03-11-2020, 11:27 AM)adrii Wrote: Hi The Herb Guy

If you would like to test the changes (uses /dev/i2c-1 for now, so cannot use a Pi 1, I will make the bus number an option after testing)

Disable the mpd_oled service and restart the machine
Code:
sudo systemctl disable mpd_oled
sudo reboot

Log back in and grab the test branch and build it
Code:
git clone https://github.com/antiprism/mpd_oled.git mpd_oled_test
cd mpd_oled_test
git fetch
git checkout old_i2c
PLAYER=MOODE make

Then try a test command, e.g. if you have an SH1106
Code:
sudo ./mpd_oled -o 6 -b 21 -g 1 -f 15

Adrian.

Hi Adrii,
the old i2c works perfect!
Now everything is like it should be. :-)
The current also seems to have problems with additional rotary encoder and GPIO buttons. 
This is all no problem with the old i2c.

This solves the problem.
TOPP
Thanks

The Herb Guy  Smile


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 03-11-2020

Hi The Herb Guy and edash

Thanks for testing the changes!

As this seems to have fixed the issue, I have updated the mpd_oled repository, and also added a -B option to select the I2C bus number (default: 1).

Adrian.


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - The Herb Guy - 03-11-2020

Topp!
I will update again to the latest version in the repository now.

The Herb Guy


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - DRONE7 - 03-11-2020

Excellent fix Adrian ! Thanks Smile


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - JohnnyBravo - 03-26-2020

Hi Adrian,

I am running mpd_oled using the ALSA method on Moode 6.4.2
Recently certain albums no longer play and I get the following error from Moode
Code:
Failed to open "ALSA default" (alsa); Error opening ALSA device "hw:1,0"; snd_pcm_hw_params() failed: Invalid argument


MPD log shows
Code:
Mar 26 15:59 : exception: Failed to open "ALSA default" (alsa)
Mar 26 15:59 : exception: nested: Error opening ALSA device "hw:1,0"
Mar 26 15:59 : exception: snd_pcm_hw_params() failed: Invalid argument
Mar 26 15:59 : player: problems opening audio device while playing "NAS/nas-1/Douwe Eisenga/For Mattia/01_For-Mattia_TRPTK_TTK0037_2ch64.dsf"

I am using a USB DAC and the output of "aplay -l" is
Code:
root@moode:/etc# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
 Subdevices: 7/7
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: e20 [exD USB Audio 2.0], device 0: USB Audio [USB Audio]
 Subdevices: 0/1
 Subdevice #0: subdevice #0
card 2: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
 Subdevices: 8/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7
card 2: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
 Subdevices: 8/8
 Subdevice #0: subdevice #0
 Subdevice #1: subdevice #1
 Subdevice #2: subdevice #2
 Subdevice #3: subdevice #3
 Subdevice #4: subdevice #4
 Subdevice #5: subdevice #5
 Subdevice #6: subdevice #6
 Subdevice #7: subdevice #7

It seems that "hw:1,0" should be correct as that's listed as my USB DAC.
The weird thing is that some albums play fine and others don't.
The Spotify renderer also works fine...

I can't figure out what it is, do you have any thoughts?

Thanks,
JB


RE: 128x64 OLED with Song Status and Spectrum Display on Raspberry Pi - adrii - 03-26-2020

Hi JB

If it only affects some files, could it be the same issue as this?

   https://github.com/MusicPlayerDaemon/MPD/issues/395

You could check if it is an issue with the ALSA configuration file by moving/deleting the configuration file and restarting mpd (or restart the machine to be sure) and seeing if the issue remains.

Adrian.