DEV: [PLUGIN] MPD_OLED for x86 based systems

Technically it should be loads faster than 5FPS on my PC! On my pi I can easily get a smooth 50 FPS. I think it’s down to the software driver. I think the hardware is fine. On the adafruit marketing bumf for the mcp2221 it says “wouldn’t it be cool to drive a tiny OLED display” but I haven’t found anyone who’s done it!

I have a couple of 7 inch HDMI displays but it’s overkill. Most uses cases call for a small cheap screen, that’s why mpd_oled is so popular :smiley:

Agreed! You would think it would be a lot easier on a PC but I’ve found it to be a right in the pain in the arse! :persevere:

Indeed,

The best I’ve been able to find was this posting.
But it’s a single picture load, replacing this with logic to use CAVA etc and a low FPS.

Interesting! He said that only 32 byte packets can be sent and they have a 2ms delay. So for a screen 128x64 screen, that’s 1024 bytes of data in 32 bytes, 32 packets to send, with waits of 2ms delay = 64 ms delay 1000ms/64 = 15.6 FPS. Still nowhere near as fast as my Pi Zero 2. :roll_eyes:

The positive part, I expect that 10FPS would be enough.
The negative, I am not fully convinced to let this go…

Hi @Wheaten

I don’t know which “version” of the driver you were building, but I just had a look at this one

GitHub - gschorcht/i2c-ch341-usb: A Linux kernel driver for ch341 emulating the I2C bus

And got the same error as you. I applied this fix

"make" fails · Issue #6 · gschorcht/i2c-ch341-usb · GitHub

I was then able to build and install the module, and load it with insmod. If the module works out with your adapter I am tempted to get one too (9.99 euros on amazon,es!)

Adrian.

Hi Adrian,

I was able to build the driver, but I needed to install the kernel headers for V5.10.139.I haven’t changed any of the coding.
wget https://github.com/volumio/x86-kernel-headers/blob/master/linux-headers-5.10.139-volumio_5.10.139-volumio-1_amd64.deb

sudo dpkg -i linux-headers-5.10.139-volumio_5.10.139-volumio-1_amd64.deb

ln -s /usr/src/linux-headers-5.10.139-volumio /lib/modules/5.10.139-volumio/build

Seems to does the trick… Getting there:

volumio@volumio-x86-s2:~/i2c-ch341-usb$ make
make -C /lib/modules/5.10.139-volumio/build M=/home/volumio/i2c-ch341-usb  modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.139-volumio'
  CC [M]  /home/volumio/i2c-ch341-usb/i2c-ch341-usb.o
  MODPOST /home/volumio/i2c-ch341-usb/Module.symvers
  CC [M]  /home/volumio/i2c-ch341-usb/i2c-ch341-usb.mod.o
  LD [M]  /home/volumio/i2c-ch341-usb/i2c-ch341-usb.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.10.139-volumio'
volumio@volumio-x86-s2:~/i2c-ch341-usb$ sudo make install
[sudo] password for volumio:

Creating symlink /var/lib/dkms/i2c-ch341-usb/1.0.0/source ->
                 /usr/src/i2c-ch341-usb-1.0.0

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j4 KERNELRELEASE=5.10.139-volumio -C /lib/modules/5.10.139-volumio/build M=/var/lib/dkms/i2c-ch341-usb/1.0.0/build modules...
cleaning build area...

DKMS: build completed.

i2c-ch341-usb.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.10.139-volumio/updates/dkms/

/etc/modprobe.d/dkms.conf: added alias reference for 'i2c-ch341-usb'
depmod...

DKMS: install completed.
volumio@volumio-x86-s2:~/i2c-ch341-usb$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2772:0230
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
volumio@volumio-x86-s2:~/i2c-ch341-usb$ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2772:0230
Bus 003 Device 003: ID 1a86:5512 QinHeng Electronics CH341 in EPP/MEM/I2C mode, EPP/I2C adapter
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
volumio@volumio-x86-s2:~/i2c-ch341-usb$

According: I2C Teil 31: USB-I2C-Modul MCP23017 - Seite 2 von 3 - Raspberry Pi Geek
Below should be the correct response. (It’s a different module, but the same IC.)

volumio@volumiox86-s2:~$ sudo i2cdetect -y 9
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

That’s weird about the i2cdetect ouput. Looking forward to the mpd_oled test!

Not sure if I am going to test any further, sorry.
But maybe later, I will give it another try.

