raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.62k stars 779 forks source link

blink does not blink on a Pico W #421

Open repentsinner opened 9 months ago

repentsinner commented 9 months ago

The Pico W 'hardware hello world' (aka blink) out-of-the-box experience is terrible as of sdk-1.5.1.

Please add at least an additional #warning if using a pico w, blink has moved to pico-examples/pico_w/wifi/blink in pico-examples\blink\blink.c. Preferred would be to update blink.c to include both the vanilla and W code paths. I suspect beginners to the Pico (W)(H) platform using the C SDK will be able to figure out what is going on, and it could be a good place to include some comments about other potential gotcha differences between the two boards.

The official overview documentation has a few W-specific notes; none of them describe the moved LED. It is only section 3.8 of the Pico W datasheet that gets around to rather dryly describing this move that then might point someone in the correct direction in the examples directory:

There are three GPIO pins from the CYW43439 that are used for other board functions and can easily be accessed via the SDK: [...] WL_GPIO0 OP connected to user LED

While truly the LED is now connected to the wireless chip and therefore pedantically sample code for it should be in the pico-examples/pico_w directory somewhere, I highly doubt anyone looking for blink cares about that distinction when looking for a first thing to run to figure out if their board is working at all. I strongly disagree that pico_w/**/blink should be under wifi or bt and the current location under wifi is nonsensical; what makes the user LED more wifi-ey than bt-ey? If anything, per the data sheet and pico/cyw43_arch.h, it should be in pico_w/cyw43/blink.

350 has drifted off topic to somewhat address this, but it seems like a new issue is more appropriate.

It seems fine that other RP2040 boards may need different instructions for their fancy RGB LEDs or whatever; the Pico W is a first party board and IMO should work out of the box with the guidance in the Getting Started With Pico document.

Thanks for considering!

lurch commented 9 months ago

@aallan I've just had another look at Chapter 3 of https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf and it has this boxout on page 9 Screenshot from 2023-09-17 15-01-15 but it's not very clear that the user actually needs to compile and build a different blink example program if they're using a Pico W board rather than a Pico board.

peterharperuk commented 9 months ago

Preferred would be to update blink.c to include both the vanilla and W code paths.

Yes, I forget how we got into this situation. We should probably do something as it seems to be causing confusion.

XeYaRiQu commented 6 months ago

@repentsinner Thank you for opening this issue as I am a beginner and have just experienced what you described. I followed with the "Getting Started with Raspberry Pi Pico" document and assumed that the Pico and Pico W were the same except for the addition of the WiFi/BT chip. Panicked for a moment thinking I had a defective Pico W.

aallan commented 6 months ago

This will be fixed in the next documentation release, where the two blink examples are explicitly addressed in the Getting Started book.