Stephen Smith's Blog

Musings on Machine Learning…

Introducing the Raspberry Pi Pico W

leave a comment »


Introduction

At the end of June, the Raspberry Pi foundation released a new version of the Raspberry Pi Pico that includes a wireless communications chip. This new Pico is named the Raspberry Pi Pico W and only costs $2 more than the base Pico. Basically, they added an Infineon CYW43439 chip which supports Wifi and Bluetooth, though only Wifi is supported through the SDK currently. Thus the Raspberry Pi Pico W is a true IoT (Internet of Things) chip, not requiring a physical connection to communicate.

Several other vendors have already added Wifi and Bluetooth in their independent RP2040 based boards. We reviewed the SeeedStudio Wio RP2040 here.

Compatibility

The hardware designers at Raspberry worked hard to add this wireless chip without affecting people’s existing applications. This meant they couldn’t use any of the exposed GPIO connectors. They also didn’t want to release a new version of the RP2040 chip, so they had to use a connection that was already exposed. The choice they made to minimize impact on people’s existing projects was to take over the connector that was previously used to control the Pico’s onboard LED. The reasoning being that flashing the onboard LED couldn’t be too important to people’s projects. You can still access the LED, but it is now wired to a pin on the CYW43439 chip and you need to go through the CYW43 device driver included in the Pico’s SDK. To blink the LED you need to initialize the high level driver:

    cyw43_arch_init()

Then you can set the LED high or low with:

    cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_state);

To make room for the new chip, a few things on the board have been moved around, notably the debug pins are now in the middle of the board rather than at the edge. When wiring the Pico W up, make sure you use the “Getting Started” guide for the Pico W, which contains the correct diagrams.

Programming the Pico W

The Pico W was added as the pico_w board type in the SDK. By default the RP2040 SDK will build for a regular Pico, so if you want wireless functionality you need to add “-DPICO_BOARD=pico_w” to your cmake command:

    cmake -DPICO_BOARD=pico_w -DCMAKE_BUILD_TYPE=Debug ..

Then pico_w.h from the boards/include/boards folder will be used and you have access to all the wireless features.

The documentation in the SDK is still a bit thin on the new features, but the SDK examples are a great source on how to do something, as working code is better than a dry API reference.

Wireless Interface

The Infineon CYW43439 uses an SPI interface to communicate with the RP2040. The RP2040 chip contains hardware to handle SPI communications; however, the Pico W cannot use these since they are connected to GPIO pins exposed externally. Raspberry didn’t want to reduce the number of GPIO pins, so instead they chose to use the programmable I/O processors (PIO)  to handle the communications. I imagine this will be a problem for anyone already using PIO in their projects as the program memory for PIO is only 32 instructions. There seems to be a #define in the SDK to use PIO for this, but I don’t see any support for not using this if you turn it off.

The CYW43 chip supports Bluetooth, but that support isn’t in the Pico’s SDK yet. There are already lots of examples of using various internet protocols to perform tasks like transmitting weather data to a web server to display on web pages. There is support for both C and MicroPython.

The source code for the CYW43 driver and any other aspects are all included with the SDK. Infineon has good documentation for their chip if you want to get into the details.

Pico H

Raspberry also officially released the Pico H and Pico WH which are just a Pico and Pico W with pre-soldered headers. If you are using a breadboard and want to save some soldering, I would recommend getting these versions.

Summary

It’s great to see Raspberry producing a version of the Pico with built-in wireless capability for true IoT applications. At this point the SDK is still being filled out, but there is plenty there to get you started. Too bad they couldn’t use the RP2040’s SPI hardware and instead use PIO for this, I enjoy using PIO and would rather it was left all for me. I predict the Raspberry Pi Pico WH will become the most popular Pico model.

Written by smist08

August 26, 2022 at 11:29 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: