I found this guide, based on Pi3 hardware and patchblock Os as baseline
https://gist.github.com/CarloCattano/8c ... 6bcd752ea6
probably outdated but still better then the official guide, which don't even have a section for
Uart-Midi ...
From a Manjaro Forum, calling for Midi on Uart don't work but maybe C POSIX API
https://forum.manjaro.org/t/use-additio ... pi4/102522
https://www.raspberrypi.com/documentati ... html#vclog
use POSIX API; you use open to the UART device path, call read and write to perform communication, and finally call close. I think Manjaro ARM already provides the necessary POSIX lib and header out-of-the-box.
measure_clock [clock]
This returns the current frequency of the specified clock. Accepts the following clock values:
clockDescription
arm
ARM core(s)
core
GPU core
h264
H.264 block
isp
Image Sensor Pipeline
v3d
3D block
uart
UART
pwm
PWM block (analogue audio output)
emmc
SD card interface
pixel
Pixel valves
vec
Analogue video encoder
hdmi
HDMI
dpi
Display Parallel Interface
------- THe Pi3B guide ----
rp3.+ raspberry OS lite (or better PatchboxOS as a starting point)
https://blokas.io/patchbox-os/
sudo nano /boot/config.txt
enable_uart=1
dtoverlay=midi-uart0
Remove UART serial shell option in boot/cmdline.txt
sudo nano /boot/cmdline.txt
delete:
console=serial0,115200 console=tty1
Disable Bluetooth
dtoverlay=disable-bt
sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service
OR move Bluetooth to other serial port
dtoverlay=pi3-miniuart-bt
install wiringpi ( optional )
sudo apt-get install wiringpi
gpio readall (check tty dev tx rx)
download and install ttymidi to access pi serial http://www.varal.org/ttymidi/
wget http://www.varal.org/ttymidi/ttymidi.tar.gz >>>> * use ldrolez ttymidi instead
( tar -zxvf ttymidi.tar.gz
cd ttymidi/
nano Makefike
add -lpthread in "all:"
make
sudo make install )*
start serial midi and stay in background
ttymidi -s /dev/ttyAMA0 -b 38400 -v & // It will s&r at 31250 since midi-uart0
change midi device name
ttymidi -s /dev/ttyAMA0 -v -n device_name
Depending on your setup you can manage ttymidi midi port instance after creation with ALSA MIDI or JACK
send the ALSA midi to Jack Midi for system messages (clock etc) to pass through as well
a2jmidid >>>>>> This part is the only advantage for using patchblock, jack is already set up in the background and running
ALSA - list and connect to available ALSA MIDI input clients
aconnect -l aconnect id:0 id2:1 or aconnect -io
Finally
vcgencmd measure_clock uart
vcgencmd measure_clock arm
Maybe the Slim Midi Hat could use a pip venv like that used for the Lego Hat, to enable the GPIOs? I'm only guessing here, as the C APi seems like the only viable solution for Manjaro, and Zynthian uses pip venv to enable the Gpios also... MAybe something similar has to be done in order for the SLIM MIDI HAT to work also?
Use the Build HAT from .NET
Edit this on GitHub
Install the .NET Framework
The .NET framework from Microsoft is not available via apt on Raspberry Pi. However, you can follow the official instructions from Microsoft to install the .NET framework. Alternatively, there is a simplified third party route to get the .NET toolchain on to your Raspberry Pi.
Warning
The installation script is run as root. You should read it first and make sure you understand what it is doing. If you are at all unsure you should follow the official instructions manually.
wget -O - https://raw.githubusercontent.com/pjgpe ... install.sh | sudo bash
After installing the .NET framework you can create your project:
dotnet new console --name buildhat
This creates a default program in the buildhat subdirectory, and we need to be in that directory in order to continue:
cd buildhat
You will now need to install the following nuget packages:
dotnet add package System.Device.Gpio --version 2.1.0
dotnet add package Iot.Device.Bindings --version 2.1.0
Run C# Code
You can run the program with the dotnet run command. Let’s try it now to make sure everything works. It should print "Hello World!"
dotnet run
Hello World!
(When instructed to "run the program" in the instructions that follow, you will simply rerun dotnet run)
Edit C# Code
In the instructions below, you will be editing the file buildhat/Program.cs, the C# program which was generated when you ran the above commands.
https://gist.github.com/CarloCattano/8c ... 6bcd752ea6
probably outdated but still better then the official guide, which don't even have a section for
Uart-Midi ...
From a Manjaro Forum, calling for Midi on Uart don't work but maybe C POSIX API
https://forum.manjaro.org/t/use-additio ... pi4/102522
https://www.raspberrypi.com/documentati ... html#vclog
use POSIX API; you use open to the UART device path, call read and write to perform communication, and finally call close. I think Manjaro ARM already provides the necessary POSIX lib and header out-of-the-box.
measure_clock [clock]
This returns the current frequency of the specified clock. Accepts the following clock values:
clockDescription
arm
ARM core(s)
core
GPU core
h264
H.264 block
isp
Image Sensor Pipeline
v3d
3D block
uart
UART
pwm
PWM block (analogue audio output)
emmc
SD card interface
pixel
Pixel valves
vec
Analogue video encoder
hdmi
HDMI
dpi
Display Parallel Interface
------- THe Pi3B guide ----
rp3.+ raspberry OS lite (or better PatchboxOS as a starting point)
https://blokas.io/patchbox-os/
sudo nano /boot/config.txt
enable_uart=1
dtoverlay=midi-uart0
Remove UART serial shell option in boot/cmdline.txt
sudo nano /boot/cmdline.txt
delete:
console=serial0,115200 console=tty1
Disable Bluetooth
dtoverlay=disable-bt
sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service
OR move Bluetooth to other serial port
dtoverlay=pi3-miniuart-bt
install wiringpi ( optional )
sudo apt-get install wiringpi
gpio readall (check tty dev tx rx)
download and install ttymidi to access pi serial http://www.varal.org/ttymidi/
wget http://www.varal.org/ttymidi/ttymidi.tar.gz >>>> * use ldrolez ttymidi instead
( tar -zxvf ttymidi.tar.gz
cd ttymidi/
nano Makefike
add -lpthread in "all:"
make
sudo make install )*
start serial midi and stay in background
ttymidi -s /dev/ttyAMA0 -b 38400 -v & // It will s&r at 31250 since midi-uart0
change midi device name
ttymidi -s /dev/ttyAMA0 -v -n device_name
Depending on your setup you can manage ttymidi midi port instance after creation with ALSA MIDI or JACK
send the ALSA midi to Jack Midi for system messages (clock etc) to pass through as well
a2jmidid >>>>>> This part is the only advantage for using patchblock, jack is already set up in the background and running
ALSA - list and connect to available ALSA MIDI input clients
aconnect -l aconnect id:0 id2:1 or aconnect -io
Finally
vcgencmd measure_clock uart
vcgencmd measure_clock arm
Maybe the Slim Midi Hat could use a pip venv like that used for the Lego Hat, to enable the GPIOs? I'm only guessing here, as the C APi seems like the only viable solution for Manjaro, and Zynthian uses pip venv to enable the Gpios also... MAybe something similar has to be done in order for the SLIM MIDI HAT to work also?
Use the Build HAT from .NET
Edit this on GitHub
Install the .NET Framework
The .NET framework from Microsoft is not available via apt on Raspberry Pi. However, you can follow the official instructions from Microsoft to install the .NET framework. Alternatively, there is a simplified third party route to get the .NET toolchain on to your Raspberry Pi.
Warning
The installation script is run as root. You should read it first and make sure you understand what it is doing. If you are at all unsure you should follow the official instructions manually.
wget -O - https://raw.githubusercontent.com/pjgpe ... install.sh | sudo bash
After installing the .NET framework you can create your project:
dotnet new console --name buildhat
This creates a default program in the buildhat subdirectory, and we need to be in that directory in order to continue:
cd buildhat
You will now need to install the following nuget packages:
dotnet add package System.Device.Gpio --version 2.1.0
dotnet add package Iot.Device.Bindings --version 2.1.0
Run C# Code
You can run the program with the dotnet run command. Let’s try it now to make sure everything works. It should print "Hello World!"
dotnet run
Hello World!
(When instructed to "run the program" in the instructions that follow, you will simply rerun dotnet run)
Edit C# Code
In the instructions below, you will be editing the file buildhat/Program.cs, the C# program which was generated when you ran the above commands.
Statistics: Posted by Zool64Pi — Sat Jun 28, 2025 1:38 am