If you now have a device entry in the filesystem like (according to your i2cdetect command) /dev/i2c-9, then you can hopefully run mpd_oled -B 9 -o oled_type_number, and it will work (fingers crossed).

EDIT: install the mpd_oled plugin and disable it, so you have the mpd_oled binary, then run it from the command line.

1 Like

I don’t think that mpd_oled will run on x86 architecture, As it keeps nagging about missing ‘armhf’
I should have entries in the folders below, but on the x86 none are present
Currently testing a full manual install, as given by you on git.

./usr/bin/mpd_oled
./usr/share/doc/mpd_oled
./usr/share/mpd_oled

manual got more prospect, but need some additional research:

volumio@volumiox86-s2:~/mpd_oled$ mpd_oled -B 9 -o 3
bcm2835_init: Unable to open /dev/gpiomem: No such file or directory
mpd_oled: error: could not initialise OLED
volumio@volumiox86-s2:~/mpd_oled$

Ah, ok, I didn’t see the “x86” in your volumio prompt! In which case, yes, you will need to uninstall the plugin and build mpd_oled from source.

Looking at your followup message, although I added code to use the linux I2C device driver it may be that the code relating to I2C still contains some parts that are specific to the Raspberry Pi.

The development version of mpd_oled shouldn’t contain anything specific to the Raspberry Pi, but I haven’t tested its I2C on anything but a Raspberry Pi

GitHub - antiprism/mpd_oled_dev: mpd_oled development version (unstable)
mpd_oled_dev/install_volumio3_source.md at main · antiprism/mpd_oled_dev · GitHub

(add autoconf-archive to the packages to install if building cava, I haven’t updated this yet).

Anyway, your results with the adapter sound promising, so I think I will get one and give it a try! [EDIT: ordered off Amazon, delivery tomorrow!]

Installing the dev branch now. Let’s see how it goes.

Installing the libu8 seems problematic. Unable to locate one for x86. The one in dev is also intended for arm, One i found online, also for Arduino or arm.
Currently the volumio installation is not happy with me. seems I need to reinstall everything.

volumio@volumiox86-s2:~/u8g2/src$ sudo apt-get update
Hit:1 https://deb.nodesource.com/node_14.x buster InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Reading package lists... Done
N: Skipping acquire of configured file 'main/binary-x86/Packages' as repository 'https://deb.nodesource.com/node_14.x buster InRelease' doesn't support architecture 'x86'
N: Skipping acquire of configured file 'main/binary-x86/Packages' as repository 'http://deb.debian.org/debian buster InRelease' doesn't support architecture 'x86'
N: Skipping acquire of configured file 'contrib/binary-x86/Packages' as repository 'http://deb.debian.org/debian buster InRelease' doesn't support architecture 'x86'
N: Skipping acquire of configured file 'non-free/binary-x86/Packages' as repository 'http://deb.debian.org/debian buster InRelease' doesn't support architecture 'x86'
volumio@volumiox86-s2:~/u8g2/src$

I don’t provide any binaries for x86, and the U8g2 library needs to be built. The link I posted for installing from source also includes instructions for building the U8g2 library that mpd_oled links against

The build might take a while…

Was referring to this part (installation only took 6 minutes on a i5 ), after this Volumio reports these errors.
Need to reinstall everything and get a different unit that I can mess up.

git clone https://github.com/antiprism/libu8g2arm.git
cd libu8g2arm
./bootstrap
mkdir build
cd build
CPPFLAGS="-W -Wall -Wno-psabi" ../configure --prefix=/usr/local
make
cd ../..  # leave libu8g2arm/build directory

But!!! @Adrii

mpd_oled -o SSD1306,128X64,I2C

image

1 Like

Ok, I understand. The library has “arm” in the name, but it may not have anything arm-specific in it. I can’t say for sure because I have only used it with I2C on the Pi. The screenshot of mpd_oled running on the desktop was running on x86 and used this library. Anyway, if it turns out that the library doesn’t work with I2C on a PC then it needs to be modified so it does work!

So cool. Well done!

Thanks to you’re support.
So it does work, the clock is updating.

So now I am going to recover my main player (yes which I should not have been using for testing purpose) and do the same on a Dell Wyse 3040.

Ooh very nice! What’s the frame rate like? :partying_face::tada::champagne:

IMG_4242.zip (6.1 MB)
No clue, need to get CAVA running before I will reinstall this device.
At this moment 've started it with
mpd_oled -o SSD1306,128X64,I2C - f 50

Scrolling looks acceptable. Please rename zip to MOV (it’s not a zip archive)