Skip to content
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

support issue - how to use #7

Open
stanelie opened this issue Jan 8, 2025 · 4 comments
Open

support issue - how to use #7

stanelie opened this issue Jan 8, 2025 · 4 comments

Comments

@stanelie
Copy link

stanelie commented Jan 8, 2025

Hello.
It's unclear to me how I should use this library. A thing I would like to do is use some randoms pins on a RP2040-zero as a USB host port to connect a midi keyboard that uses midi over USB, and then use sythio to generate some sounds.

Is this scenario something that I should be able to do with this? How do you specify which pins to use for the USB host connexion?

Thanks for any help!

@dglaude
Copy link

dglaude commented Jan 8, 2025

I am not sure about the "random pins" because they need to be consecutive for the PIO that does USB-Host on RP2040 to work.
Worst I don't know how to specify the pin to be used.

I would start with a supported board such as the Feather RP2040 with USB Host, or check what pin are used on that board https://learn.adafruit.com/adafruit-feather-rp2040-with-usb-type-a-host/pinouts

I am not sure how to replicate that on a RP2040-zero as the firmware does not define USB port such as in the Feather RP2040 USB Host:

{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_PLUS), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_MINUS), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_5V_POWER), MP_ROM_PTR(&pin_GPIO18) },

Or the Waveshare RP2040 PiZero:

{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_PLUS), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_MINUS), MP_ROM_PTR(&pin_GPIO7) },

I hope there is a dynamic way to define what pin to use, but I don't have the answer to that.

@stanelie
Copy link
Author

stanelie commented Jan 8, 2025

From the Adafruit Feather schematic here https://cdn-learn.adafruit.com/assets/assets/000/120/409/original/hacks_schem.png?1682345733 , I see the usb host pins only require an inline 22 ohm resistor to the connector. Is that it? I only need to add those resistors to my RP2040-zero and off I go, it should work?

Should this be in the documentation of this library? Or should it be stated that this library only works with the Feather?

@tannewt
Copy link
Member

tannewt commented Jan 8, 2025

Try it without the inline resistors. I've used it without.

Here is an example that sets up the USB host pins from CircuitPython: https://github.com/adafruit/circuitpython/blob/main/tests/circuitpython-manual/usb/device_info.py

Specifically:

h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM)

@stanelie
Copy link
Author

stanelie commented Jan 8, 2025

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants