Quectel GSM FILE AT Commands Manual V1.5C
Quectel GSM FILE AT Commands Manual V1.5C
GSM FILE
AT Commands Manual
GSM_FILE _AT_Commands_Manual_V1.5
GSM FILE AT Commands Manual
Version 1.5
Date 2015-05-20
Status Released
l
General Notes
Quectel offers this information as a service to its customers, to support application and
e
engineering efforts that use the products designed by Quectel. The information provided is based
t
upon requirements specifically provided for customers of Quectel. Quectel has not undertaken any
c l
independent search for additional information, relevant to any information that may be in the
customer’s possession. Furthermore, system validation of this product designed by Quectel within
e ia
a larger electronic system remains the responsibility of the customer or the customer’s system
t
integrator. All specifications supplied herein are subject to change.
u n
Copyright
Q ide
This document contains proprietary technical information of Quectel Co., Ltd. Copying this
document, distribution to others, and communication of the contents thereof, are forbidden without
permission. Offenders are liable to the payment of damages. All rights are reserved in the event of
f
a patent grant or registration of a utility model or design. All specifications supplied herein are
subject to change without notice at any time.
n
Copyright © Quectel Wireless Solutions Co., Ltd. 2015.
Co
GSM_FILE_AT_Commands_Manual_V1.5 -1-
GSM FILE AT Commands Manual
Contents
Contents ............................................................................................................................................ 2
0. Revision history ............................................................................................................................ 3
1. Introduction ................................................................................................................................... 4
1.1. Reference............................................................................................................................. 4
1.2. Terms and abbreviations ...................................................................................................... 4
2. AT Commands for File .................................................................................................................. 5
2.1. Overview of AT commands for File ................................................................................... 5
2.2. Detailed descriptions of commands .................................................................................... 5
l
2.2.1. AT+QFLDS Get data storage size ........................................................................... 5
e
2.2.2. AT+QFLST List files ............................................................................................... 6
t
2.2.3. AT+QFUPL Upload file to storage .......................................................................... 7
l
2.2.4. AT+QFDWL Download file from storage ............................................................... 8
c
2.2.5. AT+QFDEL Delete file in storage ........................................................................... 9
e ia
2.2.6. AT+QFMOV Move file ......................................................................................... 10
t
2.2.7. AT+QFOPEN Open file ......................................................................................... 10
u
2.2.8. AT+QFREAD Read file ......................................................................................... 12
n
2.2.9. AT+QFWRITE Write file ...................................................................................... 12
Q ide
2.2.10. AT+QFSEEK Seek file .......................................................................................... 13
2.2.11. AT+QFCLOSE Close file ...................................................................................... 13
2.2.12. AT+QFPOSITION Get offset of the file pointer ................................................... 14
2.2.13. AT+QFFLUSH Force to write data remaining in the file buffer............................ 14
f
2.2.14. AT+QFTUCAT Truncate the specified file from the file pointer ........................... 14
n
3. Summary of error codes .............................................................................................................. 16
4. Reliable transmission .................................................................................................................. 17
o
4.1. Calculated checksum to check the file transfer ................................................................. 17
4.2. ACK mode is enabled to stabilize Uploading ................................................................... 18
C
5. Examples ..................................................................................................................................... 19
5.1. File uploading and downloading ....................................................................................... 19
5.2. File moving ....................................................................................................................... 19
5.2.1. Move single file ..................................................................................................... 20
5.2.2. Move all files of one storage.................................................................................. 20
5.3. Read/write file ................................................................................................................... 21
GSM_FILE_AT_Commands_Manual_V1.5 -2-
GSM FILE AT Commands Manual
0. Revision history
l
AT+QFUPL command
e
1.3 2011-05-23 Gralik WANG Added file AT command: QFOPEN,
t
QFREAD,QFWRITE,QFSEEK,
c l
QFCLOSE,QFPOSITION,QFFLUSH,
QFTUCAT
e ia
2011-12-26 Gralik WANG Modified error code and deleted
t
unnecessary space during the AT
u
commands
n
1.4 2012-05-18 Bonnie ZHAO Modified mistakes in Section 5.1
Q ide
f
2012-05-22 Will SHAO 1. Modified AT command QFOPEN.
n
2. Added new error code.
o
1.5 2015-05-20 Will SHAO Added applicable modules
C
GSM_FILE_AT_Commands_Manual_V1.5 -3-
GSM FILE AT Commands Manual
1. Introduction
This document is applicable to Quectel M10, M26, M35, M72-D, M50, GC65 and GC65-E
modules.
Note:
M10 module supports to operate files in UFS and RAM, M26, M35, M72-D, GC65 and GC65-E
l
modules only support to operate files in RAM.
c t e l
1.1. Reference
e ia
Table 1: Reference
u t
SN Document name Remark
n
[1] Mxx_ATC The introduction of AT commands for Mxx
Q ide
1.2. Terms and abbreviations
n f
Table 2: Terms and abbreviations
o
Abbreviation Description
UFS file File saved in the directory of User File Storage in Module flash
C
RAM file
File saved in RAM
SD file
File saved in Picture directory of SD card
GSM_FILE_AT_Commands_Manual_V1.5 -4-
GSM FILE AT Commands Manual
Quectel Module provides AT commands which can operate files in RAM, flash and SD card. And
the SD card only supports three file systems: FAT, FAT16 and FAT32.
Command Description
l
AT+QFLDS Get storage data size
AT+QFLST List files
t e
AT+QFUPL Upload file to storage
l
AT+QFDWL Download file from storage
c
AT+QFDEL Delete file in storage
e a
AT+QFMOV Move file
t i
AT+QFOPEN Open file
u
AT+QFREAD Read file
n
AT+QFWRITE Write file
Q ide
AT+QFSEEK Seek file
AT+QFCLOSE Close file
AT+QFPOSITION Get offset of the file pointer
f
AT+QFFLUSH Force to write data remaining in the file buffer
n
AT+QFTUCAT Truncate the specified file from the file pointer
o
2.2. Detailed descriptions of commands
C
2.2.1. AT+QFLDS Get data storage size
GSM_FILE_AT_Commands_Manual_V1.5 -5-
GSM FILE AT Commands Manual
“SD” SD file
<free size> Free data size in <namepattern>
<total size> Total data size in <namepattern>
<maxalloc size> The maximum size which can be
allocated, only valid for RAM file.
Execution Command Response
AT+QFLDS +QFLDS: <ufs file size>,<ufs file number>
OK
Returns the UFS information
Parameter
l
<ufs file size> The size in bytes of all files in UFS
<ufs file number> The number of files in UFS
t e
Reference
c a l
2.2.2. AT+QFLST List files
u e t i
AT+QFLST List files
n
Test Command Response
AT+QFLST=? OK
Q ide
Write Command Response
AT+QFLST=<namepattern +QFLST: <file name>,<file size>[,<ram size>]
>
f
OK
Parameter
n
< namepattern > Pattern for filename
o
“*” All UFS file in flash
“RAM:*” All RAM file
“SD:*”
C
All SD file
“filename” Name of UFS file
“RAM:filename” Name of RAM file
“SD:filename” Name of SD file
<file name> Name of the file
<file size> Size in bytes of the file
<ram size> Memory size allocated for the file in RAM,
only valid for RAM file
Execution Command Response
AT+QFLST +QFLST: <file name>,<file size>
OK
GSM_FILE_AT_Commands_Manual_V1.5 -6-
GSM FILE AT Commands Manual
l
AT+QFUPL Upload file to storage
Test Command Response
e
AT+QFUPL=? +QFUPL: "file name",<filesize> ,(1-65535),(0,1)
c t l
OK
a
Parameter
e i
See Write Command.
u t
Write Command Response
n
AT+QFUPL=<file CONNECT
name>[,<filesize> TA switches to data mode, and the bin data of file can be
Q ide
[,<timeout>[,<ackmode >]]] inputted. When the total size of the input data reaches <file
size> (unit: byte) or TA receives “+++” sequence from
UART, TA returns to command mode and replies the
f
following codes.
+QFUPL: <upload size>,<checksum>
o n
OK
Parameter
C
<file name> The name of the file to be stored.
<filesize> The maximum size of the file to be uploaded.
Default is 10240. Unit: byte
<upload size> The size of the actually uploaded data. Unit:
byte
<timeout> The time in seconds to wait for data input
from UART. Default is 5.
<ackmode> Whether to use acknowledge mode or not
0 Turn off the ACT mode. It’s default.
1 Turn on the ACT mode
<checksum> The checksum of the uploaded data
Reference Note:
It is strongly recommended to use DOS 8.3 file name
format for <file name>.
<file name>
GSM_FILE_AT_Commands_Manual_V1.5 -7-
GSM FILE AT Commands Manual
l
The ACT mode is provided to avoid loss of data when
uploading large files in case hardware flow control is
t e
not available. The ACT mode works as follows:
l
1) Run command AT+QFUPL = "file name", filesize,
c
5,1 to enable the ACK mode;
a
2) The module outputs "CONNECT";
e i
3) MCU sends 1Kbytes data, and then the module will
u t
respond with a 'A';
n
4) MCU receives the ‘A’ and then sends the next
1Kbytes data
Q ide
5) Repeat step 3) and 4) until the transfer is
completed.
f
2.2.4. AT+QFDWL Download file from storage
n
AT+QFDWL Download file from storage
o
Test Command Response
AT+QFDWL=? +QFDWL: "file name"
C
OK
Parameter
See Write Command.
Write Command Response
AT+QFDWL=<file name> CONNECT
TA switches to data mode, and the bin data of the file will be
outputted. When the file was read over, TA returns to
command mode and replies the following codes:
+QFDWL: <download size>,<checksum>
OK
Parameter
<file name> The name of the file to be downloaded
GSM_FILE_AT_Commands_Manual_V1.5 -8-
GSM FILE AT Commands Manual
l
switch to command mode.
<checksum> is 16 bit checksum based on bitwise XOR.
c t e l
2.2.5. AT+QFDEL Delete file in storage
e ia
AT+QFDEL Delete file in storage
u t
Test Command Response
n
AT+QFDEL=? +QFDEL: "file name"
Q ide
OK
Parameter
See Write Command.
f
Write Command Response
AT+QFDEL=<file name> OK
n
Parameter
o
<file name> The name of the file to be deleted
“*” Delete all files in UFS directory ( DO
C
not delete the directory)
“RAM:*” Delete all files in RAM
“SD:*” Delete all files in Picture directory of SD
card
“filename” Delete the specified file “filename” in
UFS directory
“RAM:filename” Delete the specified file “filename”
in RAM
“SD:filename” Delete the specified file “filename”
in Picture directory of SD card
Note:
Only delete files in the Picture directory of SD card, do not
delete any directory or any file in the other directories.
GSM_FILE_AT_Commands_Manual_V1.5 -9-
GSM FILE AT Commands Manual
OK
Parameter
See Write Command.
Write Command Response
AT+QFMOV=<src OK
l
filename>,<dest Parameter
e
filename>,<copy>,<overwrite <src filename> Source file
t
> <dest filename> Destination file
l
<copy> Whether or not to delete source file after the
c
file is copied
e ia
0 Delete source file after file is copied
t
1 Do not delete source file after file is
u
copied
n
<overwrite> Whether or not to overwrite existed
Q ide
destination file
0 Do not overwrite the destination file if it
exists
1 Overwrite the destination file if it exists
f
Reference Note:
n
This command is supported only in M33.
Cannot move file from UFS or SD card to RAM.
o
AT+QFMOV="RAM:*","SD:*",1,1 Move all files in
RAM to SD card
C
AT+QFMOV="RAM:filenamea","SD:filenameb",1,
1 Move the file named “filenamea” in RAM to SD
card, and rename it as “filenameb”.
OK
Parameter
See Write Command.
Read Command Response
GSM_FILE_AT_Commands_Manual_V1.5 - 10 -
GSM FILE AT Commands Manual
[+QFOPEN: "filename",<filehandle>,<mode>
[…]]
OK
Parameter
See Write Command.
Write Command Response
AT+QFOPEN=<filename>[, +QFOPEN: <filehandle>
<mode>[,length]]
l
OK
e
Parameter
t
<filename> The file needed to be operated
l
<mode> The mode of the file opened, default is 0
c
0 (Default) If the file doesn’t exist, it will
e a
be created; if the file exists, it will be
t i
opened. And both of them can be read
u
and written
n
1 If the file exists, it will be created and
Q ide
clear the old file
2 If the file exists, open it and it only can
be read.
<length > The max length of the file. Default is 10240.
f
Unit: byte. It is only used for RAM file.Ignore
this parameter if you use UFS or SD file.
n
Reference Note:
o
Can open file from UFS、RAM or SD card
AT+QFOPEN="filenameb", 0 Open the file named
C
“filenameb” in the UFS
AT+QFOPEN="SD:filenameb",0 Open the file named
“filenameb” in the Picture directory of SD card
AT+QFOPEN=”RAM:filename”,0,1024 Open the file
named <filename> in RAM. If the file does not exist, then
create it, and set the max length of the file with value
1024. If the file exists in RAM, just open it, and ignore the
length 1024.
AT+QFOPEN=”RAM:filename”,1,10240 Create the file
named <filename> in RAM. If the file already exists, first
delete it, then create it, and set the max length of the file
with value 10240.
GSM_FILE_AT_Commands_Manual_V1.5 - 11 -
GSM FILE AT Commands Manual
OK
Parameter
See Write Command.
Write Command Response
AT+QFREAD=<filehandle>[ CONNECT < read length >
l
, <length>] TA switches to data mode. When the total size of the read
e
data reaches <read length> (unit: byte), TA returns to
t
command mode and then replies the following codes.
l
OK
c
Parameter
e ia
<filehandle> The handle of the file needed to be
t
operated
u
<length> The length of the file to be read out, the
n
default is the size of the file.
Q ide
<read length> The actual length to be read out
Reference
f
2.2.9. AT+QFWRITE Write file
n
AT+QFWRITE Write file
o
Test Command Response
AT+QFWRITE=? +QFWRITE: <filehandle>[,<length>[,<timeout>]]
C
OK
Parameter
See Write Command.
Write Command Response
AT+QFWRITE=<filehandle CONNECT
> [,<length>[,<timeout>]] TA switches to data mode. When the total size of the written
data reaches <length> (unit: byte) or it is timeout, TA
returns to command mode and replies the following codes.
+QFWRITE: <written length>,<total_length>
OK
Parameter
<filehandle> The handle of the file needed to be
operated
GSM_FILE_AT_Commands_Manual_V1.5 - 12 -
GSM FILE AT Commands Manual
l
AT+QFSEEK Seek file
Test Command Response
e
AT+QFSEEK=? +QFSEEK: <filehandle>,<offset>[,<position>]
c t l
OK
a
Parameter
e i
See Write Command.
u t
Write Command Response
n
AT+QFSEEK=<filehandle>, OK
<offset>[,<position>] Parameter
Q ide
<filehandle> The handle of the file needed to be operated
<offset> Number of bytes to move the file pointer
<position> Pointer movement mode. The default is 0
f
0 File begin
1 Current position of the pointer
n
2 File end
o
Reference
C
2.2.11. AT+QFCLOSE Close file
OK
Parameter
See Write Command.
Write Command Response
AT+QFCLOSE=<filehandle OK
> Parameter
<filehandle> The handle of the file needed to be operated
Reference
GSM_FILE_AT_Commands_Manual_V1.5 - 13 -
GSM FILE AT Commands Manual
OK
Parameter
See Write Command.
Write Command Response
AT+QFPOSITION= +QFPOSITION: <offset>
l
<filehandle>
e
OK
t
Parameter
l
<filehandle> The handle of the file needed to be operated
c
<offset> The offset from the beginning of the file to
e ia
the current position
t
Reference
u
Q ide n
2.2.13. AT+QFFLUSH Force to write data remaining in the file buffer
f
AT+QFFLUSH=? +QFFLUSH: <filehandle>
n
OK
o
Parameter
See Write Command.
C
Write Command Response
AT+QFFLUSH=<filehandle OK
> Parameter
<filehandle> The handle of the file needed to be operated
Reference
2.2.14. AT+QFTUCAT Truncate the specified file from the file pointer
OK
Parameter
GSM_FILE_AT_Commands_Manual_V1.5 - 14 -
GSM FILE AT Commands Manual
t el
e c ia l
u n t
Q ide
n f
Co
GSM_FILE_AT_Commands_Manual_V1.5 - 15 -
GSM FILE AT Commands Manual
Final result code +CME ERROR: <err> indicates an error related to mobile equipment or
network. The operation is similar to ERROR result code. Neither ERROR nor OK result code
shall be returned. The listed <err> codes here are just related with File. About other <err> codes,
please refer to document [1].
l
3915 Non-existent address
3916 UFS storage full
e
3917 Drive full
t
3918 Drive error
c l
3919 File not found
a
3920 Invalid file name
e i
3921 File already existed
u t
3922 Failed to create file
n
3923 Failed to write file
3924 Failed to open file
Q ide
3925 Failed to read file
4000 Exceed max length
4001 Open file fail
f
4002 Write file fail
n
4003 Get size fail
4004 Read fail
o
4005 List file fail
4006 Delete file fail
C
4007 Get Disk info fail
4008 No space
4009 Time out
4010 File not found
4011 File too large
4012 File already exist
4013 Invalid parameter
4014 Driver error
4015 Create fail
4016 Access denied
GSM_FILE_AT_Commands_Manual_V1.5 - 16 -
GSM FILE AT Commands Manual
4. Reliable transmission
For reliable transmission , when using "AT+QFUPL" and "AT+QFDWL" to upload and
download file, it is recommended that users turn on hardware flow control capabilities, while also
open MCU hardware flow control function. Open the hardware flow control function for the
module via the AT+IFC=2,2<CRLF> command, which is enabled by default.
l
As general serial transmission is reliable, in order to further reliability, we offer additional ways to
verify the data transmission reliability by the command’s response information.
t e
When using "AT+QFUPL=<file name> [,<file size>]" command to upload a file, the module will
c l
report "+QFUPL: <upload size>, <checksum>" information tips at the end of data transmission.
a
Then MCU can judge whether the data has lost by comparing value of <upload size> with
e i
<checksum>.
u n t
<upload size> is the data length which the module received. MCU compares the <upload size>
with the actual length of the file. If unequal, it means the module lost data.
Q ide
<checksum> is calculated by doing XOR for every 2 bytes. Similarly MCU calculates the actual
file’s checksum as below example, and then compares this value with <checksum> which module
f
reports. If not equal, the received data may be problematic. User can re-upload the data.
n
Example for calculating checksum:
o
If the uploaded file data length is 9, the 16 hex values are as follows:
0x23 0x13 0x65 0x B6 0x76 0x88 0xA3 0xEF 0x55
C
So, checksum is calculated as follows:
checksum = 0x2313 XOR 0x65B6 XOR 0x7688 XOR 0xA3EF XOR 0x5500
Every two data form a group and do XOR with another group. If the last group is less than 2 bytes,
supplement with 0x00.
Similarly, the module will report the "+QFDWL: <download size>,<checksum>" information
when command "AT+QFDWL=<file name>" is completed. <download size> is the actual size
of downloaded data, MCU can calculate received data length, and compare it with <download
size>. If not equal, the data is lost. MCU also can do checksum calculation and comparison with
<checksum>. If not equal, it is needed to re-download the file.
GSM_FILE_AT_Commands_Manual_V1.5 - 17 -
GSM FILE AT Commands Manual
When it is needed to use the AT + QFUPL command to upload large files, and UART hardware
flow control is turned off, it is recommended to use the ACK Mode.
el
For example:
t
AT+QFUPL="test.txt",3000 // Upload the text file “test.txt” to UFS
l
CONNECT
c
<input file bin data of 1024bytes>
e ia
A // After receiving 1024bytes data, the module
t
will respond with an “A”, then next 1024 bytes
u
data can be input
n
<input file bin data of 1024bytes>
Q ide
A
<input the rest file bin data>
+QFUPL: 3000,B34A
f
OK
o n
C
GSM_FILE_AT_Commands_Manual_V1.5 - 18 -
GSM FILE AT Commands Manual
5. Examples
l
OK
e
AT+QFDWL="test.txt" // Download the file “test.txt” from UFS
t
CONNECT
c l
<output file bin data>
a
+QFDWL: 3222,B3E4
u e t i
OK
n
AT+QFUPL="RAM:test2.txt",4222 // Upload the text file “test2.txt” to RAM
Q ide
CONNECT
<input file bin data>
+QFUPL: 4222,13E4
f
OK
n
// Download the picture file “pic1.jpg” from
o
AT+QFDWL="SD:pic1.jpg",13222
SD card
CONNECT
C
<input file bin data>
+QFDWL: 13222,D5E4
OK
User can move file(s) among RAM, UFS and SD card by command “AT+QFMOV”. Please note
that the file cannot be moved from UFS or SD card to RAM. Here list examples of moving single
file and all files.
GSM_FILE_AT_Commands_Manual_V1.5 - 19 -
GSM FILE AT Commands Manual
OK
AT+QFLST="*" // UFS also has one file “pic.jpg”, but the file size is
different
+QFLST: "pic.jpg",62076
OK
l
AT+QFMOV="RAM:pic.jpg","pic.jpg",1,0
+CME ERROR: 3921 // Move file “pic.jpg” from RAM to UFS. “1” means
e
NOT deleting source file after file is copied, “0”
t l
means Do not overwrite the destination file if it
c
exists. Because the destination file has existed,
a
so it responds ERROR 3921 (File already existed).
e i
The file is not moved. If user confirms the file can be
u t
overwritten, set the last parameter as “1” as below.
n
AT+QFMOV="RAM:pic.jpg","pic.jpg",1,1 // Move file successfully. The source file
“pic.jpg” in RAM is not deleted. The
Q ide
destination file “pic.jpg” in UFS has been
overwritten.
OK
f
AT+QFLST="RAM:*"
+QFLST: "RAM:Pic.jpg",63388,75000
o n
OK
AT+QFLST="*"
C
+QFLST: "pic.jpg",63388
OK
AT+QFLST="RAM:*"
+QFLST: "RAM:pic0.jpg",59024,75000
+QFLST: "RAM:pic1.jpg",62592,75000
+QFLST: "RAM:pic2.jpg",57168,75000
+QFLST: "RAM:pic3.jpg",63216,75000
GSM_FILE_AT_Commands_Manual_V1.5 - 20 -
GSM FILE AT Commands Manual
+QFLST: "RAM:pic4.jpg",64600,75000
+QFLST: "RAM:pic5.jpg",60284,75000
OK
AT+QFLST="SD:*"
OK
AT+QFMOV="RAM:*","SD:*",0,0
OK // Move all files in RAM to SD, the first “0” means
deleting source files after files are copied, the
second “0” means Do not overwrite the destination
l
file if it exists. SD has not these files, so the last
parameter is meaningless in this case.
e
AT+QFLST="RAM:*" // Source files are deleted.
t
OK
c l
AT+QFLST="SD:*" // All files in RAM have been moved to SD card.
a
+QFLST: "SD:pic0.jpg",59024
u e t i
+QFLST: "SD:pic1.jpg",62592
n
+QFLST: "SD:pic2.jpg",57168
Q ide
+QFLST: "SD:pic3.jpg",63216
f
+QFLST: "SD:pic4.jpg",64600
n
+QFLST: "SD:pic5.jpg",60284
o
OK
C
5.3. Read/write file
OK
OK
GSM_FILE_AT_Commands_Manual_V1.5 - 21 -
GSM FILE AT Commands Manual
t el
e c ia l
u n t
Q ide
n f
Co
GSM_FILE_AT_Commands_Manual_V1.5 - 22 -
Shanghai Quectel Wireless Solutions Co., Ltd.
Room 501, Building 13, No.99, Tianzhou Road, Shanghai, China 200233
Tel: +86 21 5108 6236
Mail: [email protected]