This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

FS AT Command Set

AT+FSMOUNT: Mount and unmount file system

Set Command

Command:

AT+FSMOUNT=<mount>

Response:

OK

Parameter

  • <mount>:

    • 0: Unmount FS file system

    • 1: Mount FS file system

Explanation

  • After completing the file system operations wit AT+FS , it is recommended to use the AT+FSMOUNT=0 command to unmount the file system to free up a large amount of RAM space.

Example

// Manually unmount the file system
AT+FSMOUNT=0

// Manually mount the file system
AT+FSMOUNT=1

AT+FS: File system operations

Set Command

Command:

AT+FS=<type>,<operation>,<filename>,<offset>,<length>

Response:

OK

Parameter

  • <type>: Currently only FATFS is supported

    • 0: FATFS

  • <operation>:

    • 0: Delete file

    • 1: Write file

    • 2: Read file

    • 3: Query file size

    • 4: List files in the directory, currently only supports the root directory “/”

  • <offset>: Offset address, set only for read/write operations

  • <length>: Length, set only for read/write operations

Explanation

  • This command will automatically mount the file system. After completing the file system operations with AT+FS , it is recommended to use the AT+FSMOUNT=0 command to unmount the file system to free up a large amount of RAM space.

  • If the length of the data to be read is greater than the actual file size, only the actual length of the data will be returned.

  • When <operator> is write , the system will return >``after receiving this command. At this point, you can input the data to be written, and the data length should be consistent with ``<length> .

Example

// Delete a file
AT+FS=0,0,"filename"

// Write 10 bytes at offset 100 in a file
AT+FS=0,1,"filename",100,10

// Read 100 bytes from offset 0 in a file
AT+FS=0,2,"filename",0,100

// Query the size of a file
AT+FS=0,3,"filename"

// List all files in the root directory
AT+FS=0,4,"."