-
Notifications
You must be signed in to change notification settings - Fork 178
Enable use of pins >32 on RP2350B #157
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
Conversation
|
I'll update this branch and make it work with the CI. What SDK versions need to be supported? I think SDK 2.1.0 may be required for some of the APIs used, so I can make them conditional if necessary. |
|
CI now runs against SDK 2.1.0 as well as older versions. |
Enable use of pins >32 on RP2350B
|
This has been updated with changes necessary to use RP2350 (A or B)'s PIO2 peripheral instance. Tested in CircuitPython. |
|
Thank you! |
|
I was asked by Adafruit - John Park to get my RP2350 NES emulator working using a gamecontroller connected to the usb break-out pins of the Adafruit Metro RP2350. (goal is to get it working on the upcoming Fruitjam board) As mentioned in here, these pins use GPIO29 for 5V, GPIO 32 for D+ and GPIO33 for D-. For starters i tried to get the host_hid_to_device_cdc example to work, but it doesn't. Maybe it's a small detail I'm missing. See https://github.com/fhoedemakers/Pico-PIO-USB for a stripped down example: In examples/host_hid_to_device_cdc/host_hid_to_device_cd.c I enabled 5volt to pin 29 in main() // Enable 5v power on USB port
gpio_put(29, 1);
gpio_set_dir(29, GPIO_OUT);
gpio_set_function(29, GPIO_FUNC_SIO);And changed the CMakeLists.txt in examples/host_hid_to_device_cdc # use tinyusb implementation
# Adafruit Metro RP2350 using built-in USB with D+ GPIO32, D- GPIO33 : not working
target_compile_definitions(${target_name} PRIVATE PIO_USB_USE_TINYUSB PIO_USB_DP_PIN_DEFAULT=32 PICO_PIO_USE_GPIO_BASE=1)
# Adafruit Metro RP2350 with External USB port on D+ GPIO 4, D- GPIO5 : working
#target_compile_definitions(${target_name} PRIVATE PIO_USB_USE_TINYUSB PIO_USB_DP_PIN_DEFAULT=4)As i can see from the code, i need to set PICO_PIO_USE_GPIO_BASE=1 in CMakeLists.txt in order for pio to use port 32 and 33. But i can't get this to work. When i connect an usb board with DP+ = GPIO4, DP- = GPIO 5. The example just runs fine: |
|
I will not be able to look into this anytime soon. I'm away from all my hardware, and taking a break from Adafruit work. Before starting on my break, in addition to working in circuitpython, it was working in at least 2 cmake-based fruit jam usb projects, https://github.com/adafruit/MCUME/tree/master/MCUME_pico2 and https://github.com/adafruit/pico-mac and an arduino fruit jam uisb project adafruit/Adafruit_Learning_System_Guides#2978 -- the git submodules & CI build rules Those were all working on fruit jam at the time I committed them, albeit often depending on some very specific combinations of libraries. there are clues/traces of information in the exact git submodules & ci scripts. Make sure you're using sdk 2.1.0 (or newer); on a quick review of this PR's code changes, it'd probably just silently fail if using an older SDK where some of the functions weren't available. It's also vaguely possible that some other sdk changes past 2.1.0 have broken things, so maybe try with exactly sdk 2.1.0. You might also try with this submodule at exactly 0.7.0 (first release with this change), 7f7ea5b (tip of PR branch) or 442af43 (this project main branch just after merging this PR) Good luck! |
|
Thanks for your quick response. I use 2.1.1 as SDK, but also tried 2.1.0 with no luck. I will look into the other projects how it's implemented. Thank you! |
|
I just tested with my metro rp2350 and it working just fine in my repo's example. sdk 2.1.1 may not include the latest pio-usb, make sure you use pio-usb with v0.7.2 and latest tinyusb (master branch, not tagged version). There is a lot of bug fixing for rp2350 with low speed device. |
|
Pulled the master branch from tiyusb and rebuilded all. Using pio-usb 0.7.2 Still no luck. Can you send me the .uf2 file to test it on my device? Are these the correct compile definitions in examples/host_hid_to_device_cdc/CMakeLists.txt? |
|
host_info_to_device_cdc.zip |
|
I tested the .uf2, got a blinking led on the board. Connecting a serial terminal to the built-in usb, does not show any keypresses. This is the output of git log for tinyusb: For PIO-USB I used the 0.7.2 from the releases page . |
|
How you set up metro rp2350, here is mine using host jumper cable. Example will print out device info via device interface your git hash look good, not sure what prevent you from getting it working with metro rp2350. |
|
Have the same setup. Usb Keyboard connected to usb header on metro using jumper cable (in stead of usb-storage in your picture) Connected the built-in usb-c ( device interface) to pc and use putty terminal emulator to connect to the com-port. There is nothing appearing on the terminal screen. Is the blinking led an indicator that's something wrong? |
|
in that example, blinky only changes for device interface. Can you try with another device, pull out and/or pull out and plug-in, the device may print the message before you open termianl or so. If you have another metro rp2350, maybe give it a try. Also can you take the picture of your board, just to check which revision that you got. I got an F revision |
|
Will try with another device. I also have another board. Will do this next Monday since I'm not at home till then. Will come back to you then asap. Thanks for your help. Much appreciated. |
|
Got some more time for testing. When i connect a sd-card reader, Sony Dual Sense or Sony Dual Shock controller, device info is shown. Connecting an USB keyboard (Cherry KC1000) or USB mouse (Raspberry Pi Mouse), the device is not detected and no info is shown. See below my device. As i can see from the picture it has also revision F, but with PSRAM. My other device is also an F-revision with PSRAM. As i can see from your device it has no PSRAM. I don't think this will make a difference. |
|
pio usb host work with high gpio, it just does not work well with certain low speed device. We have tried to solve some of the compatibility issue but not all #179 one of the isssue is errata GPIO-E9 which make get input GPIO complicated. For now, maybe you could try to test a few other mices to find which working and proceed with it. I also have an RPI mouse, I will try to test it out. |
|
Thanks, |





Tested on Adafruit Metro RP2350 prototype, which uses pins 32/33. Also requires some small changes to CircuitPython but never mind that :)
ping @ladyada
Closes: #133