Turning MIDI connection off/on without unplugging?

Status
Not open for further replies.

bjosephs

Active member
Hi all,


I'm woking on a HUI protocol based DAW controller using a teensy 2.0++ to manage MIDI I/O and communicate to a bunch of arduino pro minis over I2C, each of which manages one channel of DAW control. I'm surprisingly far along - due in no small part to the wonderful capabilities of these boards and libraries :D - but I have a little challenge to get over that I'm seeking help for. Basically, my DAW (Studio One) seems to dump out its status data the instant it sees a connection a HUI based midi device... which is fine if I have the teensy connected via USB and booted up BEFORE I tell my DAW that I have a HUI controller I want it to talk to. The problem is that if I break the USB connection or cycle power after establishing a DAW/controller relationship, when I reconnect the board I think the DAW pumps out that update data before the teensy is ready to receive it and do anything useful.

So, the question is: Is there a way to disable or delay the MIDI software connection until the very end of the setup code?




Thanks,
Brian
 
Maybe this is possible, but you'll need to hack the core library's USB code. For Teensy++ 2.0, that's in hardware/teensy/cores/teensy and hardware/teensy/cores/usb_midi.

Maybe you'll wish to edit pins_teensy.c. At the end of the _init_Teensyduino_internal_() function is a call to usb_init(). One strategy might involve removing that, and later calling usb_init() from your sketch.

The actual usb_init() code is in usb.c, in hardware/teensy/cores/usb_midi. If using a Mac, control-click on Arduino and "show package contents" from the popup menu. Then navigate a few folders until you find "hardware".

There's a line in that code with the comment "enable attach resistor". That's what turns on the 1.5K resistor (inside the chip) which tells the USB hub (or virtual hub on your motherboard) that a new USB device has been plugged in. You could also try removing that line, and but let everything else about the USB get initialized. Then turn it on later, when you're ready to let your computer know Teensy is there.

I hope you'll post a followup if you learn what works. We get a pretty good number of people building MIDI controllers. Many are DJs with pretty good general tech skills, but problems like this can be tough. I know quite a lot about USB and low-level software, but very little about DAW software.

Hopefully a clear solution might help anyone else who runs into this issue.
 
Hi Paul,


Thanks for the reply. So, neither of those methods worked for me - but I think it may have more to do with my DAW than the code. It's hard to trouble shoot because my midi monitor loses connection to the teensy when disconnected (duh) and it needs to be manually selected in the monitor application before it will start to display data it "spies" - so I'm limited to seeing what actually get's displayed at the arduino end because I can't click fast enough... And the problem is the same as above: if the DAW is publishing out data it happens too fast for me to direct the monitor and capture the data.

Moving the "attach resistor" line from the usb_midi file to my sketch setup: everything compiled and ran and it looks like the software didn't see the teensy until I called it, but this didn't cause an output of data that got out to my display. Again, maybe my DAW doesn't see that as an event worth sending an update for.

Moving usb_init() form the pins_teensy.c file to my sketch would not compile. I ran away scared because I don't want to break anything.

For the record - just so no one get's lost retracing these steps down the road - there is an "avr" folder between teensy and cores.


Regards,
Brian
 
Status
Not open for further replies.
Back
Top