Search code examples
raspberry-pimicropythonadafruit-circuitpythonsparkfunrp2040

SparkFun RP2040 and MicroPython


I am a software engineer working on a microcontroller system for a side project. The microcontroller I am using is the SparkFun ProMicro (based on the RP2040 board). I am trying to flash the board so that I can write data to the onboard flash memory.

All of the tutorials I have found online suggest starting in boot mode, dragging and dropping the UF2 file, and done!

When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

Once I got MicroPython installed I moved on to writing and flashing code to the board.

I am using the Thonny IDE which identified the correct board (albeit the PICO), then saved the following file as main.py (taken from RPI foundation). It prints toggle, and I believe the output shows that it is being printed from the board, but the light on the board isn't blinking. (code and output below)

I considered that the pinout could be different from this board and the PICO, but some research shows they both use Pin 25 for the LED control.

All this leads me to believe I am on the right path, but I think I am missing something that is taken for granted in the tutorials. My end goal is to write arbitrary text data to flash storage, but I understand it can only take about 8000-10,000 writes before it becomes unreliable, so I want to test that I can write working code before I use some of those.

Is there something I am missing, or am I not thinking about this in the right way?

Output


Solution

  • When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

    Yep.

    but the light on the board isn't blinking.

    Maybe your LED is busted, cause your code is right.

    My end goal is to write arbitrary text data to flash storage

    That's a terrible idea, unless you just like burning up boards for no good reason. Get an SD Card reader or concoct one out of a solution like this one, and use this sdcard library that will even mount your card, and add it to the syspath. Then you can essentially write all the arbitrary text data you like without burning up your RP2040.