11 years, 1 month ago.

More than one port on the same USB

Hi, I'm playing for some time with the USB Midi with a great success. Now I'm trying to play with USB Audio. I could compile the example, I run in my computer and the system recognizes the audio port (I didn't try with the sound because I don't have DACs yet). I even tried with 4 audio outputs and the systems didn't complaint at all, even working with ASIO4ALL, which is amazing. My intent is to have a single USB device with an audio port (with 4 outputs) and a MIDI, working at the same time. I tried by calling both .h (#include "USBMIDI.h" and #include "USBAudio.h") and I created both ports (USBMIDI midi; and USBAudio audio(FREQ, NB_CHA, 8000, 1, 0x7180, 0x7500);) only one works. If the line with USBAudio is the last been executed, the system recognizes only the audio ports. If the last called is the USBMIDI, the systems only recognizes the MIDI port.

In my humble opinion, it is almost working, because at last there are no compiler warning, or from the SO. I know very little of the inners from USB port, but it looks like to me it could be something about both ports trying to use same address, or something like that. Someone knows if it could be possible to make both ports work at the same time?

Thank you in advance for any help!

Question relating to:

3 Answers

11 years, 1 month ago.

This should be possible, but not easily, you need to combine the usb descriptors from the 2 classes, and combine all the utility functions into 1 class, I managed it with Serial and HID but it took a bit of research.

Accepted Answer
11 years, 1 month ago.

At first glance, it seems as though what you're trying to do isn't possible with the way you have it set up because the mbed is only capable of controlling one USB Device at a time (it only has one port). However, if you could give more details about how you have wired your system (perhaps a photo of it wired up or a diagram) I'd be able to say for sure. As for making them work at the same time, you may be able to use an external usb device controller, with which you communicate over SPI or something however I doubt you'll be able to get it to work at the moment as it is.

Xtian Xultz
poster
11 years, 1 month ago.

Thanks for the replys, I will do deeeper research about it, I tough it could be a bit simpler (maybe adjusting some parameters on the USBDevice headers). My intent is to build something like Komplete Audio 6, or like a DJ controller, there are several in the market which implements an MIDI and Audio port on the same USB port. If they did it, I can do it too!! As soon as I have some more time (the college is killing me), I will start learning about the USB port, maybe I should read the "USB port complete" book... As soon as I have some info about it, I'll try to share it here.

Best regards!