# DIN MIDI In via UART Not Working

**URL:** <https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486>\
**Category:** Hardware\
**Tags:** midi\
**Created:** [November 9, 2024, 6:34pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486 "2024-11-09T18:34:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesPearson](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jamespearson/32/12445_2.png) [@JamesPearson](https://discourse.zynthian.org/u/JamesPearson)\
**Post date:** [November 9, 2024, 6:34pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/1 "2024-11-09T18:34:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [November 10, 2024, 9:27am UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/2 "2024-11-10T09:27:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JamesPearson](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jamespearson/32/12445_2.png) [@JamesPearson](https://discourse.zynthian.org/u/JamesPearson)\
**Post date:** [November 10, 2024, 10:17am UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/3 "2024-11-10T10:17:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [November 10, 2024, 10:32am UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/4 "2024-11-10T10:32:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![riban](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/riban/32/2331_2.png) [@riban](https://discourse.zynthian.org/u/riban)\
**Post date:** [November 10, 2024, 11:56am UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/5 "2024-11-10T11:56:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JamesPearson](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jamespearson/32/12445_2.png) [@JamesPearson](https://discourse.zynthian.org/u/JamesPearson)\
**Post date:** [November 10, 2024, 3:39pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/6 "2024-11-10T15:39:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tunagenes](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/tunagenes/32/7279_2.png) [@tunagenes](https://discourse.zynthian.org/u/tunagenes)\
**Post date:** [November 10, 2024, 5:18pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/7 "2024-11-10T17:18:42Z")

</div>

> [@riban](#):
>
> If you can see DIN-5 MIDI as an input/output in zynthian then the post is detected

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

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [November 10, 2024, 6:01pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/8 "2024-11-10T18:01:58Z")

</div>

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 😅

---

<div class="post-metadata">

**Author:** ![JamesPearson](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jamespearson/32/12445_2.png) [@JamesPearson](https://discourse.zynthian.org/u/JamesPearson)\
**Post date:** [November 10, 2024, 6:06pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/9 "2024-11-10T18:06:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kirtai](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/kirtai/32/12530_2.png) [@Kirtai](https://discourse.zynthian.org/u/Kirtai)\
**Post date:** [November 10, 2024, 10:42pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/10 "2024-11-10T22:42:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JamesPearson](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jamespearson/32/12445_2.png) [@JamesPearson](https://discourse.zynthian.org/u/JamesPearson)\
**Post date:** [November 26, 2024, 7:31pm UTC](https://discourse.zynthian.org/t/din-midi-in-via-uart-not-working/10486/11 "2024-11-26T19:31:45Z")

</div>

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