Shop OBEX P1 Docs P2 Docs Learn Events
P2 DUAL uSD FAT32 and FLASH Filesystem (spin2/pasm2) — Parallax Forums

P2 DUAL uSD FAT32 and FLASH Filesystem (spin2/pasm2)

Stephen MoracoStephen Moraco Posts: 448
edited 2026-03-08 08:40 in Propeller 2

New P2 Dual Filesystem Driver — SD FAT32 + Flash in One Cog

Version 1.0.0

This is the first public release of a unified dual-filesystem driver for the P2 Edge Module. It gives you simultaneous access to both the onboard 16 MB Flash chip and a microSD card through a single worker cog and a single API — every file operation takes a device parameter, so you can read, write, and copy across both devices seamlessly.

Incorporates P2 uSD FAT32 FS v1.3.1 and P2 FLASH FS v2.0.0

What's in the box

  • Unified Driver (dual_sd_fat32_flash_fs.spin2) — SD FAT32 and Flash filesystems managed by one dedicated cog with automatic SPI bus switching, hardware lock serialization, 6 simultaneous file/directory handles (configurable), 3 of which can be flash files (configurable), per-cog working directories, and cross-device copyFile() / moveFile()
  • 7 Utilities — SD and Flash format, audit, and fsck (with auto-repair for SD), plus an SD card characterizer for benchmarking and card identification
  • Demo Shell — Interactive dual-device terminal with sd/fl device switching, dir, cd, type, hexdump, copy, format, fsck, audit, bench, and more
  • 4 Example Programs — Basic read/write, cross-device copy, data logger, and SD manifest reader copy to flash
  • Full Documentation

Testing: 1,308 regression tests across 29 suites (SD, Flash, cross-device, dual-device, multi-cog), all validated on P2 hardware.

Known limitations:
- 8.3 filenames only (no LFN)
- SPI mode only, 25 MHz maximum

Compiles with pnut/pnut-ts.
Set up to compile with FlexSpin and Spin Tools IDE, but needs testing.
(Working through issues with FlexSpin; watch for a point release shortly.)

Hardware: P2 Edge Modules P2-EC and P2-EC32MB (both have built-in microSD socket and onboard 16 MB Flash chip).

Need only one device? Standalone alternatives produce smaller binaries: P2 FLASH FS and P2 uSD FAT32 FS.

Visit the Repo for full documentation, including a driver tutorial, theory of operations, and utilities guide.

The release package can be downloaded from the Release page as dual-fs-driver-{version}.zip.

If you find issues, please file them at the Issues.

Enjoy!

Stephen

Comments

  • RaymanRayman Posts: 16,161

    This sounds great! Thanks.

  • RaymanRayman Posts: 16,161

    Is this flash file system compatible with the one Chip made?

  • Stephen MoracoStephen Moraco Posts: 448
    edited 2026-03-08 19:23

    @Rayman said:
    Is this flash file system compatible with the one Chip made?

    Yes, it is the very same as the release in my repo quite a while ago. (links in the announcement post to the repo's)

  • NEWS

    I just released v1.1.0 - Incorporates P2 uSD FAT32 FS v1.3.2 and P2 FLASH FS v2.0.0

    Here's what's new/fixed:

    v1.1.0

    ### Fixed
    - BUGFIX: SPI write data integrity at power-of-2 half-period clock speeds (writeSector() and writeSectors())

    ### Added
    - Selective debug: 12-channel DEBUG_MASK system for debug[CH_xxx]() output -- developers enable 2-3 channels at a time to stay under the P2 255-record limit
    - FlexSpin compatibility: All 43 compilable files build with both pnut-ts and FlexSpin 7.6.1

    Hardware: P2 Edge Modules P2-EC and P2-EC32MB (both have built-in microSD socket and onboard 16 MB Flash chip).

    Need only one device? Standalone alternatives produce smaller binaries: P2 FLASH FS and P2 uSD FAT32 FS.

    Visit the Repo for full documentation, including a driver tutorial, theory of operations, and utilities guide.

    The release package can be downloaded from the Release page as dual-fs-driver-{version}.zip.

    If you find issues, please file them at the Issues.

    Enjoy!

    Stephen

  • RaymanRayman Posts: 16,161
    edited 2026-03-11 23:10

    So flexprop has at least two different flash drivers, one based on Chip’s code.

    If this is still compatible, would be very nice. Could use the shell.c example to copy files from flash to/from PC over plan9 already…

    Pc to usd should already work too.

    Guess flash to usd might also work…

Sign In or Register to comment.