Raspberry Pico 2W (RP2350) onboard LED

Hi,

I’m using this platformio.ini:

[env:rpipicow]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico2w
framework = arduino
board_build.core = earlephilhower
monitor_speed = 115200

and this main.cpp (onboard LED not working):

#include <Arduino.h>

int led_pin = LED_BUILTIN;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  delay(1000);
  Serial.println("Hello, World!");
  pinMode(led_pin, OUTPUT);
}

void loop() {
  digitalWrite(led_pin, HIGH);
  delay(1000);
  digitalWrite(led_pin, LOW);
  delay(1000);
}

I tested with Pico SDK and I can confirm that the LED is working. So, it is something about Arduino SDK. Is this currently working with the Arduino SDK?

If I recall correctly the LED pin is supposed to be GPIO0 on Pico 2W. In my code LED_BUILTIN is 25u.

The LED is connected to the CYW43xxx WiFi chip, it is not accessible from the RP2350’s GPIO pins.

The Arduino core defines LED_BUILTIN to be 64 for the Raspberry Pi Pico 2W and then redirects calls from digitalWrite to cyw43_arch_gpio_put for all GPIO pins >= 64 (source).

The above code should work, even though the type int is wrong for the pin, it should be pin_size_t.

Can you try deleting all C:\Users\<user>\.platformio\raspberrypi* folders and re-upload?

Does the USB serial work? Try adding a Serial.println("Blink"); in setup(), too.

1 Like

It’s working now, thank you. I’m on a Mac and I had to delete:
rm ~/.platformio/platforms/raspberrypi

This is the platformio.ini configuration that works:

[env:rpipicow]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico2w
framework = arduino
board_build.core = earlephilhower
monitor_speed = 115200

For others who are reading this, don’t forget to set the monitor speed to 115200. → Serial.begin(115200);