Help with CircuitPython

Hi there,

I’m a python programmer (well, kinda) and wanted to build a simple macro keyboard. I have lots of experience with Ardunio but couldn’t get USB HID working on the Xiao using either Keyboard.h or TinyUSB via the Arduino IDE.

So, I thought I would give CircuitPython a try as I have done this exact thing before using a Circuit Playground Express with Python and it worked flawlessly (but my latest project needs more IO!). I got the UF2 file up on the device and then ran into a problem. I don’t seem to have the space to store any code. My mac is reporting that there is only a very tiny amount of space which means I can’t even add any basic library files to do what I need.

In bootloader mode I see an 8MB drive (which would be more than enough) but the circuitpy drive is only 66kb (see screenshot). Any ideas what I can do to resolve this?

Thanks!

Ok, I made some progress - looks like there was a big hex file taking up all the space, everything seemed to keep working even after I deleted it and now I have a lot more room!

I say a lot… a bit, maybe enough for the libraries as the partition still seems to be teeny tiny (versus say the circuitplayground which has 2MB)

Can anyone help with this? The specs say this board should have 256KB flash but somehow I only have 66KB available. The total files that I’ve added to the board are only just over 8KB yet somehow the disk is “full”. I’ve checked for hidden files (both by enabling viewing of hidden files and looking on the command line), but nothing seems to be there.

This is making development troublesome because I can only add a couple of library files before I run out of space. Is there any way I can possibly enable or access more disk space on the CIRCUITPY drive?

This is because circuitpython itself takes up some storage, and the *.py and *.mpy that you put in need to take up flash space as well. @hellweaver666

As @Baozhu says, the 256k of internal flash is also used to store the CircuitPython runtime itself. It’s split 192k for CircuitPython and 64k for the user filesystem (which includes the filesystem overhead too.) Boards with more flash like the Circuit Playground have an external SPI Flash chip that is used to store the user filesystem and CircuitPython then uses 256k for itself.

The filesystem on UF2 bootloaders is fake so don’t read into its size. I’m not sure if the Xiao has a UF2 bootloader or not.

Thats kind of sad. It really makes it hard to achieve much with circuitpython on the Xiao. The standard on most boards seems to be 2mb which is then enough for a decent number of library files.

Yup. These days 256k ram and external SPI flash is the better way to go for CircuitPython. People enjoy building large things with it. :slight_smile: