LoginSignup
6

More than 1 year has passed since last update.

BOOTSELボタンでLチカ【Raspberry Pi Pico W】

Last updated at Posted at 2022-08-29

ezgif-1-e212f3d6c5.gif

Raspberry Pi Pico Wの開発環境構築はこちら

main.py
import time
    
while True:
    if rp2.bootsel_button() == 1:
        machine.Pin('LED', machine.Pin.OUT).on()
    else:
        machine.Pin('LED', machine.Pin.OUT).off()
    time.sleep(0.1)

image.png

Raspberry Pi Pico Wのカスタムファームウェアを用意しました。
https://github.com/GitHub30/micropython/blob/GitHub30-patch-1/firmware.uf2

Ubuntuでカスタムファームウェアをビルドすることもできます。
# https://www.cnx-software.com/2022/07/03/getting-started-with-wifi-on-raspberry-pi-pico-w-board/#using-wifi-on-raspberry-pi-pico-w-with-c-programming
sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential

# https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf
mkdir picow
cd picow
git clone https://github.com/GitHub30/micropython
git clone https://github.com/micropython/micropython-lib

cd micropython
git checkout rp2-bootsel
# https://forums.raspberrypi.com/viewtopic.php?t=304620
git submodule update --init lib/pico-sdk lib/tinyusb
make -C ports/rp2 BOARD=PICO_W submodules
make -C mpy-cross
cd ports/rp2
make BOARD=PICO_W
# build-PICO_W/firmware.uf2にカスタムファームウェアが作成されます。

変更箇所
https://github.com/micropython/micropython/pull/9134/files

ファームウェア書き込み以外にBOOTSELボタンの近い道が広がりそうです

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6