-
Notifications
You must be signed in to change notification settings - Fork 22
USBMIDIKLIK BUS MODE
THE V2 brings a deep evolution of USBMidiKlik for the STM32F103 platform. It consists in connecting 5 boards, each hosting a Bluepill , to aggregate them to a one virtual 15x15 ports interface.
From the computer, it is seen as a true 16x16 i/o ports, able to address 15x15 midi i/o jacks. It is possible to route any of the inputs ports to any of the outputs ports, and the configuration menu allows an easy and rapid setup.
- The master is the only one connected to USB.
- All slave boards are connected to the I2C bus, no USB and manage serial midi only (jacks in / out )
- Master has a fixed address on the bus (no 4)
- Slaves Ids start from 5 to 8
- The master collects all midi messages from the slaves in a fast loop
- Slaves apply routing rules, being synchronized from the master routing rules at the boot time to avoid stressing the master. This allows to pass a "pre-routed" messages to the master.
- Slaves are aware of the USB state, and can switch in a pure midi jack serial routing (cf Intelligent thru)
- All routing engine capabilities are preserved in the bus version (merge, split, filter,...)
- The board can work is a "busless" mode as a usual usb midi 3x3 interface
When a midi message is addressed to a serial port not being the master's local ones (Serial 1,2,3), the message is routed to the right board via I2C. For example if a software on a computer want to send to MIDI OUT 4, that will be translated into "send to midi out 1 of the device #2".
The logic is almost the same for MIDI IN. For example, if a midi keyboard sends notes to MIDI IN 5, the messages will pass thru the slave routing engine to determine the target. If the target is not a slave local serial, the pre-routed message will be sent to the master for dispatch to another slave connected on the BUS.
The master routine engine indicates to what port the message must be sent. When the master starts, it will broadcast its own routing configuration to all slaves, to ensure a coherent routing when it is delegated to a slave.
You must connect at less 2 boards together. 5 max including the master. The bus configuration is not available from SYSEX messages. You must so use the configuration menu with a terminal emulation on the ad-hoc serial port.
In the configuration menu, you must set a device ID, 4 being the master one.
USBMIDIKLIK 4x4 - MIDITECH4x4 STM32F103RC - V2.0
(c) TheKikGen Labs
https://github.com/TheKikGen/USBMidiKliK4x4
[0] View global settings [a] Show active devices
[1] View midi routing [d] SYSEX settings dump
[2] Usb VID PID
[3] Usb product string
[4] Cable OUT routing [e] Reload settings
[5] Jack IN routing [f] Factory settings
[6] IntelliThru routing [r] Factory routing
[7] IntelliThru timeout [s] Save settings
[8] Toggle bus mode [z] Debug on Serial3
[9] Set device Id [x] Exit
=>
Select option 9 to set the device ID. The example below set the current device as a master.
Device ID ( 04:Master, Slaves 05-07) :04
Then activate the bus mode with the option 8 to allow routing for all the 16 ports.
Enable bus mode (yn) ? y
Bus mode enabled.
Show the current routing map with the option 1. You will see that the routing now allows you to address 15 or 16 jacks and 16 cables .
USB MIDI CABLE OUT ROUTING (16 port(s) found)
|Cb| Msg Filter | Cable IN 1111111 | Jack OUT 1111111 |
| | Ch Sc Rt Sx | 1234567890123456 | 1234567890123456 |
|1 | X X X X | ................ | X............... |
|2 | X X X X | ................ | .X.............. |
|3 | X X X X | ................ | ..X............. |
|4 | X X X X | ................ | ...X............ |
|5 | X X X X | ................ | ....X........... |
|6 | X X X X | ................ | .....X.......... |
|7 | X X X X | ................ | ......X......... |
|8 | X X X X | ................ | .......X........ |
|9 | X X X X | ................ | ........X....... |
|10| X X X X | ................ | .........X...... |
|11| X X X X | ................ | ..........X..... |
|12| X X X X | ................ | ...........X.... |
|13| X X X X | ................ | ............X... |
|14| X X X X | ................ | .............X.. |
|15| X X X X | ................ | ..............X. |
|16| X X X X | ................ | ...............X |
MIDI IN JACK ROUTING (16 port(s) found)
|Jk| Msg Filter | Cable IN 1111111 | Jack OUT 1111111 |
| | Ch Sc Rt Sx | 1234567890123456 | 1234567890123456 |
|1 | X X X X | X............... | ................ |
|2 | X X X X | .X.............. | ................ |
|3 | X X X X | ..X............. | ................ |
|4 | X X X X | ...X............ | ................ |
|5 | X X X X | ....X........... | ................ |
|6 | X X X X | .....X.......... | ................ |
|7 | X X X X | ......X......... | ................ |
|8 | X X X X | .......X........ | ................ |
|9 | X X X X | ........X....... | ................ |
|10| X X X X | .........X...... | ................ |
|11| X X X X | ..........X..... | ................ |
|12| X X X X | ...........X.... | ................ |
|13| X X X X | ............X... | ................ |
|14| X X X X | .............X.. | ................ |
|15| X X X X | ..............X. | ................ |
|16| X X X X | ...............X | ................ |
MIDI IN JACK INTELLITHRU ROUTING (16 port(s) found)
|Jk| Msg Filter | Cable IN 1111111 | Jack OUT 1111111 |
| | Ch Sc Rt Sx | 1234567890123456 | 1234567890123456 |
|1 | X X X X | (N/A) | XXXX............ |
IntelliThru mode is active.
USB sleeping detection time :30s
You can then define routing rules for USB cables, Jack or Intellithru mode as usual.
=>4
-- Set USB Cable OUT routing --
Enter Cable OUT # (01-16 / 00 to exit) :01
Set filter Midi messages for cable out #01 :
Channel Voice (yn) ? y
System Common (yn) ? y
Realtime (yn) ? y
System Exclusive (yn) ? y
Route Cable OUT#01 to Cable IN#01 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#02 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#03 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#04 (x to exit) (ynx) ? y
Route Cable OUT#01 to Cable IN#05 (x to exit) (ynx) ? y
Route Cable OUT#01 to Cable IN#06 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#07 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#08 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#09 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#10 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#11 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#12 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#13 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#14 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#15 (x to exit) (ynx) ? n
Route Cable OUT#01 to Cable IN#16 (x to exit) (ynx) ? n
Route Cable OUT#01 to Jack OUT#01 (x to exit) (ynx) ? n
Route Cable OUT#01 to Jack OUT#02 (x to exit) (ynx) ? y
Route Cable OUT#01 to Jack OUT#03 (x to exit) (ynx) ? y
Route Cable OUT#01 to Jack OUT#04 (x to exit) (ynx) ? y
Route Cable OUT#01 to Jack OUT#05 (x to exit) (ynx) ? x
Save settings with the "s" option and reboot with the "x" option.
Configure slaves Ids from 5 to 8 and activate the bus mode in the same way. You don't need to change the routing rules, as the master rules will be copied to all slaves at the boot time.
The Bus mode is operated via I2C bus. I2C pins are
- PB7 for SDA1
- PB6 for SCL1
You must pull up the SCA1 and SCL1 lines with 2x10K resistors connected to +5V. So the schematic for 3 boards is:
For more boards, it is the same logic. Simply connect SCL1/SDA1 of each board to SCL1/SDA1 bus lines. You do not need more pullup resistors.