Raspberry Pi RP2040: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
[https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html Raspberry Pi Pico documentation]
=== Inventory ===
=== Inventory ===


Line 5: Line 7:
* 2x RPi Pico
* 2x RPi Pico
* Adafruit Feather RP2040
* Adafruit Feather RP2040
* [[Seeed Studio]] Sensecap D1 Indicator
* [[Seeed Studio]] [[SenseCAP Indicator]]
* Wiznet EVB hat for a Pico (ethernet)
* Wiznet EVB hat for a Pico (ethernet)
* Wiznet Pico WS5100S which is the Pico and ethernet on one board
* Wiznet Pico WS5100S which is the Pico and ethernet on one board
* [https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html Raspberry Pi Debug Module]
=== Other boards ===
There are many more than i could list. Like ones from Seeed Studio.
This is a neat redesign of the Pico board from Hackaday. https://dmytroengineering.com/content/projects/pro-pico It fixes problems with the original; it has a low noise voltage regulator, a better reference for the ADC, a USB-C connector.


== Development ==
== Development ==


Using a Pi as the dev platform is described here, [https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf RPI "getting started" doc]
=== Raspberry Pi Debug Probe ===
Setting up on Windows is not the same. See the C/C++ section below.
'''Port "U" is a serial port. Port "D" is the debugger port.'''
 
The [https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html Debug Probe] is an RP2040 in a cute little plastic box with a set of cables. Right now I have mine plugged into a Pico board that's plugged into a Grove board with 10 (!) Grove ports on it. I soldered the 3 pin header into the Pico and used the female cable to connect. I put the UART cable to UART0 on the Pico and confirmed serial port messages are showing up properly. The Pico has CircuitPython on it right now. I note there is also a compatible JST connector marked UART on Pi5. I will have to try using that as a console connection sometime.
 
''Next up'', I need to see the SWD port do something. I am going to set up Pi5 and use it for development as mentioned above.
 
=== Pi 5 for dev ===
''This is working as of 2024-Sept-15, yay!''
 
Using a Pi as the development platform is described here, [https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf RPI "Getting Started" pdf doc]  
 
