Since the 1980s, MIDI has been a great way to send data between electronic musical instruments. Beginning as a modified serial interface running through optoisolaters and DIN sockets, these days, your hardware is more likely to carry its MIDI data over USB instead. This is great if you want to hook up to a computer without a cumbersome interface, but not so great when you want to connect a bunch of instruments to each other.
The Roland Integra 7 is a rack mount synthesizer with classic MIDI ports. [adriangin] wanted to control the synthesizer over MIDI, but their Casio keyboard only had MIDI over USB available. To get around this, [adriangin] set out to add a standard MIDI Out port to the Casio PX410R.
If you want to be a hardware hacker, get familiar with standard serial communications. After some probing around the test pads while playing with the keyboard’s sustain pedal, [adriangin] found what looked like a MIDI signal between two ICs, but at a non-standard bitrate. The hunch turned out to be correct – the signal was going between the synthesizer DSP chip & the IC handling the USB connection. The standard MIDI interface operates at 31250 baud, while this signal was at 215500 baud. There’s no simple way to convert from one baud rate to another, so [adriangin] had to do it the hard way.
An Atmega32P was pressed into service, using a soft UART implemented on a digital pin to run at 215500 baud. At such a high bitrate, the soft UART required some cycle-accurate assembly programming to get everything humming along. The data would then be repeated over to the hardware UART running at 31250, which was wired to a standard DIN plug as used in classic MIDI. It’s a useful hack that allows the keyboard to work with a much wider range of hardware. It’s topped off by its clean execution, with the new port neatly integrated into the rear panel.
Check out these other great MIDI hacks, like this chiptune looper built from the ground up or this MIDI-enabled Stylophone.
Wery nice.
that is some badass work right there!
I too have needed legacy MIDI out of USB-only instruments.
But USB host controllers are cheap.
Just sayin’
Great work nonetheless!
Might be an attempt to reduce input delay. Since he’s doing this conversion to plug a keyboard into a rack mount midi module he probably intends to play it as an instrument. Sometimes human brain input loops like that can be timing critical.
Why did he choose soft uart for the fast port?
Likely the 215500 is not a standard baud rate, 230400 is the closest standard rate.
The internal 8MHz oscillator didn’t allow it to be nicely divided by an integer to obtain a baud rate close to 215.5k with acceptable error.
One could fine tune the internal oscillator and thus use the UART for the 215.5k, though this would mean it’d need to be tuned again if it were to be replicated. Afaik the chips are tuned to 8MHz at the factory.
What I wonder is why the insistence on using a 8MHz chip when surely you can get better at almost no cost and then you don’t need to jump through hoops to make it run.
Also: Was an attempt even made to run it at something other than 8MHz? Oris the ‘won’t work’ just an assumption?
With a slight modification the code could run on an arduino, not so much if you recalibrate the internal oscillator.
The chip chosen by the project author comes in a DIP package which makes for easy wire soldering, either he had it on hand or chose it for that purpose specifically.
If he made the project solely for himself it would’ve probably been quicker to adjust the internal osc. but as it stands he didn’t and made it easier for people who wish to reproduce the project by either arduino or bare chip.
Which chip would you recommend?
Why not use the hardware UART at the faster bitrate and bitbang the slower?
There could be no xtal/prescaler combination available to reach such an awkward baudrate.
I have casio CTK 810IN. When i connect it to a DAW as a midi its playing automatically in the daw and also CC100 and CC121 is giving signals automatically. What can I do for this?