Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
User avatar
RWLTOK
Posts: 53
Joined: Thu Dec 14, 2017 7:24 pm

Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by RWLTOK » Mon Aug 30, 2021 3:06 am

When I received my PICO, it was preloaded with Circuit Python. With Circuit Python I could see the contents of the file system on the PICO from Windows 10. After loading Micropython 1.16, I don't see the file system contents any more. That is why I love my PyBoard. Is this a feature of Micropython for RP2 or is there something wrong with my system? I looked through mpconfigureport.h and I did not see anything to enable for flash drive functionality.

Thanks

Rich

PS: There is a line in the rp2/boards/PICO/mpconfigboard.h that reads:

Code: Select all

#define MICROPY_HW_FLASH_STORAGE_BYTES          (1408 * 1024)

JumpZero
Posts: 54
Joined: Mon Oct 30, 2017 5:54 am
Location: Arcachon - France

Re: Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by JumpZero » Mon Aug 30, 2021 11:25 am

This normal, that's a difference between MicroPython and CircuitPython
here you can read about differences between the two, including this:
CircuitPython was designed to have a USB disk drive that appears when you plug in the board.

User avatar
RWLTOK
Posts: 53
Joined: Thu Dec 14, 2017 7:24 pm

Re: Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by RWLTOK » Mon Aug 30, 2021 12:50 pm

Thanks for pointing that out. I would really miss uasyncio going to circuit python.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by pythoncoder » Tue Aug 31, 2021 6:32 am

This is under review and is a topic of some debate. Some advocate providing this facility. In my opinion it is the spawn of the Devil (on Pyboards too) for this reason.
Peter Hinch
Index to my micropython libraries.

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by mattyt » Tue Aug 31, 2021 7:16 am

JumpZero wrote:
Mon Aug 30, 2021 11:25 am
This normal, that's a difference between MicroPython and CircuitPython
That's not quite right, just to clarify; CircuitPython requires USB mass storage support (at least, until very recently where they're relaxing that for some ports where BLE can be used to interact with the filesystem). MicroPython can use USB mass storage on ports that support it - but it may be disabled. Many stm32 boards support USB mass storage for example.

MicroPython supports the concept of a virtual filesystem of which there are currently two implementations: FatFS and LittleFS. FatFS is the venerable Microsoft filesystem - it's not particularly robust but it is required for USB mass storage. LittleFS was designed for embedded use; it's small, supports wear levelling and is robust - particularly in the event of unexpected power failures. So there's a tradeoff; the improved resilience of LittleFS or the convenience of FatFS since, with it, USB mass storage becomes available.

I believe MicroPython made the choice to go with LittleFS by default for the RP2 port since Thonny had been selected as the IDE (it doesn't need mass storage) and using LittleFS meant it was less likely beginners would have issues with corrupt filesystems.

Since TinyUSB is used for the RP2 port to provide USB features - just like CircuitPython - mass storage with FatFS should be possible. It's not yet implemented but all the components are there...

JumpZero
Posts: 54
Joined: Mon Oct 30, 2017 5:54 am
Location: Arcachon - France

Re: Can you access the RP2 files system from Windows 10 as a USB Flash Drive?

Post by JumpZero » Tue Aug 31, 2021 11:52 am

Thank you very much @mattyt for taking the time to provide these details. It is indeed very interesting to understand the pros and cons of LittleFS vs Fat.
And also TinyUSB (I didn' know it) is a great project.
What would we do without everyone from the Open Source who works for us!
And as @pythoncoder says: ruggedness is a better choice. So: LittleFS
Thanks again

Post Reply