Skip to content

Conversation

@earlephilhower
Copy link
Owner

Using pico-sdk develop branch with minor patch, add in support for the CYW43-based WiFi boards on the RP2350.

Fixes #2608

Using pico-sdk develop branch with minor patch, add in support for the
CYW43-based WiFi boards on the RP2350.

Fixes #2608

Rolls in dynamic SPI divider #2600
@earlephilhower
Copy link
Owner Author

FWIW, this should now build on the RP2350+CYW43 boards (Pimoroni PicoPlus 2W and SparkFun Thing Plus RP2350) while also not breaking PicoW. SparkFun was nice enough to send a sample, so once that arrives final tweaks can be done.

On the bright side, it appears all boards are using the same CYW43 pin out. The SDK should allow for changing it per-board, but as of now there doesn't seem to be a need to exercise this.

This also pulls in #2600 since it is trivial and part of the refactoring done to support multiple CYW43 boards.

SDK builds in CI will fail until the next SDK release (and raspberrypi/pico-sdk#2045 gets merged).

Also move "special GPIO" to 64 since the Pimoroni Pico 2W uses the
RP2350B with 48 GPIOs.
@sfe-SparkFro
Copy link
Contributor

On the bright side, it appears all boards are using the same CYW43 pin out. The SDK should allow for changing it per-board, but as of now there doesn't seem to be a need to exercise this.

I haven't poked through the code changes, but does this statement imply there's no way to use a different radio pinout with this PR? I would request that to be a feature, because we have another product in the works that will use different pins (can't say anything more at this time).

@earlephilhower
Copy link
Owner Author

I haven't poked through the code changes, but does this statement imply there's no way to use a different radio pinout with this PR? I would request that to be a feature, because we have another product in the works that will use different pins (can't say anything more at this time).

No worries, it'll be configurable at runtime. CYW43_PIN_WL_DYNAMIC=1 in the CMakefile.txt should allow a calls to cyw43_hal_pin_config() in the board variant initializer before the cyw43_arch_init() call.

The default values, though, if the pins aren't redefined by calls to the pin_config process, are all the same as PicoW and the SparkFun and Pimoroni boards. So, as of now, there's no need to set anything and it "should" pick up the proper defaults everywhere.

@sfe-SparkFro
Copy link
Contributor

Ok, I had a play around with this PR and I got it working with different pins.

Turns out cyw43_set_pins_wl() is what's needed, not cyw43_hal_pin_config(). I put the following in my variant/init.cpp:

#include <cyw43_wrappers.h>
#include "pico/cyw43_driver.h" // Needed for cyw43_set_pins_wl()

extern "C" void initVariant() {
    static uint cyw43_pin_array[CYW43_PIN_INDEX_WL_COUNT] = {0, 1, 2, 3, 4, 5};
    cyw43_set_pins_wl(cyw43_pin_array);
    init_cyw43_wifi();
}

where {0, 1, 2, 3, 4, 5} is a placeholder for the actual radio pins.

The only major problem is that CYW43_PIN_WL_DYNAMIC defaults to 0, so cyw43_set_pins_wl() is not available to call. As a workaround, I just added #define CYW43_PIN_WL_DYNAMIC 1 to my variant/pins_arduino.h, though that's arguably not the right place for it.

@earlephilhower
Copy link
Owner Author

...I just added #define CYW43_PIN_WL_DYNAMIC...

It's set in the library build but should also be passed in as part of the makeboards extra flags so the IDE and P.IO will both get it. It'll be in the next push.

Allows calling `cyw43_set_pins_wl(cyw43_pin_array);` to redefine the
CYW43 hookup in the variant initialization.
@earlephilhower earlephilhower changed the title WIP - Support CYW43 boards on RP2350 Support CYW43 boards on RP2350 Nov 19, 2024
@earlephilhower
Copy link
Owner Author

earlephilhower commented Nov 19, 2024

I just received your sample board, @sfe-SparkFro , plugged it in 5 minutes ago, and everything "just works" now. Bluetooth, WiFi, PSRAM, and the LEDs (CYW43 attached and WS2812) all pass simple basic tests. Even RISC-V mode worked for WiFi and BT.

How anti-climactic! 😆

@earlephilhower earlephilhower merged commit e25d382 into master Nov 19, 2024
27 checks passed
@earlephilhower earlephilhower deleted the weefee branch November 19, 2024 18:28
@maxgerhardt
Copy link
Contributor

Awesome work!! I've just updated the PlatformIO integration and I can run the WiFi scan example on my Pimoroni Pico 2 W perfectly fine!

Beginning scan at 5001
Found 5 networks

                            SSID   ENC     BSSID         CH RSSI
                Vodafone Hotspot  NONE 72:54:25:XX:XX:XX  4  -65
               Vodafone Homespot  NONE 72:54:25:XX:XX:XX  4  -69
...

@earlephilhower
Copy link
Owner Author

Awesome, thanks for the report! I just used the schematic and they seemed to have chosen the exact same pinout as all the others.

Now to figure out what to do with a WiFi-enabled, 512K, dual core with FP board. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support multiple CYW43 driver configurations for RP2350

3 participants