diff --git a/doc/erasing-flash.md b/doc/erasing-flash.md new file mode 100644 index 0000000..102a793 --- /dev/null +++ b/doc/erasing-flash.md @@ -0,0 +1,18 @@ +# How to erase the QSPI flash # + +If you wish to entirely erase the QSPI flash of the discovery kit, (e.g: +for repurposing it), while the software is **not** in USB storage mode, +press the user button twice. It will proceed to unmount the file system +created on the flash, and then proceed with the erasing procedure. This +usually takes a few minutes, so please be patient. + +Once it is done, the system will deinitialize the block device and halt. +You can then flash another program on the internal flash of the +discovery kit. + +Here are a few things to keep in mind: +* If you reset the board in the midle of the erase procedure, it will +recreate a new file system, as per the behavior of Tardis +* The same applies if the procedure was completed. +* This procedure is permanent and currently doesn't propose to cancel +the action in any way. Please be sure that you really wish to do this! diff --git a/doc/usb-mass-storage.md b/doc/usb-mass-storage.md new file mode 100644 index 0000000..82a9a4c --- /dev/null +++ b/doc/usb-mass-storage.md @@ -0,0 +1,51 @@ +# 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](https://github.com/littlefs-project/littlefs-fuse). +* 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.