Skip to content

Commit 4932950

Browse files
committed
RP2040: restore GPIO15 functionality after USB_DEVICE_ENUMERATION_FIX
1 parent a19a3d9 commit 4932950

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

targets/TARGET_RASPBERRYPI/TARGET_RP2040/USBPhy_RP2040.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern "C" {
3232

3333
#ifdef PICO_RP2040_USB_DEVICE_ENUMERATION_FIX
3434
#include "rp2040_usb_device_enumeration.h"
35+
#include "hardware/structs/iobank0.h"
3536
#endif
3637

3738
#ifdef __cplusplus
@@ -396,7 +397,13 @@ void USBPhyHw::process()
396397

397398
// This is required, but having trouble working out how to link in
398399
#ifdef PICO_RP2040_USB_DEVICE_ENUMERATION_FIX
400+
const uint dp = 15;
401+
auto function = gpio_get_function(dp);
402+
auto override = iobank0_hw->io[dp].ctrl;
399403
rp2040_usb_device_enumeration_fix();
404+
gpio_set_function(dp, function);
405+
gpio_set_inover(dp, GPIO_OVERRIDE_HIGH);
406+
hw_set_bits(&iobank0_hw->io[dp].ctrl, override);
400407
#endif
401408

402409
// reset bus for USBDevice layer

0 commit comments

Comments
 (0)