rp-rs / rp-hal

A Rust Embedded-HAL for the rp series microcontrollers
https://crates.io/crates/rp2040-hal
Apache License 2.0
1.44k stars 234 forks source link

blinky not working on LED but every other GPIO (rp_pico) #515

Closed kawogi closed 1 year ago

kawogi commented 1 year ago

After successfully flashing the pico_blinky example to the Pico W, the LED remained off. I got the same result using pico_pwm_blink.

For any other port (I modified blinky to run on all available gpios), the example worked perfectly fine. I probed on TP5, the LED connections and the resistor R3, but I could not find any level other than 0V. The LED itself is ok (lights up when powering through a diode tester) and the resistor measures 470 Ohm.

Other than just being a hardware fault: Is there any other plausible explanation why GPIO25 cannot be controlled? Is there something special with it? Should the LED light up due to other circumstances that are independent of the flashed program (e.g. programming)?

9names commented 1 year ago

The LED is not connected to rp2040 on Pico W, it is connected to the Wifi chip. So the only way to turn it on is to upload firmware to that chip, and send it a command.

9names commented 1 year ago

See also https://github.com/rp-rs/rp-hal/issues/376 @jannic has a work-in-progress Pico W BSP with a blinky program. It requires the nightly compiler to use it https://github.com/jannic/rp-hal/blob/pico-w/boards/rp-pico-w/examples/pico_w_blinky.rs

jannic commented 1 year ago

It requires the nightly compiler to use it

No longer true, it works on stable rust.

However, it still depends on some unreleased versions of embassy crates, so it's not yet ready to be merged into main. (And it needs some polishing.)

kawogi commented 1 year ago

The LED is not connected to rp2040 on Pico W, it is connected to the Wifi chip.

Oh looks like an rtfm problem from my side, then. Thanks for pointing out. I just didn't expect the pinout to be different in this point.

@jannic That's great news, thanks for this!

I wonder however, whether/how the pico and pico_w examples and pin configurations should be organized. Will the pico_w source become a 90 % clone of the pico? I think most examples will just run fine on both platforms. The led pin however should not be mapped for the pico_w.

jannic commented 1 year ago

Will the pico_w source become a 90 % clone of the pico? I think most examples will just run fine on both platforms.

Probably yes. The same is true for most of the rp2040 based boards: Many are quite similar.