Why choose SPI over UART?

I currently checking out patchbox OS since I’m interested in doing audio related stuff. Also I’m thinking about getting that pisound.
And one big question keeps popping up in my mind: why did you choose spi for MIDI when the Pi’s UART could to that job?

That’s a good question. While UART pins on the Pi’s GPIO theoretically could be used for direct communication with MIDI devices, in practice, it’s not that convenient and stable, because:

  1. 31250 baud rate is not supported out of the box, tweaking the CPU frequency is required
  2. CPU scaling would have to be disabled, as its clock depends on the current CPU frequency
  3. New Pi versions may require different tweaks.
  4. Those said tweaks could interfere with whatever a user may be trying to do with their system
  5. The tweaks must be done in the config files, so the Hat couldn’t be just mounted and be expected to work.

So a synchronized communication method, which is immune to system clock changes, and a dedicated chip for translating the data to MIDI is the most foolproof way of doing MIDI on Raspberry Pi. :slight_smile:

See https://blokas.io/pisound/docs/midi/ for more information on Pisound’s MIDI implementation.