While upgrading my V4 with an RPi5 (Zynthian 4 upgraded with Raspberry pi 5! - #22 by ricard) I read various worrying comments such as this one MIDI issues with RPi5 and Pisound card - #2 by HansDampf about DIN MIDI not working on the RPi5. So far I’ve only been using my RPi5 based Zynthian with my master keyboard with USB, but today I tried DIN MIDI with my sequencer, and there was utter silence. No MIDI indicator in the Zynthian display, and no MIDI events coming through. The MIDI IN led on the back was flashing nicely though so it wasn’t a cabling issue.
A bit of research brought me to this:
https://forums.raspberrypi.com/viewtopic.php?t=385906, including a link to a patch for the most recent 6.12 kernel, which updates the midi-uart0-pi5.dtb file (and the corresponding files for the other potential UARTs). Now, Zynthian uses the allegedly more stable 6.6 LTS kernel, and since I have already compiled a custom kernel (with a patch in order to use with another one of my master keyboard, the CME UF6), I took the patch (overlay: Rework/fix the Pi 5 MIDI UART overlays · raspberrypi/linux@149c85c · GitHub) and applied it, rebulit the .dtb files, and copied the relevant .dtb files to the SD card (to /bootfs/overlays (or /boot/overlays when mounted in Zynthian)). Hey presto, DIN MIDI is now working! So this was definitely the solution.
Indeed, @HansDampf also noted the aforementioned thread (although the link in his post is completely different for some reason), and has also tried a different kernel, albeit 6.12.25, which solved his problems (Stuck/Hanging Notes - #19 by HansDampf). The thread mentions it working with some 6.12 versions and not with others.
Now, I don’t know if this is a problem with the original kernel included with the latest oram image (and I don’t have a spare SD card to experiment with at the moment); it would seem strange if there’s a DIN MIDI problem with the RPi5 Zynthian V5.1 as there must be quite a few RPi5 Zynthian users by now, but I don’t think Zynthian uses a custom kernel, does it? At any rate, I’ve attached the midi-uart0-pi5.dtbo file from the above patch in case it helps anyone else. It has been compiled together with a 6.6.78 kernel but I think it will work on a variety of kernel versions as it’s not code, just a device tree overlay.
EDIT: Something is amiss here, I just noted that /boot/config.txt does not even contain a reference to midi-uart0-pi5.dtbo, only to midi-uart0.dtbo (which itself seems wrong) so replacing the former can not make a difference. Need to research this some more.
EDIT2: No, it’s definitely midi-uart0-pi5.dtbo that is the culprit. Replacing just this file with the original version causes DIN MIDI to stop working; adding it back brings it back again. I still cannot understand when it gets pulled in though, when looking at the config.txt file. - Looking at /sys/firmware/devicetree/base/clocks
, midiclock_0 specified in the overlay is there, as well as the specified click-div and clock-mult from the devicetree overlay. So it’s definitely been brought in, somehow.
midi-uart0-pi5.dtbo (808 Bytes)