-
Notifications
You must be signed in to change notification settings - Fork 8
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
Arturia Beat Step Pro no data #14
Comments
@ctag-fh-kiel Thank you for taking the time to report this issue. To help you with this issue, I need some more data.
To answer your question about the bulk vs. interrupt endpoint, USB data connections within a device are called endpoints. Each endpoint type has different characteristics. The important thing here is that USB MIDI 1.0 class spec says to use Bulk endpoints for data transfer; the Beat Step Pro is doing this correctly, so that is not the issue. Some implementations erroneously use Interrupt endpoints, but my driver supports both. In the meantime, I will try my Arturia KeyLab Essential 88 again to make sure I have not introduced a bug by accident. |
@rppicomidi Thanks a lot for getting back!
Arturia-BSPro-ErrorLog.txt |
@ctag-fh-kiel Thank you for the data. I am puzzled. As I read the configuration descriptor from BSPro error log and from the device info in the BSPro file, the BSPro has the same USB descriptors as my Arturia Keylab Essential 88 keyboard except for the device descriptor product ID. My keyboard works fine with the example code. On my keyboard, the LEDs behind the transport controls turn on and off one after the other as expected and the terminal outputs the correct MIDI data in response to key presses. For your reference, the output of the command I would like to try to debug one thing at a time. First, there may be a power issue. May I ask you try again by connecting the BSPro via a powered USB hub? If that does not work, please try the other devices you have that are known good. If they work and the BSPro does not, then I believe we can rule out electrical issues. Second, the BSPro may not like receiving the note messages the code sends. Please disable the MIDI messages sent to the BSPro by commenting out line 127:
Then rebuild and see if the example code reacts to any of the drum pad taps, knob turns, or button presses. If that does not work, may I ask if CTAG have a USB analyzer of any sort? If so, a trace of what is going on may be telling. If not, I will see if anyone I know has a BSPro they could lend me. That will be a longer route because I am traveling soon and won't return until July. |
@rppicomidi Thanks again for testing. I have checked the power situation with a 2A supply, should be fine. Attached another dump from lsusb this time from linux, somehow homebrew lsusb did not work correctly. I don't have access to a usb analyzer unfortunately. Thanks for your help! :) |
@ctag-fh-kiel Thank you for the new data. Short answer. I do not believe descriptor parsing is the problem. Also, there is nothing in the Error Log that you sent that looks unusual to me. Can you confirm that the BSPro is it running the latest firmware? If so, I will need a USB trace to investigate further (to compare a working version with a Mac, PC or Linux computer vs. this TinyUSB driver). Longer answer: The descriptors for the BSPro and the KeyLab are the same length. The only differences between the descriptors are in the device descriptor (the BSPro uses 500mA max power and the Keylab on 100mA) and the MIDIStreaming Interface descriptors (the BSPro has the jack descriptors in a different order from the Keylab and the BSPro has an error in the MIDIStreaming Interface Descriptor header (the wTotalLength field is off by 2 for some reason). However, the usb_midi_host driver ignores the MIDIStreaming Interface descriptors unless you enable the jack string support, and it also ignores the wTotalLength field in the MIDIStreaming Interface Descriptor header; it relies on the wTotalLength field in the Configuration Descriptor instead (0x85 = 133 bytes). |
Hi there,
Yes, I updated my BSPro to test if that is the issue, it runs on the latest
firmware.
Thanks for further investigations :)
…On Mon, Jun 17, 2024 at 8:11 PM rppicomidi ***@***.***> wrote:
@ctag-fh-kiel <https://github.com/ctag-fh-kiel> Thank you for the new
data. Short answer. I do not believe descriptor parsing is the problem.
Also, there is nothing in the Error Log that you sent that looks unusual to
me. Can you confirm that the BSPro is it running the latest firmware? If
so, I will need a USB trace to investigate further (to compare a working
version with a Mac, PC or Linux computer vs. this TinyUSB driver).
Longer answer:
The descriptors for the BSPro and the KeyLab are the same length. The only
differences between the descriptors are in the device descriptor (the BSPro
uses 500mA max power and the Keylab on 100mA) and the MIDIStreaming
Interface descriptors (the BSPro has the jack descriptors in a different
order from the Keylab and the BSPro has an error in the MIDIStreaming
Interface Descriptor header (the wTotalLength field is off by 2 for some
reason). However, the usb_midi_host driver ignores the MIDIStreaming
Interface descriptors unless you enable the jack string support, and it
also ignores the wTotalLength field in the MIDIStreaming Interface
Descriptor header; it relies on the wTotalLength field in the Configuration
Descriptor instead (0x85 = 133 bytes).
—
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZMGRUW4K7UDSP2ISQJUGDZH4RFTAVCNFSM6AAAAABJKAVBHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZUGAZDKOJQGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have been able to get a hold of a USB analyzer, attached both traces (Launchpad and BSPro) edit attached new BSPro trace, where after 1.39s only bursts with the same data are sent. |
Attached some screen captures of the acquisitions, interestingly the BSPro goes into some sort of a burst mode after 1.3s or so, not following a 1ms frame pattern. Whereas LP Mini stays in sending frames every 1ms. |
@ctag-fh-kiel I have returned from my travels. To make sure I understand, your BSPro runs the latest firmware and yet usb_midi_host still fails to work. Also, what software are you using to generate the traces? I can read CSV data into a spreadsheet, but it is nicer if the software can decode data packets into USB requests, descriptors, and so forth. For example, if you used PulseView, the raw traces would be useful to me because I also have that software and could apply the USB Request protocol decoder. |
Hi there, yes, BSPro latest firmware and usb_midi_host still fails. |
@ctag-fh-kiel Ah, I see the request decoder is already there. My mistake. No need to send raw data. Would you please include a CSV trace where the BSPro successfully connects to a computer and transmits MIDI data to the computer? It may give a clue to the difference. The decoded trace you sent shows a normal enumeration sequence and at time 1.14987083692566, a normal set configuration packet. The BSPro seems to always NAK IN requests from the host on endpoint 1, which should mean the BSPro is not ready to send data. All of that looks normal on first glance. It looks like the "burst mode" after 1.3 seconds is the host repeatedly trying to start a bulk IN transfer and the BSPro repeatedly sending NAK to indicate it has nothing to send. |
@ctag-fh-kiel I am also this week going to try out some USB packet sniffers based on a Raspberry Pi Pico board. https://github.com/tana/pico_usb_sniffer and https://github.com/ataradov/usb-sniffer-lite. I suspect those will be simpler to use than the analyzer you are using. I will let you know what I find. |
Attached a trace when BSPro is connected to Mac and works fine, the data looks different. I think it seems more normal similar to the Launchpad (which worked with usb_midi_host). |
All traces are without actually sending Midi data, they are all from power on to ready to send/rcv... |
I am not sure if you looked at the right trace since I updated the post. The BSPro with usb_midi_host repeatedly sends the same data package. Trace attached again. |
@ctag-fh-kiel Yes, I see the repeating data package you mean. I do know that the RP2040 is not sending ACK in response to the data package, which means the host controller thinks it must have some sort of error in it. I will compare the crazy BSPro trace with the Mac BSPro trace. You can skip the next paragraph if you wish. The Mac reads the device descriptor, then reads the product name string descriptor, then the manufacturer name string descriptor, then the configuration descriptor, then it selects configuration 1 on the BSPro, and then the BSPro returns what appears to be a similar 64 bytes of gibberish, followed by 16 MIDI clock messages, followed by the Mac sending a NULL sysex message (0xF0 0xF7), followed by the BSPro sending another 16 MIDI clock messages, followed by the Mac requesting the language ID string descriptor from the BSPro, followed by the BSPro returning US English, followed by the Mac sending ACK and a zero-length packet to the BSPro. All seems well. Now my suspicion Please let me know. |
@ctag-fh-kiel Please do not try any other measurements yourself on my account. I just got a sniffer setup working and I am doubting my suspicion in my last post. Will look again in the morning. |
Sounds great, was just gearing up for another one :) |
@ctag-fh-kiel I now have pretty good confidence the problem is a data sequence error. It may be worth proving this to yourself by looking at the trace for the LP Mini button presses as described above. You should see the first endpoint 1 IN transaction that does not respond with Sadly, I do not believe there is a way to disable data sequence checking in RP2040 native USB host hardware. However, if you are able to try the
|
Ok, just that we understand correctly: |
@ctag-fh-kiel I am sorry if I was not clear. Yes, we understand correctly. I mention taking the LP Mini trace in case you want to see for yourself the correct DATA0 DATA1 Bulk IN transaction sequence. No need to test if you do not want to. If you are able to build the PIO USB hardware (requires wiring a USB connector to two GPIO pins, +5V and ground), then you can run the If you are not able to build the PIO USB hardware, then I am sorry, but I do not believe I can make the BSPro work with the RP2040's built-in USB host hardware. I hope this is more clear. |
@rppicomidi now I have a funny finding, the BSPro works with the usb_midi_host_pio_example without any changes to the code. Whereas the LaunchPadMini does not. Would it help if I send USB analyzer traces of both again? Cheers :) |
What version is your Pico-PIO-USB library? Version 0.6 has known issues. If you are using it, please downgrade. That said, it would indeed help to send traces of both again. I may be slow to respond for the remainder of the week. |
I have used Pico-PIO-USB 0.5.3.
@rppicomidi I'm curious what you think :) BSPro traces: LPMini traces: |
@ctag-fh-kiel I have no explanation for the behavior you are observing with the PIO-USB code. For the LPMini SYNC error: have you ruled out electrical issues? I have found that with some USB cables, I can get better results if the I connect the PIO USB port through a powered hub. That said, unless there is some memory corruption going on, I do not understand how the BSPro USB-PIO code is working. I will investigate. |
So the BSPro USB issue is within the USB peripherals state machine and can't be fixed, or is this something one can address from the TinyUSB side? I will try attaching a USB hub in both setups, maybe that changes something. For the LPMini PIO, I have also the feeling it could be an electrical issue, though I have tested already with multiple USB cables of different length. Thanks for still being involved with the issue :) |
Same results both with USB and PIO when using a USB hub in between... |
@ctag-fh-kiel Yes, it is my belief that the BSPro issue is with the BSPro's USB state machine. I am 90% sure this cannot be fixed in the TinyUSB RP2040 host driver. I have reached out for help in the TinyUSB discussions I am baffled by the PIO USB results you report. I am currently using the the PIO example myself without issue. Perhaps the difference is software versions. |
@rppicomidi Yes, I can confirm all the right commit versions. Which MIDI devices are you using to test PIO mode? Thanks for reaching out in the TinyUSB community. |
Devices I am testing:
|
Do you think the issue with the USB stack is captured in the rp2040 errata, pg. 633ff? |
To which issue with the USB stack are your referring? Also, which errata are you asking about? If I recall correctly, |
Ah ok, I didn't parse the errata with great detail, just thought, maybe you had checked them out. Thx :) |
@ctag-fh-kiel I have more information about this issue, but I unfortunately do not have a fix for the native USB Host hardware. I gave you wrong information before about the correct behavior of the USB host when it receives a packet with DATA1 PID when it expects DATA0, or vice versa. According to the USB 2.0 specification section 8.6.4, in this situation, the Host is supposed to send ACK to the Device anyway; however, the Host will ignore the data. I carefully looked at the Pico PIO USB host code and determined that it implements this behavior correctly. That would explain why the unmodified Pico PIO USB host code works correctly with the Arturia Beatstep Pro. That the Beatstep Pro does not work with the RP2040 native USB Host hardware suggests there is an undocumented Erratum in the chip. |
@ctag-fh-kiel I want to thank you again for finding this issue. It is not unique to your setup or the Beatstep Pro. I was able to duplicate this issue with a $12 STM32F072B-Discovery board. I am pretty convinced it is a chip bug. Check out raspberrypi/pico-feedback#394 if you are interested in the experiment. STM32F0 chip is a handy test tool because you can easily control the USB data toggle bit in software. Now that I have a test tool, I can see if I can come up with a software work-around. My operating assumption for a workaround is that the Finite State Machine that controls the RP2040 EPx endpoint in host mode is different from the auto-polled collection of endpoints. Please let me know if this is still of interest to you, or if you have moved on. |
Hi there, thanks for getting into this! It seems like a non trivial issue.
And yes, a workaround or fix would be great!
Thanks a lot!
|
@ctag-fh-kiel OK. It may be some weeks before I can get to this, but I will. Right now I am trying to bring the new pico-sdk 2.0 into my code base. After that, I need to finish up some work on BLE MIDI. After that, I will revisit this. As you say, it is maybe non-trivial. |
@ctag-fh-kiel I have a temporary workaround for you. You will have to apply two patches to the source code.
Then rebuild the C-code The longer term fix is a ways out, unfortunately. |
Will try soon and get back, thx for your effort :) |
I can report that the BSPro works with the patches :) |
@ctag-fh-kiel Thank you for working with me on this. I do appreciate it. I am reluctant to release this patch as a way of doing business in usb_midi_host. The right way to fix this bug is to rewrite the hcd. I will see where the TinyUSB people stand on this bug. If they are not anxious to write a new host controller driver, and if they will agree to merge the TinyUSB part of the patch, then I will release the usb_midi_host library. |
This commit fixes issue hathach#2776 hathach#2776. The HCD now routes all USB transfers through the EPx endpoint. It no longer uses the "interrupt" endpoint hardware to handle INTERRUPT and BULK endpoints. The fix avoids the data sequence error handling bug in the RP2040 USB IP's "interrupt" endpoint hardware and allows the host to correctly drop the IN packet with the error without locking up. That fixes rppicomidi/usb_midi_host#14 This fix requires the CPU to handle the SOF interrupt (every ms). That might be an issue for some systems. A benefit of this fix is that BULK transfers are more than 2x faster. There is an opportunity to speed them up further by forcing BULK transfer to begin immediately instead of waiting for the next SOF interrupt. This code has been tested with MSC flash drives, HID devices, and USB Hubs. It works with full speed and low speed HID devices connected at the same time through a hub. With the usb_midi_host application host driver, 4 MIDI devices plugged to a hub can send messages to each other (see the midi2usbhub project).
@ctag-fh-kiel If you have some time to try out a new RP2040 USB Host driver, hathach/tinyusb#2814, I believe it will fix your issue without requiring the application to list known bad devices. Hopefully the TinyUSB project will accept the pull request or something like it. |
Yes, your tinyusb pull request works with the BSPro. Great job! Hope it'll be merged asap. Thanks again! |
Perfect. I will close this issue when TinyUSB merges my pull request or something like it. |
Describe the bug
Tried the C-Example usb_midi_host and connected a Beat Step Pro, the device is recognized with 2 Midi Cables, but no midi data is received
To Reproduce
Steps to reproduce the behavior:
Screenshots
Logs:
Pico MIDI Host Example
MIDI opening Interface 1 (addr = 1)
MIDI opening Interface 1 (addr = 1)
MIDI descriptor parsed successfully
MIDI device address = 1, IN endpoint 1 has 2 cables, OUT endpoint 2 has 2 cables
What is your setup like?
The text was updated successfully, but these errors were encountered: