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
RP2040 MIDI host #1605
RP2040 MIDI host #1605
Conversation
Added descriptive strings for edpt_dir and edpt_type
Added support for allocating hw_endpoints for non-interrupt endpoints. Allow endpoints to be used in either direction by updating bit checks.
Comment out usbh_edpt_force_last_buffer for now Change usbh_edpt_open to tuh_edpt_open
Hi! git clone https://github.com/atoktoto/tinyusb tinyusb-atoktoto
cd tinyusb-atoktoto
git checkout midihost-atoktoto
git submodule update --init lib
cd examples/host/midi
make BOARD=raspberry_pi_pico get-deps
make BOARD=raspberry_pi_pico all And I get the error:
Okay, perhaps you're assuming you must have make BOARD=raspberry_pi_pico LOG=2 all and now the error I get is: <command-line>: error: "CFG_TUSB_DEBUG" redefined [-Werror] Well, I can go back to doing a normal build and just insert a [...]/tinyusb-atoktoto/src/host/usbh.c: In function 'tuh_task_ext.part.0':
[...]/tinyusb-atoktoto/src/host/usbh.c:478:41: error: array subscript 1 is above array bounds of 'uint8_t[1][2]' {aka 'unsigned char[1][2]'} [-Werror=array-bounds]
478 | uint8_t drv_id = dev->ep2drv[epnum][ep_dir];
| ~~~~~~~~~~~^~~~~~~ Am I doing something wrong? Can you please share the build steps you're using? |
Not sure if that's the source of the problem but the way I have it set up is the same as described by the original author of this merge request: https://github.com/rppicomidi/midi2usbhost ( "Using the forked tinyusb library" ) The top level directory for me is pico-examples. The CMakeLists.txt there adds the examples from tinyusb. I will test starting from empty directory later today. |
Here is a stripped down project created from the example: https://github.com/atoktoto/pico-midi-host |
@atoktoto In case you are interested, my fork of this project has a new branch pio-midihost that supports the Pico-PIO-USB as a host. I have a demo project pico-usb-midi-filter that passes MIDI data between the built-in USB configured as a device and a new USB Host port created from PIO. I suspect I duplicated some of your work in this pull request in my fork. |
@rppicomidi Is the Pico-PIO-USB a way to go over the dedicated hardware? Why? I've used the branch you mentioned, applied #1434 and it seems to work without PIO. I think I will re-create this merge request with your changes and #1434. |
@atoktoto I agree #1434 seems to work. I am not arguing against your pull request. Thank you for doing the work. The pico-usb-midi-filter project uses a single Pico board to implement a bi-directional MIDI filter between a MIDI USB host (which I implemented using PIO from the Pico-PIO-USB project) and a MIDI USB device (which I implemented using the Pico's dedicated USB hardware). My comment was only wishing I had looked here before I did a lot of the same work you did. |
Describe the PR
This PR adds MIDI host support for RP2040 boards based on work done by @rppicomidi in #1219 and @Skyler84 in #1434. I rebased all changed on top of master and fixed some compilation errors.
MIDI controller (behringer x-touch mini) enumerates and the data is received.
Creating this pull request as a draft for comments. I'm very new at this and I'm kind of surprised that it works :D