In the latest issue of The MagPi, senior principal hardware engineer Dominic Plunkett and software engineer Liam Fraser reveal all about Pico W.
Adding wireless functionality to the ultra-small form-factor of Pico W was no easy task. “There was a big question about physical space,” says Dominic Plunkett, senior principal hardware engineer at Raspberry Pi. “About whether we could get the wireless chip and the antenna on Pico.”
A particular challenge was how to keep the GPIO pins and accommodate Infineon’s CYW43439 technology. A problem that was avoided with some clever re-routing. “We could have potentially lost the bottom two GPIO pins on each side,” he remarks. “We need four GPIO pins to control the wireless LAN.”
Finding a shape
Removing the GPIO pins around the antenna was tempting because it would free up space: “Antennas like space,” explains Dominic while showing us the trapezoidal-shaped feature. “And getting rid of the bottom GPIO pins would have made it easier to connect the wireless chip,” but it would have been a huge change for current users. “I didn’t want to lose any of the peripheral GPIO pins to the end-user,” says Dominic. People can add Pico W to an existing project without having to change anything and gain instant access to wireless technology.
“There was a lot of work to evaluate different antenna shapes and patterns to fit in the space, and to come up with the correct balance,” says Dominic. This is one reason why the three debug pins moved from the edge of the board to a more central location: to make space for the antenna and prevent them from interfering with the wireless connection.
“After a bit of head-scratching and a long weekend of adding some secret extra resistors, we got away with using three pins to control the wireless LAN. So the three pins we’ve taken are the LED, power supply mode select, and the VBUS detect, and you get those back through the wireless LAN chip. It has some GPIOs which then go back to control the LED and power supply.
“It is a fine solution,” affirms Dominic. “A lot of people don’t use these pins. Maybe, on the first day, you might use the LED, but very quickly you go on to doing things with the I/O pins and that’s why I felt it was important to try and make sure they have the existing I/O and that it was the same.”
Muxing it up
Implementation of the new design was a challenge, as Liam Fraser, software engineer, outlines: “I do both chip design and software engineering.
“Traditionally, wireless LAN on Raspberry Pi is done over SDIO, which is the same interface as the microSD card. However, SPI lets you do it in fewer pins and then we’ve got muxing on the pins to make all of that fit into just the three pins.
“We are amongst the first to use the SPI mode,” explains Liam. “One of the challenges was to come up with a code base that worked for MicroPython and Pico SDK,” he tells us. “The Infineon supplied code required lots of libraries to be pulled in and only worked with FreeRTOS, which is not suitable for Pico SDK or MicroPython.”
But it turned out that MicroPython already had a wireless LAN driver for a similar Infineon chip. “We were able to take that code and extend it to use this new SPI method,” reveals Liam. That provided a base for the MicroPython driver and a Pico SDK driver. “So that’s what we’re launching with,” says Liam.
“It’s implicitly muxed,” explains Dominic. When either the RP2040 or the Infinion 43439 aren’t driving the pins then other elements have priority. “Muxing is done with some resistors,” he tells us.
“There are some nice MicroPython libraries you can use, like requests. So if you want to talk to a REST API, it’s quite easy to do that in MicroPython. You just say ‘connect to my access point’ and once connected, you can send and receive data.
“The main thing we’ve been using at the moment is iPerf, which is network speed testing. It’s been good for us to see how well the device performs with different code and also stress it as much as possible and make sure it’s reliable.”
The potential for wireless projects is vast. You can do “anything from remote temperature sensing, logging, power usage around the house,” says Dominic: “anything, really”.
“You can even run small web servers on them,” adds Liam. “So if you want a basic web page where you click a button to set or get a GPIO pin, then that’s possible.”
What about Pico WH?
Pico WH is a Pico W with a plastic header attached to make prototyping and connecting to accessories easier. This is in development because it requires some further design changes. The plastic header shrouds hold the sides, and that takes up even more space. And because Pico WH has a different debug connector – vertical rather than horizontal – this will need redesigning to work with the new serial debug pins on Pico W.
“Pico WH is on its way, but is not available yet,” Dominic tells us.
The MagPi #119 out NOW!
You can grab the brand-new issue right now from Tesco, Sainsbury’s, Asda, WHSmith, and other newsagents, including the Raspberry Pi Store in Cambridge. You can also get it via our app on Android or iOS. And there’s a free PDF you can download too.
You can also subscribe to the print version of The MagPi. Not only do we deliver it globally, but people who sign up to the twelve-month print subscription get a FREE Raspberry Pi Zero Pico W!