@riban solution combines standard DIN and USB midi. I also like that it is configurable via the web and using sysex. too bad the boards are no longer available on https://www.tindie.com/stores/thekikgenlabs/ , I would try to build one.
More simply and only over USB is this:
It uses an optocoupler in the signal path as in the case of a classic DIN connector.
The easiest connection between PC and Zynthian, that is if I don’t use rpt-midi.
I was lazy and just hardwired the RX and TX pins between two small RPi2040 boards. That’s why I might have a stability problem.
Since I really spent a lot of time figuring out how to connect various devices with a midi signal, look at how far one can go. Zynthian from scratch made by ToFFmashines - #43 by ToFF