Serial midi input stopping completely at random moments

Status
Not open for further replies.

sixeight

Well-known member
Here is my project and code: https://github.com/sixeight7/VController
I have a problem with serial midi coming from Roland devices (VG99 and GR55). Everything will work fine for awhile and then Midi in will just stop. The only thing I can do is reboot the Teensy LC. Whenever I change my code, the time midi in will work gets better, then I add something and it gets worse. I am mostly just adding new functionality to the sketch, but I am not changing the midi in code..

I am lost why Midi in stops completely.

I would like to add a watchdog that checks whether midi is still coming in. But how can I reset the Midi ports?

I have tried restarting the midi by running Midi.begin() and all the Midi.sethandle commands again, but this did not help either...

Can anyone help me?
 
I am mainly looking for clues and for tools to check serial communication. I did notice that serial1 gives more trouble than serial 2 and serial 3.

Is there a physical difference between the serial interfaces?

Also had a look the KL26Z datasheet. Is there a parameter I can check to see whether the serial port is still receiving data?

What could be causing there problems?
Maybe a pointer going haywire.... Any other things I should check?
 
Roland sysex delay

It could be some kind of timing issue in the sysex communication between the Roland/Boss devices and the Teensy LC. Adding 10 ms delays after sending out midi data gives fewer time-outs.

I was looking at this because I considered using MIDI for interdevice communication. I ran across http://www.chromakinetics.com/handsonic/rolSysEx.htm where he mentions at the very bottom of the page that Roland devices need a 40ms delay between sysex requests. So, it seems likely that 10ms delays are not long enough. You might want to consider redesigning your application so that it can do useful work during the delays, e.g. by using some kind of event scheduler.

-- Steven
 
So, it seems likely that 10ms delays are not long enough.

10 ms should be fine. This delay time is mentioned in Roland's midi implementation guides. I have tried several delay times, but none of them worked.

The problem turned out to be hardware related. The optocoupler I used turned out to be too slow. I now use a 6n138, which works a lot better. I hardly ever lose communication anymore.

I still don't know why the communication ceased completely though. I would expect certain messages to be lost or incomplete, but not a complete freezing of all communication...
 
Last edited:
Status
Not open for further replies.
Back
Top