EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

FTDI USB and MIDI

Started by jacko August 21, 2008
Hi

I was just wondering if anyone had done any previous work, or seen any
reference on how to connect PC MIDI over the serial FTDI usb chip. I
have downloaded a roland serial midi driver, is this all I need to get
midi to exit the FTDI chip into the CPLD?

cheers
jacko
"jacko" <jackokring@gmail.com> wrote in message
news:68fcb6fc-7484-4b16-b29e-5723fd694298@a1g2000hsb.googlegroups.com...
> Hi > > I was just wondering if anyone had done any previous work, or seen any > reference on how to connect PC MIDI over the serial FTDI usb chip. I > have downloaded a roland serial midi driver, is this all I need to get > midi to exit the FTDI chip into the CPLD?
I don't think this will work. MIDI relies on exact timing of the data, which is impossible with a serial-USB solution. For instance, when you send a few bytes out to the virtual com port of the FDTI chip, these bytes will be sent only when the the buffer is filled up or when a time-out occurs. This timeout is set to 16ms default but can be set to any time between 1 and 255ms. And even then there are delays in transmission and reception of short bursts of data. When implementing an XON/XOFF handshake recently, I experienced delays of several 10's of ms between sending the XON/XOFF charachters and receiving them on the other end. Even though I set the FTDI latency timer to 2ms. Meindert
hi

setting the baud rate much higher than the 9600 default (115200), flow
control none. Haven't worked out how to set the ftdi driver timeout.
Changed the com port to COM2, Set Roland Serial MIDI driver to use
COM2. Just wondering if the latency will be acceptable.

cheers
jacko
hi

After looking at the FTDI latency documentation 38400 baud seems best,
to always trigger a 16ms timeout (greater than 62 note start/end
points per second, and about 16 note events per start/end point), and
it's higher than midi baud. There appears to be no information on the
PC -> FTDI latency. This is the bit I was really interested in.

cheers
jacko
jacko wrote:

> There appears to be no information on the > PC -> FTDI latency. This is the bit I was really interested in.
At leas a part of that is a USB issue. Serial port devices use Bulk endpoints to transfer data. Bulk endpoints have no guaranteed latency across the USB, as the effectively get the leftover bandwidth of the bus. In practice this may mean that the typical latency is good (1ms minimum for USB 1.1), but if there are other devices on the same bus doing file transfers, that will change :) -- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "So often times it happens, that we live our lives in chains and we never even know we have the key." "Already Gone" by Jack Tempchin (recorded by The Eagles) The Beatles were wrong: 1 & 1 & 1 is 1
It will be the only device on the PC hub if necessay. I just want to
know if playing a midi file using PC synth and FTDI serial synth on
seperate channels, will sync close enough.

cheers
jacko

p.s. this is because I have an FTDI on the MAX II devkit I have, and
well...
jacko wrote:
> It will be the only device on the PC hub if necessay. I > just want to know if playing a midi file using PC synth > and FTDI serial synth on seperate channels, will sync > close enough.
Depending upon your definition of "close enough". Another thing I noticed is that you talk about using 38,400 baud. I doubt that will work reliably. The MIDI spec wants 31,250 baud +- 1%. Of course, that has nothing to do with the USB latency issue of 1ms. IIRC, there is a minimum timeout between bytes of 10 character times, which is about 3ms. So it would seem the USB might work from that perspective. Also note that there are more than a few USB/MIDI adapters out there, so USB performance must be somewhat reasonable :) -- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "So often times it happens, that we live our lives in chains and we never even know we have the key." "Already Gone" by Jack Tempchin (recorded by The Eagles) The Beatles were wrong: 1 & 1 & 1 is 1
On 21 Aug, 18:37, "Michael N. Moran" <mnmo...@bellsouth.net> wrote:
> jacko wrote: > > It will be the only device on the PC hub if necessay. I > > just want to know if playing a midi file using PC synth > > and FTDI serial synth on seperate channels, will sync > > close enough. > > Depending upon your definition of "close enough". > Another thing I noticed is that you talk about using > 38,400 baud. I doubt that will work reliably. The
baud is greater therefore no loss, so not bothered.
> MIDI spec wants 31,250 baud +- 1%. Of course, that > has nothing to do with the USB latency issue of > 1ms. IIRC, there is a minimum timeout between bytes > of 10 character times, which is about 3ms. So it > would seem the USB might work from that perspective
3ms ok. =2E
> Also note that there are more than a few USB/MIDI > adapters out there, so USB performance must be > somewhat reasonable :) >
just have devkit with usb, simulation of midi over it ok then fine.
> Michael N. Moran =A0 =A0 =A0 =A0 =A0 (h) 770 516 7918 > 5009 Old Field Ct. =A0 =A0 =A0 =A0 (c) 678 521 5460 > Kennesaw, GA, USA 30144 =A0 =A0http://mnmoran.org > > "So often times it happens, that we live our lives in chains > =A0 and we never even know we have the key." > "Already Gone" by Jack Tempchin (recorded by The Eagles) > > The Beatles were wrong: 1 & 1 & 1 is 1
jacko wrote:
> On 21 Aug, 18:37, "Michael N. Moran" <mnmo...@bellsouth.net> wrote: >> jacko wrote: >>> It will be the only device on the PC hub if necessay. I >>> just want to know if playing a midi file using PC synth >>> and FTDI serial synth on seperate channels, will sync >>> close enough. >> Depending upon your definition of "close enough". >> Another thing I noticed is that you talk about using >> 38,400 baud. I doubt that will work reliably. The > > baud is greater therefore no loss, so not bothered.
Umm... what do you mean by this? The other MIDI devices *will* mind if you try to use a 38.4Kbaud signal on a MIDI "bus", since they expect the baud rate shown below. This is not a bandwidth issue, its a UART character synchronization issue. Or have I missed something?
>> MIDI spec wants 31,250 baud +- 1%.
-- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "So often times it happens, that we live our lives in chains and we never even know we have the key." "Already Gone" by Jack Tempchin (recorded by The Eagles) The Beatles were wrong: 1 & 1 & 1 is 1
On 22 Aug, 21:30, "Michael N. Moran" <mnmo...@bellsouth.net> wrote:
> jacko wrote: > > On 21 Aug, 18:37, "Michael N. Moran" <mnmo...@bellsouth.net> wrote: > >> jacko wrote: > >>> It will be the only device on the PC hub if necessay. I > >>> just want to know if playing a midi file using PC synth > >>> and FTDI serial synth on seperate channels, will sync > >>> close enough. > >> Depending upon your definition of "close enough". > >> Another thing I noticed is that you talk about using > >> 38,400 baud. I doubt that will work reliably. The > > > baud is greater therefore no loss, so not bothered. > > Umm... what do you mean by this? The other MIDI devices > *will* mind if you try to use a 38.4Kbaud signal on > a MIDI "bus", since they expect the baud rate shown > below. This is not a bandwidth issue, its a UART > character synchronization issue. > Or have I missed something? > > >> MIDI spec wants 31,250 baud +- 1%.
Well the player would sen d midi to the roland driver, which then would send it to the USB serial device, (Midi rate not supported), so as long as usb serial rate exceeds midi rate there is no backstore of data waiting or stalled. Going from usb serial to midi, the usb device should not send much midi, mainly sysex, so not used for synchronous note playing. The other midi devices will never receive an incorrect baud rate. They will be on another midi port, either internal general midi sound, OPL3 synth, virtual synth or game port midi. In this sense the midi over usb is just a tunnel layer over USB with the same serial protocol. cheers jacko

The 2024 Embedded Online Conference