Close

Bus protocol

A project log for Modular MIDI

Using a CAN bus to distribute MIDI messages in a modular synthesizer

davidDavid 10/14/2021 at 00:360 Comments

Deciding how the bus should behave is a bit easier as it can be adjusted afterward. The simplest solution is to use the CAN frame as a wrapper for the MIDI message. I did think about using one or two bits of the ID to define special messages, but it seems unnecessary.

The CAN ID could contain some info about the MIDI message like type, or channel. That way some modules can filter out messages in the CAN controller, which means the CPU will see fewer interruptions. However, as far as I've understood the CAN bus it only uses the message header for arbitration. So, using the ID field like this will lead to more collisions and a reduced bandwidth. It may be better to use randomly generated IDs, so that each module on the bus has a unique ID. This would probably require a mechanism to detect address collisions to generate a new ID.

One thing I'm unsure about is the 7-bit sysex messages. The specification says no messages should be interleaved with the sysex message. We could reserve CAN ID 0 for these messages so they always win arbitration, but that assumes we only have one sysex transmitter. But we can also use the CAN ID to determine which device sent the message, to reconstruct the sysex.

Discussions