!USBFS v0.32 (c) Stephen Harrison, 5th May 2025 *First public test version!* A RISC OS read/write USB file system for the CH376 Flash Drive control chip. Get the latest version here: www.pi-star.co.uk/usbfs *************************************************************************** ** WARNING: USBFS 0.32 IS A DEVELOPMENT VERSION AND IS NOT FULLY TESTED ** ** USING THIS COULD RESULT IN DATA LOSS OR CORRUPTION OF YOUR USB DRIVE! ** *************************************************************************** New in v0.32 - Fixed i/o timing for faster processors, now works on StrongARM 233 RiscPC - Faster i/o code, up to 360kb/s read speed (StrongARM), 300kb/s (ARM3) - *USBFree now more user-friendly decimal free space output in Gb and Mb - Improved error reports (if you see an unexpected error, photo the output) - Fixed truncation of long RISC OS filenames (>11 char, eg. RISC OS 4) - Better RISC OS <> FAT filename conversion of unusual characters $ # / etc - i/o timing tweaks to (hopefully) improve large file transfers Disclaimer ---------- Despite all testing carried out so far, USBFS and the CH376 module firmware, may contain bugs or errors which could result in unexpected data loss or corruption. By using USBFS you accept this risk and agree that the author(s) are not liable for any loss. CH376 hardware and !USBFS ------------------------- The CH376 module is a widely available low cost interface for USB flash drives, intended to allow simple connection and use of FAT32/16/12 USB drives for file transfer and single file i/o on single board computers, data capture devices, etc. !USBFS is a RISC OS driver for the CH376 module and craftly gets around the single file i/o limitiation to enable (1) a fully usable read/write RISC OS filesystem under FAT32/16/12, and (2) full file transfer compatibility with Windows/Linux/Mac/Android/etc to allow simple drag and drop transfer by USB. First time use -------------- To use !USBFS for the first time, run !USBFS, then select the hardware location using USBFS iconbar menu > Hardware > Podule 0/1/2/3 or Econet. Once successfully selected, USBFS will show the CH376 hardware version at the top of the menu, and save the location back to CMOS RAM (in the 'user' area, this may change in future) so you won't need to select again. Now insert your USB drive and enjoy! After writing files/data to USB all data should be safely stored once any Filer transfer windows complete, allowing you to remove the USB drive immediately, its window should then close automatically. A "Dismount" menu entry is provided to force all files on USB to close before removing the drive, but use of this is only necessary if you have are using file i/o outside of Filer copying/saving (eg. if you use USB as your primary storage). CH376 limitations ----------------- CH376 recognises FAT32 formatted USB drives (tested up to 32Gb) and FAT16/FAT12 format for smaller drives. However different versions of the CH376 firmware are available and these have different compatibilities with drives formatted using the Windows 10/11 built-in formatter (most common at time of writing appear to be versions &41-&44). The firmware version is displayed in the 'Hardware' menu title accessible from the USBFS icon. CH376 version &43 and &44 appear most compatible with USB drives formatted by Windows 10/11 built-in formatter as well as other OSs. CH376 versions &41 and &42 **do not** recognise some USB drives formatted by Windows 10/11 built-in formatter. To fix this, you will need to reformat the USB drive as FAT32 on either under Linux/MacOS, or on Windows but using an alternative formatter (eg www.lsoft.net/partition-manager/index.html). If your USB dirve is not correctly recognised, USBFS will usually detect this and report an error, or it may show an empty $ directory for your drive when you were expecting to see files (if this happens, do not use the drive until it is reformatted as above). More information ---------------- v0.32 (first release) implements a full filing system for USB flash drives. This allows full navigation of the directory structure on the USB drive, running files/applications from USB, loading, saving and copying to/from USB drives and full RISC OS random access file i/o. RISC OS 10-character (and 11) filenames are supported, as are RISC OS datestamps, filetypes and load/exec addresses are supported, although filetypes and load/exec addresses will get overwritten if the USB drive is 'repaired' on a PC/Mac, or if the files are edited or overwritten on a PC/Mac. The underlying filesystem for USB drives remains FAT32/16/12 with 8-character filenames and a 3-character extension, separated by a '.', this ensures the USB drive is readable on PCs/Macs, allowing file transfer to/from the drive and RISC OS. In order to support RISC OS filenames and to enable running RISC OS applications from USB, USBFS does not display the '.' between the filename and extension if USBFS detects the file was created on RISC OS, but it will display the '.' if it believes the file was created on a PC/Mac. NOTE: Hiding the '.'s like this can occasionally lead to unexpected "file not found" or similar errors when accessing some files transfered from PCs/Macs even when they appear visible on the Desktop Filer window. If you see this, you can temporarily force USBFS to show all extension dots by un-ticking the "Hide dots" menu entry, or using the *command "*USBDots Show" (you can hide them again using "*USBDots Hide"). Renaming the problem file should then solve the issue and allow you to hide the extension dots again. USBFS also provides a number of *Commands (see below) and SWIs for programmer level interface. However, an official SWI base number has not yet been allocated and the SWIs are subject to change during development. If you'd like to use the SWIs, please check the USBFS web page or contact the author. USB drive size, USBFS features, and limitations ----------------------------------------------- USBFS supports USB flash drives formatted as FAT32/16/12 (tested up to 32Gb) and because it is FAT-format, not RISC OS Filecore format, you are not restricted to the usual RISC OS 3.1 512Mb maximum partition size. You can also store unlimited (well just over 65,000) files per directory, not restricted to the usual RISC OS 3.1 limit of 77 files max. And just to top things off, USBFS allows up to 11 characters in your file names, one more than the usual 10. :-) All this is great, but there is downside. The CH376 USB hardware is not as fast as a modern harddisc at reading or writing data. Currently USBFS usually manages to achieve 250-350kb/sec read speed and 20-80kb/sec write speed, but this depends a lot on the FAT cluster size chosen at time of formatting and the level of fragmentation (freshly formatted drives perform better when writing, as do large cluster sizes - at the expense of efficient space use). *Commands --------- *USBFree shows the total and free space on the USB drive, in Gb and Mb. Syntax: *USBFree *USBPodule tells USBFS which podule (or Econet) slot to use. This command must be issued before the USB filing system will function. Syntax: *USBPodule [] *USBMount triggers USBFS to attempt to mount a USB drive connect to the CH376 hardware. Once this command completes successfully, the USB file system can be used. Syntax: *USBMount *USBDismount dismounts a USB drive connected to the CH376 hardware. Use this before removing the USB drive from the hardware. Syntax: *USBDismount *USBDots tells USBFS whether to show or hide the filename extension '.'s. Use without a parameter to show current setting. Syntax: *USBDots [Show|Hide] *USBFS selects the USBFS filing system. Syntax: *USBFS Acknowledgements ---------------- Many thanks to everyone who has helped with testing and encouraging development of USBFS, especially Ian Stocks for bringing the CH376 to the Archimedes in the first place and for seeding the idea of desktop USB file transfer at the Nov 2024 ABug Southeast show... !USBFS is the result :-) S. Harrison, 5th May 2025