Skip to content

Commit 3bb5c26

Browse files
committed
Swap PIO allocation of USB Host for better Pico W compatibility
Closes: #8359
1 parent 49d952c commit 3bb5c26

File tree

1 file changed

+4
-4
lines changed
  • ports/raspberrypi/common-hal/usb_host

1 file changed

+4
-4
lines changed

ports/raspberrypi/common-hal/usb_host/Port.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ usb_host_port_obj_t *common_hal_usb_host_port_construct(const mcu_pin_obj_t *dp,
122122
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
123123
pio_cfg.skip_alarm_pool = true;
124124
pio_cfg.pin_dp = dp->number;
125-
pio_cfg.pio_tx_num = 0;
126-
pio_cfg.pio_rx_num = 1;
127-
// PIO with room for 22 instructions
128-
// PIO with room for 31 instructions and two free SM.
125+
// Allocating the peripherals like this works on Pico W, where the
126+
// "preferred PIO" for the cyw43 wifi chip is PIO 1.
127+
pio_cfg.pio_tx_num = 1; // uses 22 instructions and 1 SM
128+
pio_cfg.pio_rx_num = 0; // uses 31 instructions and 2 SM.
129129
if (!_has_program_room(pio_cfg.pio_tx_num, 22) || _sm_free_count(pio_cfg.pio_tx_num) < 1 ||
130130
!_has_program_room(pio_cfg.pio_rx_num, 31) || _sm_free_count(pio_cfg.pio_rx_num) < 2) {
131131
mp_raise_RuntimeError(MP_ERROR_TEXT("All state machines in use"));

0 commit comments

Comments
 (0)