Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

Device Tree • Release the MIDI BAUD rate on pins 14 - 15.

$
0
0
The whole baud thing is ridiculous.
We are decades past the concept of discrete bitrates but it is deeply embedded in the kernel for serial ports.
I thought this had been changed, allowing non-standard baud to be set but recent try to install bento-ttymidi, which uses
an overlay to request the standard 312500 Midi Baud rate for TX and RX pins 14 -15, returned an error. A function in the overlay
is trying to change the baud rate to a non standard (?) rate. This function is deprecated.

https://github.com/terioto/bento_ttymidi
https://github.com/terioto/bento_ttymidi/issues/1

bento_ttymidi is a lightweight MIDI bridge that connects ALSA MIDI with UART MIDI hardware. It supports both sending (TX via GPIO14) and receiving (RX via GPIO15) standard 5-pin DIN MIDI messages. Designed for Raspberry Pi systems.

Could there be some setting that needs to be set up in order for the DEVICE to be able to request a custom Baud rate?


https://github.com/terioto/bento_ttymid ... _ttymidi.c

Code:

void open_serial() {    struct termios tty;    serial_fd = open(DEVICE, O_RDWR | O_NOCTTY);    if (serial_fd < 0) {        perror("[ERROR] open serial device");        exit(1);    }    if (debug) printf("[INFO] Opened serial device: %s\n", DEVICE);    memset(&tty, 0, sizeof tty);    if (tcgetattr(serial_fd, &tty) != 0) {        perror("[ERROR] tcgetattr");        exit(1);    }    cfmakeraw(&tty);    cfsetspeed(&tty, B38400);    tty.c_cflag |= (CLOCAL | CREAD);    tty.c_cflag &= ~CRTSCTS;    if (tcsetattr(serial_fd, TCSANOW, &tty) != 0) {        perror("[ERROR] tcsetattr");        exit(1);    }    set_custom_baudrate(serial_fd, BAUDRATE);

After setting up the service, and making all the system configurations
included in the github, there is no much else I can do...

3. Check service status

systemctl status bento_ttymidi.service
Raspberry Pi UART Configuration (config.txt)

To enable UART MIDI on Raspberry Pi GPIO14 (TX), edit the config.txt:

sudo nano /boot/config.txt
Add or ensure the following lines are present:

enable_uart=1
dtoverlay=disable-bt
dtoverlay=midi-uart0
After editing, reboot your system:

sudo reboot
You should now see /dev/serial0 → usually linked to /dev/ttyAMA0

License

Based on ttymidi by Jonathan Lissajoux (https://github.com/lathoub/ttymidi), licensed under the MIT License. The original repository is no longer available, but various forks and archives remain accessible.

Contact

Website: https://www.terioto.com
Email: info@terioto.com

Statistics: Posted by Zool64Pi — Wed Jul 02, 2025 3:09 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles