-
Notifications
You must be signed in to change notification settings - Fork 1
/
SerialMIDI.txt
218 lines (184 loc) · 6.57 KB
/
SerialMIDI.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
Yamaha/Roland/Korg Serial MIDI
==============================
Serial Port Settings
--------------------
The general settings for the serial port are:
- baud rate: 38400 bps
- 8 bits per byte
- 1 stop bit
- no parity
- CTS flow control: optional
- RTS flow control: device-dependent
- DTR/DSR/XON/XOFF flow control: off
All Yamaha and Roland devices I tested so far work just fine with CTS control enabled.
Yamaha devices do not need CTS/RTS flow control. The Yamaha driver disables CTS/RTS in general.
Some Roland devices require RTS flow control. The Roland driver generally enables the RTS line.
The Korg AG-001B cable has CTS and RTS connected with each other on the PC side. The Korg driver disables CTS/RTS.
CTS/RTS is not working on the Korg NS5R and trying to use a Yamaha/Roland cable with it causes Windows to freeze when opening the COM port.
device | CTS | RTS
----------------+-------+-------
Yamaha MU128 | O | O
Roland SC-55mkII| O | O
Roland SC-88VL | O | O
Roland SC-88Pro | O | !
Roland SC-8820 | O | O
Korg NS5R | X | X
O = optional
! = required
X = broken / don't use
Serial protocol
---------------
The "protocol" is just the same raw MIDI data that is usually transferred over MIDI cables.
However the serial protocol uses one special command, which is undefined according to the MIDI specification:
command F5 ##: select part group
host -> device:
- ## = 00 -> group A (default)
- ## = 01 -> group A
- ## = 02 -> group B
- ## = 03 -> group C
- ## = 04 -> group D
Yes, values 00 and 01 are both going to the same group.
device -> host:
- Yamaha modules don't seem to use the F5 command for their outgoing data.
- Roland SC-88Pro regularly outputs "F5 00".
- Roland SC-8820 outputs "F5 05" for data forwarded from the MIDI In port.
- Neither Roland nor Yamaha seem to indicate the difference between "MIDI Out" and "MIDI Through" data.
The Korg NS5R manual describes additional behaviour:
host -> device:
- F5 00 -> group assignment according to "MIDI ch To Port" settings on the device
- F5 01 -> to MIDI Out
- F5 02 -> group A
- F5 03 -> group B
- F5 F5 -> transmit F5 byte
- F5 FF -> transmit FF byte
- FF -> no operation
Port Map
--------
device | F5 00 | F5 01 | F5 02 | F5 03 | F5 04 | F5 05 | F5 06 | F5 07
----------------+---------+---------+---------+---------+---------+---------+---------+---------
Yamaha MU128 | A + Out | A + Out | Part B | Part C | Part D | --- | --- | ---
Roland SC-55mkII| A + Out | A + Out | A + Out | A + Out | A + Out | A + Out | A + Out | A + Out
Roland SC-88VL | A + Out | A + Out | B + Out | B + Out | B + Out | B + Out | B + Out | B + Out
Roland SC-88Pro | A + Out | A + Out | B + Out | B + Out | B + Out | B + Out | B + Out | B + Out
Roland SC-8820 | Part A | Part A | Part B | --- | --- | MIDI Out| --- | ---
Korg NS5R | dev-cfg | MIDI Out| Part A | Part B | dev-cfg | dev-cfg | dev-cfg | dev-cfg
--- = following MIDI data is discarded
dev-cfg = Korg NS5R: per-channel routing according to "MIDI ch To Port" device settings
Detailed settings used by Serial MIDI drivers
=============================================
I disassembled the official Yamaha and Roland MIDI drivers and extracted the Serial port settings from them.
Drivers analyzed:
- YAMAHA CBX Driver v2.00 (Windows NT version)
- Roland Serial MIDI Driver v3.2 (Windows NT version)
- KORG PC I/F MIDI Driver for Windows NT v1.31
Yamaha Serial Settings
----------------------
from CBXT3USR.dll
DCB cState;
cState.DCBlength = 28;
cState.BaudRate = 38400;
//cState.flags = 0x0001; // fBinary = 1; others = 0
cState.fBinary = 1;
cState.fParity = 0;
cState.fOutxCtsFlow = 0;
cState.fOutxDsrFlow = 0;
cState.fDtrControl = 0;
cState.fDsrSensitivity = 0;
cState.fTXContinueOnXoff = 0;
cState.fOutX = 0;
cState.fInX = 0;
cState.fErrorChar = 0;
cState.fNull = 0;
cState.fRtsControl = 0;
cState.fAbortOnError = 0;
cState.fDummy2 = 0;
cState.wReserved = 0;
cState.XonLim = 0;
cState.XoffLim = 0;
cState.ByteSize = 8;
cState.Parity = 0; // NOPARITY
cState.StopBits = 0; // 1 stop bit
cState.XonChar = 0;
cState.XoffChar = 0;
cState.ErrorChar = 0;
cState.EofChar = 0;
cState.EvtChar = 0;
cState.wReserved1 = 0;
commSetDCB(&cState); // set stuff from registry
cState.flags &= 0x8FF7;
cState.XonLim = 0;
cState.XoffLim = 512;
cState.XonChar = 0;
cState.XoffChar = 0;
// then set variables from registry values:
//cState.fOutxCtsFlow
//cState.fRtsControl
//cState.fAbortOnError
//cState.XonLim
//cState.XoffLim
//cState.XonChar
//cState.XoffChar
SetCommState(hFile; &cState);
Note: Even though the driver disables CTS/RTS flow control by default, the Yamaha MU128 works just with it enabled.
Roland Serial Settings
----------------------
from RDSMIDNT.EXE
Note: # = keep previous setting unchanged
DCB cState;
cState.DCBlength = 28;
cState.BaudRate = 38400;
cState.fBinary = 1;
cState.fParity = #;
cState.fOutxCtsFlow = [0, 1]; // 1 when "CTS/RTS" option is on
cState.fOutxDsrFlow = 0;
cState.fDtrControl = 0; // DTR_CONTROL_DISABLE
cState.fDsrSensitivity = 0;
cState.fTXContinueOnXoff = #;
cState.fOutX = 0;
cState.fInX = 0;
cState.fErrorChar = #;
cState.fNull = #;
cState.fRtsControl = [1, 2]; // 2 when "CTS/RTS" option is on, 1 = RTS line always enabled, 2 = RTS handshake
cState.fAbortOnError = #;
cState.fDummy2 = #;
cState.wReserved = #;
cState.XonLim = #;
cState.XoffLim = #;
cState.ByteSize = 8;
cState.Parity = 0; // NOPARITY
cState.StopBits = 0; // 1 stop bit
cState.XonChar = #;
cState.XoffChar = #;
cState.ErrorChar = #;
cState.EofChar = #;
cState.EvtChar = #;
cState.wReserved1 = #;
Roland modules that require RTS will stop accepting data after a short amount of time.
They are trying to send out MIDI "Active Sensing" messages (FE)
and when the transmit buffer is full, they will hang, waiting for the RTS line to be enabled.
CTS flow control isn't required, but all devices I tested kept working when enabling it.
RTS enable required:
- SC-55mkII: no
- SC-88VL: no
- SC-88Pro: yes
- SC-8820: no
Korg Serial Settings
--------------------
from KORGSMDN.DRV
The driver defines the DCB struct using
BuildCommDCB("baud=38400 parity=N data=8 stop=1", &cState);
This results in:
cState.BaudRate = 38400;
cState.fParity = 0;
cState.fOutxCtsFlow = 0;
cState.fOutxDsrFlow = 0;
cState.fDtrControl = 0;
cState.fDsrSensitivity = 0;
cState.fTXContinueOnXoff = 0;
cState.fOutX = 0;
cState.fInX = 0;
cState.fRtsControl = 0;
cState.ByteSize = 8;
cState.Parity = 0; // NOPARITY
cState.StopBits = 0; // 1 stop bit
The Korg NS5R doesn't support flow control.