Newer
Older
Tardis / doc / usb-mass-storage.md

How to use the USB mass storage mode

Currently, when Tardis boots up for the first time, it creates afile system on the 64 MiB QSPI flash of the discovery kit. This file system has no initial data put into it yet, so if you wish to do this, follow this guide.

Hardware

To put Tardis in USB mass storage mode, perform the following:

  • Make sure Tardis is powered on from one of the various available power sources.
  • Connect a micro USB to USB-A cable to Tardis' USB OTG port (not to be confused with the st-link debugger's micro USB port) and plug the other end into your computer.
  • Press the user button once. If you have connected the serial console from the st-link probe using screen, you should see Tardis is unmounting the file system, then switching to USB mass storage mode.
  • Make sure the new device is detected by your computer, using either lsusb or dmesg.
  • If you encounter any issues, please make sure your USB cable is not bad, and also that its data pins are connected. A good indicator of a cable without data pins is that it can provide power but no data such as USB mass storage, or access to the st-link probe.

Software

  • Grab littlefs-fuse from its GitHub repository.
  • Follow the repository's instructions on how to build the program.
  • To execute it for Tardis, run the following:
    sudo /path/to/littlefs-fuse/lfs --block_count=16384 -o allow_other 
    /dev/sdX /path/to/your/chosen/mountpoint
  • Replace sdX with the correct device node created on your machine (lsblk should help you identify it).

After this, command such as df -h should report a new mount, like so: lfs 64M 8,0K 64M 1% /mnt/tardis

You can copy and create new files as you normally would. Once you are done, please run the sync command before unmounting the file system: sudo sync && sudo unmount /path/to/your/mountpoint.

It is worth noting that although littlefs is a file system which is resistant to data corruption, it is best to still follow those practices.

Finally, press the user button again to exit the USB mass storage mode and go back to the main loop of Tardis.