Author Topic: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!  (Read 10564 times)

0 Members and 1 Guest are viewing this topic.

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2368
  • Country: de
    • Frank Buss
I'm developing a file transfer program, to send data from a PC (or Mac) to a Commodore C64 via MIDI. My idea was to use standard SysEx commands for file transfer, but looks like some very cheap adapter from eBay just ignores any byte after the third byte. This is my report so far, comparing two other USB MIDI adapters:

http://www.frank-buss.de/midi/index.html

I can do a teardown, if someone is interested. Maybe would be interesting to see which chips they are using, and if the MIDI-in shield and ground is not connected to the system ground, to avoid ground loops. Should we bet which device does it right and which wrong? :)

But the problem is that other people have the cheap eBay device, too. What should I do to transfer data to the C64? I could wrap it in 3-byte messages, but then it would need longer to transfer, because of the long USB-delays. Or I could require non-buggy MIDI adapters, if someone wants to use my program.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline andyjh

  • Newbie
  • Posts: 2
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #1 on: October 27, 2013, 01:07:16 pm »
MIDI is an opto isolated system,  so should be isolated from any ground. It was designed that way to ensure no earth loops between connected instruments. The MID input socket, should not have any ground connection to pin 2. 

I have used the basic in-line style interfaces, from CME (CME 2-MIDI) and ART (USB 2 MIDI), and they both work well with long sys-ex messages. The ART one, looks the same as the Bespeco one - or at the least the case is the same.   These use the operating system's generic driver, but do seem to work all OK,  but there are many areas with MIDI that can catch interfaces out,  such as MIDI clock, active sensing and running status, and of course sys-ex, it probably depends on how fast the operating system is sending the data down the USB cable, because MIDI can only work at 31 K baud, so the interface may have to buffer quite a lot of data, it might be hard to discover how much RAM is available for such tasks in these interfaces. But  generally,  cheap interfaces are cheap for a reason (they don't work properly !).

The opto coupler should remove the noise from the data,  but these devices are powered from the USB cable, so that can put all the noise back anyway - there are so many areas where these devices can fail.

I have opened up a CME one, but it's just a potted blob on the pcb - it would be interesting to see what's inside these cheap interfaces though, I am sure there will be some without an opto isolator in them.
 

Offline kaz911

  • Super Contributor
  • ***
  • Posts: 1052
  • Country: gb
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #2 on: October 28, 2013, 05:36:25 pm »
In the very old days ('84?) - I converted normal DOS PC ISA serial ports to MIDI by exchanging the crystal to hit the right baud rate  - worked fine. The opto isolation is not needed for "1-1 hack setups" - and is there first of all  to enable hot-plug of instruments for drunk musicians and 2nd to minimize potential ground loops.

I wrote a whole driver lib for "serial midi" and a sys-ex editor/midi sequencer on DOS in Turbo Pascal. It was published in the Danish magazine "Circuit Design" with lists of compatible serial cards with appropriate warnings :)

So if bytes are not coming out - I would say it is an issue on the USB->SERIAL(cheap midi) port. All serial ports have buffers - so you push in a byte - that is converted to a serial bitstream and sent out. Once the serial chip knows it has been transmitted - it opens the buffer for the next byte. Clearly something is not letting the buffer close or re-open and you get stuck at 3 bytes for what ever reason...

 

Offline true

  • Frequent Contributor
  • **
  • Posts: 329
  • Country: us
  • INTERNET
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #3 on: October 29, 2013, 12:27:04 am »
Most of those cheap Chinese ones won't do Sysex correctly, and finding one that might is a crapshoot. And even some more recognized brands (Yamaha) won't either.

I have an M-Audio and it works well.

Generally the requirement I have seen from application developers is that buggy devices aren't used, which is why I have the M-Audio :)
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1427
  • Country: us
  • Very dangerous - may attack at any time
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #4 on: October 29, 2013, 02:27:14 am »
Those cheap USB to MIDI cables use a COB (chip on board). Some of them also have omitted the opto!
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #5 on: October 29, 2013, 09:12:54 am »
That brings me back... I used to have one of those old pro audio spectrum joystick to midi adapters that I used with a few different sound cards.  I had a Yamaha PSS-480 keyboard that was FM Synth only and found that routing it back through midi to my AWE64 let me use the wavetable instruments.

If they still make the MIDI to Joystick cables, I wonder if you could run it through a USB to Joystick cable? (Assuming all else fails)
The larger the government, the smaller the citizen.
 

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2368
  • Country: de
    • Frank Buss
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #6 on: October 29, 2013, 10:10:21 am »
I read the USB MIDI specification:

http://www.usb.org/developers/devclass_docs/midi10.pdf

