0

Feather RP2040, does MicroPython work?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather RP2040, does MicroPython work?

by jbeale on Sat Apr 17, 2021 5:53 pm

I just got the Adafruit Feather RP2040 https://www.adafruit.com/product/4884 and I do see the color-cycling LED when connected to USB.
According to its Adafruit product page referenced above, this device has an "official MicroPython port" with link to https://github.com/raspberrypi/micropython
however that link goes nowhere (404 - page not found).

Up until now, I have been using the Raspberry Pi Pico with the micropython .uf2 file from https://micropython.org/download/rp2-pico/
As of today the latest version is rp2-pico-20210417-unstable-v1.14-172-gf842a40df.uf2
however that file does not work on the Feather RP2040. As soon as the .uf2 is dropped on the device in bootloader mode, it goes away, and it does not come back as any kind of USB device. The older file https://micropython.org/resources/firmw ... -v1.14.uf2 does work, but it lacks features I'm using, like the "array" module.

Is there a version of MicroPython recommend for use the Feather RP2040 (as opposed to CircuitPython) ?

jbeale
 
Posts: 36
Joined: Sat Nov 13, 2010 3:34 am

Re: Feather RP2040, does MicroPython work?

by jbeale on Sat Apr 17, 2021 5:59 pm

Update: maybe the latest 'unstable' version from micropython.org just has a bug. I was able to get "rp2-pico-20210328-unstable-v1.14-122-g9fef1c0bd.uf2" to work and that has the features I've been using, so I'm good for now.

jbeale
 
Posts: 36
Joined: Sat Nov 13, 2010 3:34 am

Re: Feather RP2040, does MicroPython work?

by jbeale on Sat Apr 17, 2021 8:34 pm

Update2: Trying this with the second Feather RP2040 I got, it appears that I cannot simply download the same .uf2 that worked on the first board. I first have to transfer the released (non-"unstable") rp2-pico-20210202-v1.14.uf2 version to the board, boot that, and only THEN do the bootsel-replug maneuver again and download the rp2-pico-20210328-unstable-v1.14-122-g9fef1c0bd.uf2 version I wanted to use. At least, that is how it looks, because when I tried to load the 20210328-unstable-v1.14 file as my first step out of the package it did not show up as a device; I tried several times.

This is unexpected to say the least, but I'm not experienced with MicroPython. Maybe this is how it is supposed to work, for some reason (?)

jbeale
 
Posts: 36
Joined: Sat Nov 13, 2010 3:34 am

Re: Feather RP2040, does MicroPython work?

by ericwertz on Wed Apr 28, 2021 8:45 pm

I can confirm your observations -- that that 1.14 UF2 that you pointed to *does* work, and that the current 1.15 UF2 doesn't. The latter doesn't yield a COM port after booting.
AAE is on right now -- I'll ask to see if they're planning on being involved in uP builds for their hardware.

... nope, they skipped right over my question again, so no idea yet if this is something that they want to be involved with.

-e

ericwertz
 
Posts: 87
Joined: Sun Jun 01, 2008 4:18 am

Re: Feather RP2040, does MicroPython work?

by dangerbird on Fri May 14, 2021 5:03 pm

firmware.uf2
micropython v1.15 upstream patched and built expressly for Adafruit Feather RP2040
(549 KiB) Downloaded 8 times
To get to a working micropython for the Feather RP2040 takes just a smidge of patching and building from source. As of micropython 1.15 the Feather is supported, but the device's flash size is incorrect (is 4MB, should be 8MB). This patch to v1.15 will correct the flash size, deducting 768K for the micropython binary leaving 7.25MB for micropython's root filesystem:

Code: Select all | TOGGLE FULL SIZE
diff --git a/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h
index 5068d3554..2a9694c82 100644
--- a/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h
+++ b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h
@@ -1,3 +1,5 @@
 // Board and hardware specific configuration
 #define MICROPY_HW_BOARD_NAME                   "Adafruit Feather RP2040"
-#define MICROPY_HW_FLASH_STORAGE_BYTES          (3072 * 1024)
+#define MICROPY_HW_FLASH_STORAGE_BYTES          (7 * 1024 * 1024 + 256 * 1024)  // 7.25MB flash
+#undef PICO_FLASH_SIZE_BYTES
+#define PICO_FLASH_SIZE_BYTES                   (8 * 1024 * 1024)


Here is an upstream (v1.15 + very recent updates) that works on my Feather RP2040:

dangerbird
 
Posts: 2
Joined: Mon Jun 25, 2018 6:51 pm

Re: Feather RP2040, does MicroPython work?

by dbrazil on Mon Jun 14, 2021 12:50 pm

I patched the mpconfigboard.h and built the firmware, however I couldn't see the REPL on USB.
Then I tried the MicroPython firmware you provided, still no REPL.

Then I put the CircuitPython UF2 and I had the REPL. Then, trying again the provided MicroPython UF2, made the REPL show up in the USB!!
The CircuitPython firmware probably 'cleaned' the flash from the past MicroPython fw I've tried to use on it.

After that, I rebuilt de FW from the MicroPython source (with the changed mpconfigboard.h), got the UF2, put in the Feather RP2040 and bingo, REPL on USB as well.

Thanks for the info dangerbird, really helpful!

dbrazil
 
Posts: 4
Joined: Sun Oct 27, 2019 3:09 pm

Please be positive and constructive with your questions and comments.