DIN MIDI In via UART Not Working

Hi all, I’m making some great progress with my DIY Zynthian build. I was about to finalise an enclosure for it and then decided to add a MIDI DIN input (and THRU port) to it. Up until now I have been using a USB to MIDI DIN adapter but I already have a 6N138 opto coupler and other required components and so I am breadboarding this instead.

I have the MIDI Out from a Keystep connected to the circuit and then to Pin 10 of the Rasp Pi 4 (Rx) but I don’t seem to be receiving anything. Are there any configuration changes required to enable the serial Midi interface?

Hi,
check in file /boot/firmware/config.txt if midi-uart is enabled.
The needed directives are:

# Enable UART for MIDI
enable_uart=1
[pi5]
# Enable tty0 on RPi5
dtoverlay=uart0-pi5
[pi4]
# Swap back the ttyAMA0 to GPIO
dtoverlay=miniuart-bt
[pi3]
# Swap back the ttyAMA0 to GPIO
dtoverlay=miniuart-bt
[all]
# Adjust UART clock for MIDI Baudrate (31250)
dtoverlay=midi-uart0

1 Like

Thank you for the idea, unfortunately those values are already present and match your values above.

Ok, except triple checking your Midi circuit wiring, I can’t give you further advice.

DIN-5 MIDI is physically implemented using the UART pins on the RPi header and external components to handle the MIDI spec 20mA current loop. The software integration is provided by modttymidi which runs as a service and should always be running. If you can see DIN-5 MIDI as an input/output in zynthian then the post is detected and the problem is most likely hardware interfacing, i.e. your custom circuit.

1 Like

Thanks very much to both of you for confirming. From what I’ve read, I think it’s most likely that the 6N138 I am using doesn’t work well with at 3.3V. I could try powering the chip at 5V and keeping the data at 3.3V like I’ve seen mentioned elsewhere, but I think it’s perhaps a better idea to source some H11L1 chips instead. I found the Zynthian schematic for this on GitHub.

Many thanks again.

1 Like

Is the “post” just a typo and you actually meant “port” or is there some meaning to post in this context?

I’ve read elswhere too that 1N638 optocoupler may cause troubles.
Following the Zynthian midi schematic is for sure the best way To go for an hassle free expérience.
Good tinkering :sweat_smile:

1 Like

The H11L1 chips are out of stock (the ones I could source for a reasonable price with shipping) but they’re on back order and should come by the end of the month. But I’m fairly confident that I can add this to my design now and so will complete the box with 2 or 3 DIN ports.

Yes, the 6N138 optocoupler is flaky at 3.3V. Some work, some don’t and it’s random which any one will do.

1 Like

My H11L1 chips have arrived and having some success with this now :slight_smile:

2 Likes