It is a bit bloated and difficult to read, as most of the time with USB specifications. And it doesn't make sense for me that there are "virtual MIDI cables", because USB allows compound devices, where each device could be a MIDI interface, so this is redundant for me. And then there is the code index nibble, which says what MIDI message follows. Well, the MIDI message itself does this very nicely, so redundant as well.

Ok, enough ranting, this is what is sent on the bulk channel when I send a note-on message:

09 90 01 64

The first byte is the code index nibble 9, and virtual cable nibble 0. Then the MIDI message follows.

For the EOF SysEx message this bulk packet is sent:

04 f0 7e 64 07 7b 00 f7

The code index 04 says "SysEx starts or continues". Then the first 3 bytes of the SysEx message follows and then a new code index 07, which means "SysEx ends with following three bytes". I guess the cheap adapters just ignore anything after the first 3 bytes.

I can't find any flow control in the USB MIDI specification. My adapters are using USB Full Speed (12 MBit/s). Because it is a bulk-endpoint, there is no speed limit as known from the control-endpoint used e.g. for HID. Would be interesting to see what the adapters do when I send with max USB speed >:D But on a lower level USB devices can send NAKs to temporary stop the transfer from the host.

If they still make the MIDI to Joystick cables, I wonder if you could run it through a USB to Joystick cable? (Assuming all else fails)

Probably only the joystick signals are connected, because most users don't need MIDI.

In the very old days ('84?) - I converted normal DOS PC ISA serial ports to MIDI by exchanging the crystal to hit the right baud rate  - worked fine. The opto isolation is not needed for "1-1 hack setups" - and is there first of all  to enable hot-plug of instruments for drunk musicians and 2nd to minimize potential ground loops.

I wrote a whole driver lib for "serial midi" and a sys-ex editor/midi sequencer on DOS in Turbo Pascal. It was published in the Danish magazine "Circuit Design" with lists of compatible serial cards with appropriate warnings :)
Nice. Sometimes I wish PCs were as easy as in old days. Soldering a 1 MHz crystal instead of the 1.8432 MHz crystal to a ISA serial card, and you have perfect 31,250 Baud MIDI. And no complicated protocol on top, just an "outp" command in assembler to send a byte.

I'll open the adapters when I have some time to see what's inside, and update the article on my webpage.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9143
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #7 on: October 29, 2013, 02:51:38 pm »
What about a microcontroller to translate between MIDI and RS232?

Before USB, some force feedback joysticks used MIDI for sending the motor control signals.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2368
  • Country: de
    • Frank Buss
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #8 on: October 31, 2013, 02:16:36 pm »
What about a microcontroller to translate between MIDI and RS232?
This should work, but then no Windows program could use it, because they expect standard MIDI interfaces, or you have to write a driver which provides the MIDI OS interface for a serial port.
Quote
Before USB, some force feedback joysticks used MIDI for sending the motor control signals.
Intersting, I didn't know this.

I found some time for a teardown and updated the webpage. Now there are images of the PCBs of all three adapters, with some comments. Conclusion: The cheapest eBay adapter is crap, no opto-isolator, but even the expensive RME Babyface (with an opto-isolator) has the shield connected to ground of the PCB, for both, MIDI-In and MIDI-Out, which makes the opto-isolator useless, if the shield is connected to ground on MIDI-Out of the sending device, too. And no ground connection (pin 2) for both connectors.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2838
  • Country: au
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #9 on: October 31, 2013, 08:56:06 pm »
I believe the MIDI specification has provision for powering devices.  This is why there is a (current limited) +5V supply on another pin and the output is grounded.
 

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2368
  • Country: de
    • Frank Buss
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #10 on: November 01, 2013, 09:23:29 am »
I believe the MIDI specification has provision for powering devices.  This is why there is a (current limited) +5V supply on another pin and the output is grounded.
I can't find this in the specification, do you have a reference? This is the electrical specification:
http://www.midi.org/techspecs/electrispec.php
Would be difficult to use it as a power source, because the specification says that pin 4 on MIDI In has to go into an opto-isolator, so the voltage would be low at this pin. And if you use it for powering a device, the voltage could get too low for the LED in the opto-isolator. But it would work with some low power microcontroller circuit.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Online David_AVD

  • Super Contributor
  • ***
  • Posts: 2838
  • Country: au
Re: testing some USB MIDI adapters, or: where the hell are my SysEx bytes?!
« Reply #11 on: November 01, 2013, 01:07:33 pm »
A Google search for "midi output circuit" showed this image as the first image hit.  There are others too.  I don't have the midi spec to hand, but was sure it was part of the later revisions.



So, it's now quite how I remembered it; the 5V supply is still on pin 4 and there's the ground so you can draw current from it all the time.  Not a lot of current, but active midi devices do exist.
« Last Edit: November 01, 2013, 01:09:22 pm by David_AVD »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf