-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MIDI USB Host support #611
Conversation
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Signed-off-by: Greg Burns <[email protected]>
Awesome!! This is so exciting. Thanks for the contribution! We'll take a look and start reviewing this early next week! |
DMA is currently very unreliable, it doesn't work at all with the Arturia Beatstep Pro. Turning it off for now to allow further testing. Signed-off-by: Greg Burns <[email protected]>
After disabling DMA in usbh_conf.c the Arturia Beastep PRO and all my other MIDI USB devices now work reliably. Hot swapping ocasionally fails to detect the disconnect so there is more work needed there. As there are no other USB host examples to compare with I don't know if there is a problem with the DMA configuration or it's something else. |
Works great! Tested on the Qu-Bit Aurora with the example you wrote. Used a keyboard based controller (Akai MPK-25) to great success. Also tried the Roland SPD-SX, which is a drumpad based controller. This one had issues. The serial monitor just prints "device connected" over and over. The SPD displays "MIDI OFFLINE" on the screen. That device also supports USB Audio, which maybe is the issue? I tried messing with lots of different settings to no avail. |
Did you pick up my latest commit that disables DMA? Based on what I have
been reading there may be a cache-coherency problem in DMA mode. I'm just
starting to investigate his issue.
…On Wed, Feb 28, 2024, 10:14 AM Ben Sergentanis ***@***.***> wrote:
Works great! Tested on the Qu-Bit Aurora with the example you wrote. Used
a keyboard based controller (Akai MPK-25) to great success.
Also tried the Roland SPD-SX, which is a drumpad based controller. This
one had issues. The serial monitor just prints "device connected" over and
over. The SPD displays "MIDI OFFLINE" on the screen. That device also
supports USB Audio, which maybe is the issue? I tried messing with lots of
different settings to no avail.
—
Reply to this email directly, view it on GitHub
<#611 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACESB66EISTHQC2BMMNN3HLYV5XXFAVCNFSM6AAAAABDR3GMI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGU3DMNRXG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I used the latest commit. I think the issue with the SPD-SX is that it also offers USB-Audio. It probably presents as a composite device, which confuses the Midi Host code. Maybe not something we have to worry about at this time. Either that or we can just detect devices that present as composite and ignore them for now. I want to give you some more time to look into the DMA issue if you choose before we consider merging this. |
I am making zero progress on the DMA issue. I have tried everything I have
found on the forums and my eyes are glazing over trying to follow the HAL
code maze. It doesn't help to globally disable DCache or to force
write-through and call SCB_InvalidateDCache()
inside HAL_HCD_HC_NotifyURBChange_Callback() as some forum posts suggest.
The performance hit from globally disabling DCache would be a non-starter
anyhow. Unless I am missing something this implies that the problem is not
a cache coherency issue.
BTW, I noticed that usb_diskio.c calls SCB_CleanDCache_by_Addr() which
implies that someone else may have been working on a related issue.
Bottom line is if you decide to merge my change, at least for now it needs
to have DMA disabled.
…On Fri, Mar 1, 2024 at 8:15 AM Ben Sergentanis ***@***.***> wrote:
I used the latest commit. I think the issue with the SPD-SX is that it
also offers USB-Audio. It probably presents as a composite device, which
confuses the Midi Host code. Maybe not something we have to worry about at
this time. Either that or we can just detect devices that present as
composite and ignore them for now.
I want to give you some more time to look into the DMA issue if you choose
before we consider merging this.
—
Reply to this email directly, view it on GitHub
<#611 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACESB6ZPKMXX2HTV662QWSDYWCSSXAVCNFSM6AAAAABDR3GMI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZTGQ3TEMRRGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Greg.
|
Seems that the class startup was happening at the wrong point. It needs to happen when the lower stack calls the ClassRequest callback. This fix also eliminates the spurious Device Error callback. Signed-off-by: Greg Burns <[email protected]>
I have DMA working now with all four of my devices. Hot plug seems to be stable too. Can you try testing with the SPD-SX again? |
Retested with the keyboard and the SPD-SX. The keyboard works well, the SPD still does not. I'm not worried about it, I believe the device is requesting to be a composite device, which is a bit of an edge case. I'm happy to merge it as is unless you feel strongly about continuing work. |
I think it's ready to merge.
…On Wed, Mar 6, 2024, 11:56 AM Ben Sergentanis ***@***.***> wrote:
Retested with the keyboard and the SPD-SX. The keyboard works well, the
SPD still does not. I'm not worried about it, I believe the device is
requesting to be a composite device, which is a bit of an edge case. I'm
happy to merge it as is unless you feel strongly about continuing work.
—
Reply to this email directly, view it on GitHub
<#611 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACESB64LIBY7OD3DFFTLYRLYW5YIJAVCNFSM6AAAAABDR3GMI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBRGY3TSMRUGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What is less common is devices that show up as multiple midi ports. Like the Novation Launchpad series. How would the USB Host driver deal with these? |
Do you mean multiple interfaces? There is currently a hard-coded limit of
two interfaces. It should work if there is only one MIDI interface and one
other interface. The Arturia devices I have tested with both have two
interfaces, one MIDI and one Audio. If there are multiple MIDI interfaces
there is currently no way in the current implementation to select the one
you want.
…On Thu, Mar 7, 2024, 8:04 AM dreamer ***@***.***> wrote:
a bit of an edge case
What is less common is devices that show up as multiple midi ports. Like
the Novation Launchpad series.
How would the USB Host driver deal with these?
—
Reply to this email directly, view it on GitHub
<#611 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACESB63Z7WGS6DTTNFEGFPDYXCFYVAVCNFSM6AAAAABDR3GMI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBTHA2DGMJSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yeah one device with multiple interfaces. My Novation Launchpad X actually also shows up as a storage device. Just wondering if these devices will work. Will probably give it a try at some point. |
Adds support for USB MIDI host. The addition of a Register method for registering the USB class is a breaking change but seems necessary to allow support for MSC and MIDI in the same application.
I have tested this with three different USB Midi device: Arturia Keystep, a very old M-Audio 02 Midi keyboard, a WERSI USB to MIDI (DIN) adapter and an Arturia Beatstep PRO. The first three devices all work correctly. The Beatstep enumerates and connects but MIDI events are not received, this needs further debugging but does not appear at this point to be related to the MIDI USB class implementation.