Another useful [https://www.electronicshub.org/programming-raspberry-pi-pico-with-swd/ tutorial at Electronics Hub]
 
==== Install tools ====
This script installs tools and downloads and builds some tools and sample programs. I put it in Documents/ and it created the pico/ folder and told me to reboot for some reason, so I did.
 
wget <nowiki>https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh</nowiki>
 
Using the Electronics Hub instructions to build openocd myself goes like this, (installs into /usr/local/bin)
I think this is better because it uses the rp2040 branch, so I am trying it instead of the above. It is
perhaps an older version? .11 vs .12
Config files install into /usr/local/share/openocd/scripts
 
git clone <nowiki>https://github.com/raspberrypi/openocd.git</nowiki> --recursive --branch rp2040 --depth=1
cd openocd
./bootstrap
./configure --enable-ftdi --enable-sysfsgpio --enable-bcm2835gpio
OpenOCD configuration summary
--------------------------------------------------
MPSSE mode of FTDI based devices        yes
ST-Link Programmer                      yes (auto)
TI ICDI JTAG Programmer                yes (auto)
Keil ULINK JTAG Programmer              yes (auto)
ANGIE Adapter                          yes (auto)
Altera USB-Blaster II Compatible        yes (auto)
Bitbang mode of FT232R based devices    yes (auto)
Versaloon-Link JTAG Programmer          yes (auto)
TI XDS110 Debug Probe                  yes (auto)
CMSIS-DAP v2 Compliant Debugger        yes (auto)
OSBDM (JTAG only) Programmer            yes (auto)
eStick/opendous JTAG Programmer        yes (auto)
Olimex ARM-JTAG-EW Programmer          yes (auto)
Raisonance RLink JTAG Programmer        yes (auto)
USBProg JTAG Programmer                yes (auto)
Espressif JTAG Programmer              yes (auto)
CMSIS-DAP Compliant Debugger            no
Nu-Link Programmer                      no
Cypress KitProg Programmer              no
Altera USB-Blaster Compatible          yes (auto)
ASIX Presto Adapter                    yes (auto)
OpenJTAG Adapter                        yes (auto)
Linux GPIO bitbang through libgpiod    no
SEGGER J-Link Programmer                no
Bus Pirate                              yes (auto)
Use Capstone disassembly framework      no
make clean
make -j4
sudo make install
openocd
 
Open On-Chip Debugger 0.12.0+dev-gebec950 (2024-09-15-19:37)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
embedded:startup.tcl:28: Error: Can't find openocd.cfg in procedure 'script'
at file "embedded:startup.tcl", line 28
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: Debug Adapter has to be specified, see "adapter driver" command
embedded:startup.tcl:28: Error:
in procedure 'script'
at file "embedded:startup.tcl", line 28
 
==== Build a binary ====
 
cd ~/Documents/pico/pico-examples
cd build/hello_world/serial
make -j4
 
If the build succeeded there should be a hello_serial.elf file.
 
==== Run a binary ====
So, now I can try sending a binary to the Pico that's plugged in to the debug probe. You start openocd then you run gdb and it talks to the board through the debug probe.
 
If you set permissions properly you could ditch the 'sudo'; see the README for openocd. "Permissions delegation".
 
<code>sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "bindto 0.0.0.0"</code>
 
If you see this then the freaking connector on the SWD port is loose! '''LEDs should be lit up on the debug probe.'''
 
<code>Error: Failed to connect multidrop rp2040.dap0</code>
 
Once openocd is running, open another window, and run the program.
 
gdb hello_serial.elf
target remote localhost:3333
load
monitor reset init
continue
 
==== Using VS Code ====
This means running VS Code on [[Murre]] and running openocd on the Pi 5. I tried with [[Pearl]] and gave up. Using Windows as an embedded dev platform is just a pain.
 
===== In VS Code, =====
[[File:Screenshot from 2024-10-02 12-27-38.png|left|frameless|Pico Profile]]
Install the pico [https://code.visualstudio.com/docs/editor/profiles profile] from https://github.com/raspberrypi/pico-vscode/blob/HEAD/scripts/Pico.code-profile and the extensions you need will be installed into it for you. It's slow. When it's done, the left sidebar should have a Pico icon at the bottom for the Pico extension when the profile is active.
 
It launched a new window automatically after the profile was created.
 
I still could not get openocd running on Murre because there is no cmsis-dap driver. Oh well. There's still an 'external mode' mode for openocd in the launch.json. That means I have a Pi 5 used ONLY to run openocd. Oh well.<br clear="all" />
 
===== Install the build toolchain on Murre =====
This page has lots of gory details, kudos to them! Windows instructions but I press on using Murre anyway. https://www.circuitstate.com/tutorials/debugging-rp2040-pico-c-cpp-sdk-projects-using-raspberry-pi-debug-probe-and-vs-code/
 
See also, https://learn.arm.com/install-guides/gcc/cross/
 
Ultimate guide, https://github.com/raspberrypi/pico-sdk
 
apt install gcc-arm-none-eabi gcc-aarch64-linux-gnu
arm-none-eabi-gcc --version
apt install gdb-multiarch binutils-multiarch
# hack for Debian, https://forums.raspberrypi.com/viewtopic.php?t=333146
cd /usr/bin
sudo ln -s /usr/bin/objdump objdump-multiarch
sudo ln -s /usr/bin/nm nm-multiarch


=== Arduino ===
=== Arduino===


Seeed Studio suggests using Arduino to program the RP2040 in the Sensecap D1, but, meh, not an Arduino fan so I have not tried it yet.
Seeed Studio suggests using Arduino to program the RP2040 in the Sensecap D1, but, meh, not an Arduino fan so I have not tried it yet.


=== C/C++ in Windows + Visual Studio Code ===
===C/C++ in Windows + Visual Studio Code===


Tracking the [https://www.raspberrypi.com/news/raspberry-pi-pico-windows-installer/ official instructions],  
Tracking the [https://www.raspberrypi.com/news/raspberry-pi-pico-windows-installer/ official instructions],  
Line 26: Line 160:
[https://github.com/raspberrypi/pico-examples Examples for the Pico board] are in Github.
[https://github.com/raspberrypi/pico-examples Examples for the Pico board] are in Github.


=== Python ===
===FreeRTOS===
 
Since [https://freertos.org/index.html FreeRTOS] can be used on the ESP32 (on the SenseCap D1), and I should look at it for the RP2040 too.
 
===Python===
 
====Micropython====
See also the [[Micropython]] page for now.
 
====CircuitPython====


[https://circuitpython.org CircuitPython] -- make sure you download the correct version, for example,  
Download from [https://circuitpython.org CircuitPython] -- make sure you download the correct version, for example,  
the Rpi Pico version does not work on the Feather. Adafruit recommends you use the latest image,  
the [https://circuitpython.org/board/raspberry_pi_pico/ Rpi Pico] version does not work on the Feather (but does work on SenseCap). Adafruit recommends you use the latest beta image,  
not the stable one.
not the stable one.


General notes on VSCode. I gave up on Micropython because there was no working extension that I could find. In retrospect maybe I can get Pymakr going now that I have figured out CircuitPython.
General notes on VSCode. At one point I gave up on using VSCode with Micropython but last time I tried, it was fine.
Maybe I can get Pymakr extension going now that I have figured out CircuitPython.
 
When you fire up a CP board (any, regardless of who made it, if it runs CP), it will mount a drive and set up a serial port.
If you edit files it will automatically restart. Micropython uses a REPL instead of a drive so it's not as easy.
 
#Install CircuitPython on the board. (Power cycle with BOOT button held down then drag the UF2 file onto the drive.) It will reboot itself.
#Start Visual Studio Code.
#Select the board. There should be a way to do that from the bottom bar.
#Open a serial console, also in the bottom bar. You should see it's CircuitPython in the window.
#Open the folder.
#Edit the file code.py and save it. Saving will force reload the script and that should be visible in the console.
 
===== GPS AT6558=====
This is an [https://github.com/m5stack/m5-docs/blob/master/docs/en/unit/gps.md M5 Grove module]. The GPS receiver chip is the [https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/unit/AT6558_en.pdf AT6558] (You can tell it's M5 because of the fine little enclosure, Seeed boards tend to be naked.) I put the Pico on a Grove interface board and plugged in the GPS to the UART0 port. There is a crossbar so any port can do anything on the RP2040 so I have to initialize the port, it's marked UART0 on the board so I went with that (GP0,GP1)
 
Get the adafruit circuit python for your version of CP. Unzip it and put adafruit_gps.mpy in lib/ on the device.
 
<pre>
import board
import busio
import time
import digitalio
import adafruit_gps


When you fire up a CP board (any, regardless of who made it, if it runs CP), it will mount a drive and set up a serial port.
uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=9600, timeout=10)
If you edit files it will automatically restart.
gps = adafruit_gps.GPS(uart, debug=False)  # Use UART/pyserial
t = time.monotonic()


# Install CircuitPython on the board.
led = digitalio.DigitalInOut(board.LED)
# Plug in the board. (Power cycle it in other words.)
led.direction = digitalio.Direction.OUTPUT
# Start Visual Studio Code.
while True:
# Select the board. There should be a way to do that from the bottom bar.
    gps.update()
# Open a serial console, also in the bottom bar. You should see it's CircuitPython in the window.
    now = time.monotonic()
# Open the folder.
    if now - t < 1.0:
# Edit the file code.py and save it. Saving will force reload the script and that should be visible in the console.
        continue
    if not gps.has_fix:
        print("no fix")
        time.sleep(.5)
        led.value = True
        continue
    led.value = True
    #print(gps.datetime)
    print("{0:.6f}".format(gps.latitude),"{0:.6f}".format(gps.longitude), gps.altitude_m)
    print(gps.satellites, gps.pdop, gps.hdop)
    t = now
    led.value = False
</pre>


==== Crash recovery ====
====Crash recovery====


I wrote a CircuitPython script that my SenseCap did not like, and it stopped mounting the storage device so I could not edit it. I reflashed it with "flash_nuke.uf2".
I wrote a CircuitPython script that my SenseCap did not like, and it stopped mounting the storage device so I could not edit it. I reflashed it with "flash_nuke.uf2".


(hold down reset button + power up to get "root" storage device then drag and drop). This put it back in a pristine state and I was able to reinstall CircuitPython. Flash_nuke.uf2 has been added to my tool kit.
(Hold down the hidden reset button + power up to get a "root" storage device then drag and drop). This will put it back in a pristine state, wiping out your code.py file and forcing you to reinstall CircuitPython. Flash_nuke.uf2 has been added to my tool kit.


The program was one that tries to play a piano sample on the internal buzzer. It almost works.  
The errant program was one that tries to play an MP3 piano sample on the internal buzzer. It almost works. Lots of buzzing and clicking though.  


== Projects ==
== Projects==


=== Power management ===
===Power management===


The idea for this project is to manage a power strip or other interface that can  
The idea for this project is to manage a power strip or other interface that can  
Line 61: Line 240:
I want to define an API and talk to it exclusively via MQTT pub/sub messages.
I want to define an API and talk to it exclusively via MQTT pub/sub messages.


* Track the Ubiquiti link, and reset the link if the remote sites go offline. Can the UBNT do that on its own?
*Track the Ubiquiti link, and reset the link if the remote sites go offline. Can the UBNT do that on its own?
* Bring up power to the other components and shut down when not needed to save power.
*Bring up power to the other components and shut down when not needed to save power.
* Real time clock calibrated via SNTP
*Real time clock calibrated via SNTP
* Use hardware WDT to reset the Pico if it gets stuck.  
*Use hardware WDT to reset the Pico if it gets stuck.
* Monitor a UPS over the USB port.
*Monitor a UPS over the USB port.
* Monitor and reset the onboard ethernet hardware if it gets stuck.
* Monitor and reset the onboard ethernet hardware if it gets stuck.
* Configure IP settings in flash. Initial address is 192.168.100.1.
*Configure IP settings in flash. Initial address is 192.168.100.1.
* OTA flash updates
*OTA flash updates


The "other components" under control include a FlexRadio and a Windows computer.
The "other components" under control include a FlexRadio and a Windows computer.
Line 75: Line 254:
Power - Need a regulated clean supply to feed it 3v3 from 12v power.
Power - Need a regulated clean supply to feed it 3v3 from 12v power.


== Resources ==
==Resources==


=== Wiznet ===
===Wiznet===


https://www.hackster.io/news/wiznet-s-w5100s-evb-pico-clones-the-raspberry-pi-pico-but-adds-a-handy-ethernet-port-too-11125e568928
https://www.hackster.io/news/wiznet-s-w5100s-evb-pico-clones-the-raspberry-pi-pico-but-adds-a-handy-ethernet-port-too-11125e568928

Latest revision as of 22:03, 2 October 2024

Raspberry Pi Pico documentation

Inventory

These are RP2040 boards that I have right now.

Other boards

There are many more than i could list. Like ones from Seeed Studio.

This is a neat redesign of the Pico board from Hackaday. https://dmytroengineering.com/content/projects/pro-pico It fixes problems with the original; it has a low noise voltage regulator, a better reference for the ADC, a USB-C connector.

Development

Raspberry Pi Debug Probe

Port "U" is a serial port. Port "D" is the debugger port.

The Debug Probe is an RP2040 in a cute little plastic box with a set of cables. Right now I have mine plugged into a Pico board that's plugged into a Grove board with 10 (!) Grove ports on it. I soldered the 3 pin header into the Pico and used the female cable to connect. I put the UART cable to UART0 on the Pico and confirmed serial port messages are showing up properly. The Pico has CircuitPython on it right now. I note there is also a compatible JST connector marked UART on Pi5. I will have to try using that as a console connection sometime.

Next up, I need to see the SWD port do something. I am going to set up Pi5 and use it for development as mentioned above.

Pi 5 for dev

This is working as of 2024-Sept-15, yay!

Using a Pi as the development platform is described here, RPI "Getting Started" pdf doc

Another useful tutorial at Electronics Hub

Install tools

This script installs tools and downloads and builds some tools and sample programs. I put it in Documents/ and it created the pico/ folder and told me to reboot for some reason, so I did.

wget https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh

Using the Electronics Hub instructions to build openocd myself goes like this, (installs into /usr/local/bin) I think this is better because it uses the rp2040 branch, so I am trying it instead of the above. It is perhaps an older version? .11 vs .12 Config files install into /usr/local/share/openocd/scripts

git clone https://github.com/raspberrypi/openocd.git --recursive --branch rp2040 --depth=1
cd openocd
./bootstrap
./configure --enable-ftdi --enable-sysfsgpio --enable-bcm2835gpio

OpenOCD configuration summary
--------------------------------------------------
MPSSE mode of FTDI based devices        yes
ST-Link Programmer                      yes (auto)
TI ICDI JTAG Programmer                 yes (auto)
Keil ULINK JTAG Programmer              yes (auto)
ANGIE Adapter                           yes (auto)
Altera USB-Blaster II Compatible        yes (auto)
Bitbang mode of FT232R based devices    yes (auto)
Versaloon-Link JTAG Programmer          yes (auto)
TI XDS110 Debug Probe                   yes (auto)
CMSIS-DAP v2 Compliant Debugger         yes (auto)
OSBDM (JTAG only) Programmer            yes (auto)
eStick/opendous JTAG Programmer         yes (auto)
Olimex ARM-JTAG-EW Programmer           yes (auto)
Raisonance RLink JTAG Programmer        yes (auto)
USBProg JTAG Programmer                 yes (auto)
Espressif JTAG Programmer               yes (auto)
CMSIS-DAP Compliant Debugger            no
Nu-Link Programmer                      no
Cypress KitProg Programmer              no
Altera USB-Blaster Compatible           yes (auto)
ASIX Presto Adapter                     yes (auto)
OpenJTAG Adapter                        yes (auto)
Linux GPIO bitbang through libgpiod     no
SEGGER J-Link Programmer                no
Bus Pirate                              yes (auto)
Use Capstone disassembly framework      no

make clean
make -j4
sudo make install
openocd
Open On-Chip Debugger 0.12.0+dev-gebec950 (2024-09-15-19:37)
Licensed under GNU GPL v2
For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

embedded:startup.tcl:28: Error: Can't find openocd.cfg in procedure 'script' 
at file "embedded:startup.tcl", line 28
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: Debug Adapter has to be specified, see "adapter driver" command
embedded:startup.tcl:28: Error: 
in procedure 'script' 
at file "embedded:startup.tcl", line 28

Build a binary

cd ~/Documents/pico/pico-examples
cd build/hello_world/serial
make -j4

If the build succeeded there should be a hello_serial.elf file.

Run a binary

So, now I can try sending a binary to the Pico that's plugged in to the debug probe. You start openocd then you run gdb and it talks to the board through the debug probe.

If you set permissions properly you could ditch the 'sudo'; see the README for openocd. "Permissions delegation".

sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "bindto 0.0.0.0"

If you see this then the freaking connector on the SWD port is loose! LEDs should be lit up on the debug probe.

Error: Failed to connect multidrop rp2040.dap0

Once openocd is running, open another window, and run the program.

gdb hello_serial.elf
target remote localhost:3333
load
monitor reset init
continue

Using VS Code

This means running VS Code on Murre and running openocd on the Pi 5. I tried with Pearl and gave up. Using Windows as an embedded dev platform is just a pain.

In VS Code,
Pico Profile
Pico Profile

Install the pico profile from https://github.com/raspberrypi/pico-vscode/blob/HEAD/scripts/Pico.code-profile and the extensions you need will be installed into it for you. It's slow. When it's done, the left sidebar should have a Pico icon at the bottom for the Pico extension when the profile is active.

It launched a new window automatically after the profile was created.

I still could not get openocd running on Murre because there is no cmsis-dap driver. Oh well. There's still an 'external mode' mode for openocd in the launch.json. That means I have a Pi 5 used ONLY to run openocd. Oh well.

Install the build toolchain on Murre

This page has lots of gory details, kudos to them! Windows instructions but I press on using Murre anyway. https://www.circuitstate.com/tutorials/debugging-rp2040-pico-c-cpp-sdk-projects-using-raspberry-pi-debug-probe-and-vs-code/

See also, https://learn.arm.com/install-guides/gcc/cross/

Ultimate guide, https://github.com/raspberrypi/pico-sdk

apt install gcc-arm-none-eabi gcc-aarch64-linux-gnu
arm-none-eabi-gcc --version
apt install gdb-multiarch binutils-multiarch
# hack for Debian, https://forums.raspberrypi.com/viewtopic.php?t=333146
cd /usr/bin
sudo ln -s /usr/bin/objdump objdump-multiarch
sudo ln -s /usr/bin/nm nm-multiarch

Arduino

Seeed Studio suggests using Arduino to program the RP2040 in the Sensecap D1, but, meh, not an Arduino fan so I have not tried it yet.

C/C++ in Windows + Visual Studio Code

Tracking the official instructions, I ran their installer for Windows.

The examples end up in Documents/Pico*. Examples for the Pico board are in Github.

FreeRTOS

Since FreeRTOS can be used on the ESP32 (on the SenseCap D1), and I should look at it for the RP2040 too.

Python

Micropython

See also the Micropython page for now.

CircuitPython

Download from CircuitPython -- make sure you download the correct version, for example, the Rpi Pico version does not work on the Feather (but does work on SenseCap). Adafruit recommends you use the latest beta image, not the stable one.

General notes on VSCode. At one point I gave up on using VSCode with Micropython but last time I tried, it was fine. Maybe I can get Pymakr extension going now that I have figured out CircuitPython.

When you fire up a CP board (any, regardless of who made it, if it runs CP), it will mount a drive and set up a serial port. If you edit files it will automatically restart. Micropython uses a REPL instead of a drive so it's not as easy.

  1. Install CircuitPython on the board. (Power cycle with BOOT button held down then drag the UF2 file onto the drive.) It will reboot itself.
  2. Start Visual Studio Code.
  3. Select the board. There should be a way to do that from the bottom bar.
  4. Open a serial console, also in the bottom bar. You should see it's CircuitPython in the window.
  5. Open the folder.
  6. Edit the file code.py and save it. Saving will force reload the script and that should be visible in the console.
GPS AT6558

This is an M5 Grove module. The GPS receiver chip is the AT6558 (You can tell it's M5 because of the fine little enclosure, Seeed boards tend to be naked.) I put the Pico on a Grove interface board and plugged in the GPS to the UART0 port. There is a crossbar so any port can do anything on the RP2040 so I have to initialize the port, it's marked UART0 on the board so I went with that (GP0,GP1)

Get the adafruit circuit python for your version of CP. Unzip it and put adafruit_gps.mpy in lib/ on the device.

import board
import busio
import time
import digitalio
import adafruit_gps

uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=9600, timeout=10)
gps = adafruit_gps.GPS(uart, debug=False)  # Use UART/pyserial
t = time.monotonic()

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
    gps.update()
    now = time.monotonic()
    if now - t < 1.0:
        continue
    if not gps.has_fix:
        print("no fix")
        time.sleep(.5)
        led.value = True
        continue
    led.value = True
    #print(gps.datetime)
    print("{0:.6f}".format(gps.latitude),"{0:.6f}".format(gps.longitude), gps.altitude_m)
    print(gps.satellites, gps.pdop, gps.hdop)
    t = now
    led.value = False

Crash recovery

I wrote a CircuitPython script that my SenseCap did not like, and it stopped mounting the storage device so I could not edit it. I reflashed it with "flash_nuke.uf2".

(Hold down the hidden reset button + power up to get a "root" storage device then drag and drop). This will put it back in a pristine state, wiping out your code.py file and forcing you to reinstall CircuitPython. Flash_nuke.uf2 has been added to my tool kit.

The errant program was one that tries to play an MP3 piano sample on the internal buzzer. It almost works. Lots of buzzing and clicking though.

Projects

Power management

The idea for this project is to manage a power strip or other interface that can control other equipment including load shedding and watchdog restarts. I want to define an API and talk to it exclusively via MQTT pub/sub messages.

  • Track the Ubiquiti link, and reset the link if the remote sites go offline. Can the UBNT do that on its own?
  • Bring up power to the other components and shut down when not needed to save power.
  • Real time clock calibrated via SNTP
  • Use hardware WDT to reset the Pico if it gets stuck.
  • Monitor a UPS over the USB port.
  • Monitor and reset the onboard ethernet hardware if it gets stuck.
  • Configure IP settings in flash. Initial address is 192.168.100.1.
  • OTA flash updates

The "other components" under control include a FlexRadio and a Windows computer. Incidentally -- both the full Raspberry Pi and the Intel NUC have built in hardware WDT.

Power - Need a regulated clean supply to feed it 3v3 from 12v power.

Resources

Wiznet

https://www.hackster.io/news/wiznet-s-w5100s-evb-pico-clones-the-raspberry-pi-pico-but-adds-a-handy-ethernet-port-too-11125e568928

Wiznet did a WiFi + Pico EVB, too, but I can't find it for sale anywhere. https://github.com/Wiznet/WizFi360-EVB-Pico-C/blob/main/getting_started.md

The CircuitPython page for the Wiznet Pico is here https://circuitpython.org/board/wiznet_w5100s_evb_pico/

Sample code: https://github.com/Wiznet/RP2040-HAT-CircuitPython