FYI, Circuit Python versus Micro Python uf2 files

If you have a Pico LIPO, or Tiny 2040, and flash it with the Micro Python uf2 file, you will be limited to the Pi Pico default 2MB. To get the full use of all your memory you have to use the corresponding Adafruit Circuit Python uf2 file. As it stands now anyway. Or do up your own custom Micro Python uf2 file.

Also, keep track of which Tiny 2040 you have, as its not marked on it if its 2MB or 8MB. Not that I could see anyway? The Pico LIPO has a jumper on the back / bottom denoting which it is, 4MB or 16MB.

I prefer the graphics with Micropython so a fix would be useful.

1 Like

Ditto, I much prefer working in Micro Python. My Pico Lipo currently has the Pico Display Pack, 1.54 LCD breakout, LTR-559, VEML6075, RV3028, BME280 and a BME688 attached. Going to be a real PITA to start over and get that all working in Circuit Python.

Was directed here after posting on the Pi Foundation forum.
MicroPython - Python for microcontrollers
They will let you use the full amount of storage space. Iā€™m thinking they donā€™t have all the custom files Pimoroni adds to their image though? Iā€™ll be trying to confirm that at some point. Have to take a break from things for now though.

Thanks for the linkā€¦ Updated both my Pico Lipo16 and Tiny2040.
Both now report correctly.

Should now have plenty of room to store colour images for a photo display program.

Phil Howard AKA Gadgetoid did up some custom Pimoroni versions and posted a link to them in a github post I made. I havenā€™t tested them myself just yet. Only just got up and turned on my PC. Its 5:30 AM here, need some java to get fully awake, lol.
CI: Build MicroPython for multiple boards Ā· pimoroni/pimoroni-pico@eac8c68 (github.com)

@Tonygo2 , Tony what are you using to check the ā€œreported spaceā€?
Just flashed my Pico Lipo and Thonny shows it as
MicroPython v1.18 on 2022-03-10; Pimoroni Pico LiPo 16MB with RP2040

On my Tiny 2040 I used this:

# Board memory Test
# Tony Goodhew 11 March 2022
# Builds a very large text file - all junk!
import machine
import uos
print("Basic Memory Space Test \n")
with open("/test2.txt", "w") as f: # Write - new file
        f.write("First Message\r\n")
        
for u in range(10000):
    if int(u/500)*500 == u:
        print(u)
    with open("/test2.txt", "a") as f: # Append
        f.write("Tony Goodhew\r\n")
        f.write("Leicester City Cup Winners!\r\n")
        f.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz,.?%$Ā£*&\r\n")
        for i in range(10):
            f.write(str(i) + ", " + str(i*i*i) + ", " + str(i*i*i*i) + "\r\n")

print("Done")

%Run -c $EDITOR_CONTENT
Basic Memory Space Test

0
500
1000
1500
2000
2500
3000
3500
4000
4500
5000
5500
6000
6500
7000
7500
8000
8500
9000
9500
Done

If you look at the file with Thonny it reports 2360015 bytes!

Ok, I just uploaded a big mp3 file, 5MB or so. The PICO Display Pack demo ran on my Pico Lipo after flashing it with the new Pimoroni file, so Iā€™d say Iā€™m good to go now.

1 Like

You can also do something like this to report the available filesystem size:

import os

f_bsize, f_frsize, f_blocks, f_bfree, _, _, _, _, _, f_namemax = os.statvfs("/")
f_total_size = f_frsize * f_blocks
f_total_free = f_bsize * f_bfree

print(f"Total size: {f_total_size/1048576} MB")
print(f"Total free: {f_total_free/1048576} MB")

Have tested both flavours of Pico LiPo and Tiny 2040 with the new pimoroni-pico board specific builds and they both seem to be now reporting believable flash amounts and dealing with big files properly - hooray!

1 Like

Thankyou, Iā€™ve been looking for code like that since this all started.
This is what Iā€™m getting with the 1.18.4 uf2 files flashed.

MicroPython v1.18 on 2022-03-11; Pimoroni Tiny 2040 with RP2040

Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
Total size: 7.0 MB
Total free: 6.992188 MB
>>> 
MicroPython v1.18 on 2022-03-11; Pimoroni Pico LiPo 16MB with RP2040

Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
Total size: 15.0 MB
Total free: 14.99219 MB
>>>