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-E5 fix needs tinyusb_additions added to CMakeLists.txt #759
Comments
@kilograham @liamfraser FYI in case you hadn't already seen it. |
I'm not 100% sure where you are asking for this to be added? What "docs/examples" are you referring to. Note that the fix is not the default, as it takes control of GPIO 15, and 16 briefly, so you have to know you are allowed to do that. |
The datasheet shows the E5 errata and points to https://github.com/raspberrypi/pico-sdk/tree/master/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/rp2040_usb_device_enumeration.c as the workaround. It doesn't say that you need to specifically enable it or how to enable it. Nothing in https://github.com/raspberrypi/pico-examples mentions it either. What is the approved method for enabling the E5 workaround? Do you add the tinyusb_additions library or manually set the define? If you set a define, which one do you set? |
I had missed the part that this uses GPIO 15/16. Brief explanation what happens and when would be helpful. I ran into this "enumeration" issue recently and adding following into CMakeLists.txt seemed to work fine (on a RP2040-B1):
I'm using GPIO 15 for PWM input and GPIO 16 for PWM output, so presumably I might see short interruption on PWM output, etc? But presumably this would happen only when USB cable is plugged in (or could this happen if there is USB "bus reset" etc?) |
Correct; just adding actually only GPIO 15 is affected. it happens on any bus reset. |
See also raspberrypi/pico-examples#210 |
Thanks! |
The RP2040-E5 fix needs TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX to be set for tinyusb to call rp2040_usb_device_enumeration_fix() during the IRQ handler. TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX is defined by PICO_RP2040_USB_DEVICE_ENUMERATION_FIX and that is set in the RP2040 family cmake file as part of the tinyusb_additions library. The docs/examples don't have tinyusb_additions in the target_link_libraries list or use family_configure_* which adds tinyusb_additions so pico_fix/rp2040_usb_device_enumeration is compiled as part of the SDK but never used by tinyusb.
There is a thread on the Pi forum where the RP2040-E5 issue has was causing problems. Explicitly setting TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX was found to workaround the issue so pointed at the fix not being used.
Proposed fix would be to add tinyusb_additions to target_link_libraries as family_configure_* does other things. If there is a cleaner way of setting that flag then that would also work.
The text was updated successfully, but these errors were encountered: