Skip to content

Commit 00824ad

Browse files
authored
Merge pull request micropython#8922 from jepler/rp2040-usb-static-state-machine
Swap PIO allocation of USB Host for better Pico W compatibility
2 parents 8291467 + 3bb5c26 commit 00824ad

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy