Quectel AG35 FILE AT Commands Manual V1.0
Quectel AG35 FILE AT Commands Manual V1.0
Quectel AG35 FILE AT Commands Manual V1.0
AT Commands Manual
Rev. AG35_FILE_AT_Commands_Manual_V1.0
Date: 2017-10-13
www.quectel.com
LTE Module Series
AG35 FILE AT Commands Manual
Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
l
http://quectel.com/support/sales.htm
e
For technical support, or to report documentation errors, please visit:
t
http://quectel.com/support/technical.htm
c l
Or email to: [email protected]
u e t ia
GENERAL NOTES
n
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
Q ide
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
f
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.
COPYRIGHT
o n
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
C
QUECTEL WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION
AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE
FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF
DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR
REGISTRATION OF A UTILITY MODEL OR DESIGN.
Copyright © Quectel Wireless Solutions Co., Ltd. 2017. All rights reserved.
History
el
Revision Date Author Description
t l
Asa WANG/
c
1.0 2017-10-13 Initial
Mandy WANG
u e t ia
Q ide n
n f
Co
Contents
1 Introduction .......................................................................................................................................... 5
1.1. The Process of Using File AT Commands .............................................................................. 5
1.2. Description of Data Mode ........................................................................................................ 6
l
2.1. AT+QFLDS Get the Space Information of the Storage......................................................... 7
2.2. AT+QFLST List Files ............................................................................................................. 8
t e
2.3. AT+QFDEL Delete a File in Storage ..................................................................................... 9
l
2.4. AT+QFUPL Upload a File to Storage.................................................................................. 10
c
2.5. AT+QFDWL Download a File from Storage........................................................................ 12
a
2.6. AT+QFOPEN Open a File .................................................................................................. 13
e i
2.7. AT+QFREAD Read a File ................................................................................................... 14
u t
2.8. AT+QFWRITE Write a File.................................................................................................. 14
n
2.9. AT+QFSEEK Set File Pointer to a Position ........................................................................ 15
2.10. AT+QFPOSITION Get the Offset of a File Pointer ............................................................. 16
Q ide
2.11. AT+QFTUCAT Truncate a File from the File Pointer .......................................................... 17
2.12. AT+QFCLOSE Close a File ................................................................................................ 17
f
3 Examples ............................................................................................................................................ 19
3.1. Upload and Download Files .................................................................................................. 19
n
3.1.1. Upload a File .................................................................................................................. 19
3.1.1.1. Non ACK Mode ..................................................................................................... 19
o
3.1.1.2. ACK Mode ............................................................................................................ 19
3.1.2. Download a File ............................................................................................................. 20
C
3.2. Write and Read Files ............................................................................................................. 20
3.2.1. Write and Read a UFS File ............................................................................................ 20
3.2.2. Write and Read a RAM File ........................................................................................... 21
Table Index
t el
e c ia l
u n t
Q ide
n f
Co
1 Introduction
Quectel AG35 module provides AT commands to operate files on different physical storage mediums.
This document is a reference guide to these commands.
l
UFS: User File Storage directory. It is a special directory on the flash file system.
t e
SD: SD card directory.
l
RAM: Random Access Memory. It is faster but much smaller than the UFS. And the files in RAM will
c
be lost when rebooting the module.
e ia
The file name will indicate the storage location. When the file name begins with “RAM:”, it means the file is
u t
stored in RAM. When the file name begins with “SD:”, it means the file is stored in SD card. If there are no
n
prefix characters in the file name, the file is stored in UFS.
Q ide
1.1. The Process of Using File AT Commands
n f
The following procedures can be followed to create, read and write a file in the storage:
o
1. A file can be uploaded to the storage by AT+QFUPL, and can be outputted/downloaded through the
serial interface by command AT+QFDWL.
C
2. Open the file by AT+QFOPEN, and then the file can be written or read at any time and any location
until the file is closed by AT+QFCLOSE.
When the file is opened by AT+QFOPEN, it can be set as overwrite mode or read-only mode or
others by the parameter <mode>. (For more information about <mode>, please refer to Chapter
2.6). After the file is opened, a <file_handle> is assigned to it. Then the file can be operated via
this <file_handle>.
After the file is opened, it can be written by AT+QFWRITE and can be read by AT+QFREAD from
the current file position.
The file position can be set by AT+QFSEEK and the current position can be queried by
AT+QFPOSITION.
AT+QFTUCAT will truncate the file from the current position to the end of the file.
AT+QFCLOSE is used to close the file, after which the <file_handle> becomes meaningless any
more.
The COM port of AG35 module has two working modes: AT command mode and data mode. In AT
l
command mode, the inputted data via COM port will be treated as AT command. While in data mode, it
will be treated as data.
t e l
Inputting “+++” or pulling up DTR (AT&D1 should be set first) can make the COM port exit from data mode.
c
To prevent the “+++” from being misinterpreted as data, the following sequence should be followed:
e ia
Do not input any character within 1s or longer before inputting “+++”.
t
1)
u
2) Input “+++” within 1s, and no other characters can be inputted during the time.
n
3) Do not input any character within 1s after “+++” has been inputted.
Q ide
When AT+QFUPL, AT+QFDWL, AT+QFREAD and AT+QFWRITE are executed, the COM port will enter
data mode. If customers are using “+++” or DTR to make the port exit from data mode, the executing
procedure of these commands will be interrupted before the response is returned. In such case, the COM
f
port cannot reenter data mode by executing ATO command.
o n
C
AG35_FILE_AT_Commands_Manual Confidential / Released 6 / 24
LTE Module Series
AG35 FILE AT Commands Manual
l
The command responds the space information of the specified storage.
t e
AT+QFLDS Get the Space Information of the Storage
l
Test Command Response
c
AT+QFLDS=? OK
e ia
Write Command Response
t
AT+QFLDS=<name_pattern> +QFLDS: <free_size>,<total_size>
u n
OK
Q ide
Or
+CME ERROR: <err>
Execution Command Response
f
AT+QFLDS Return the UFS information
+QFLDS: <UFS_file_size>,<UFS_file_number>
n
OK
o
Or
+CME ERROR: <err>
C
Parameter
Example
AT+QFLDS="RAM" //Query the space information of RAM.
+QFLDS: 2616320,2621440
OK
AT+QFLDS="UFS" //Query the space information of UFS.
+QFLDS: 49180672,49205248
OK
AT+QFLDS="SD" //Query the space information of SD.
+QFLDS: 251920384,253132800
el
OK
2.2. AT+QFLST
c t a
List Files
l
u e t i
The command lists the information of a single file or all files in the specified storage medium.
n
Q ide
AT+QFLST List Files
Test Command Response
AT+QFLST=? OK
f
Write Command Response
AT+QFLST=<name_pattern> +QFLST: <file_name>,<file_size>
n
[+QFLST: <file_name>,<file_size>
[…]]
o
OK
C
Or
+CME ERROR: <err>
Execution Command Response
AT+QFLST Return the information of the UFS files:
+QFLST: <file_name>,<file_size>
[+QFLST: <file_name>,<file_size>
[…]]
OK
Or
+CME ERROR: <err>
Parameter
l
<err> The code of an error relating to ME or network. Please refer to Chapter 4
for details.
t e l
Example
c a
AT+QFLST="*" //List all the file in UFS.
e i
+QFLST: "F_M12-1.bmp",562554
u t
+QFLST: "F_M12-10.bmp",562554
n
+QFLST: "F_M12-11.bmp",562554
Q ide
OK
AT+QFLST="RAM:*" //List all the file in RAM.
+QFLST: "RAM:F_AG35-1.bmp",56554
f
+QFLST: "RAM:F_AG35-10.bmp",56554
+QFLST: "RAM:F_AG35-11.bmp",56554
o n
OK
AT+QFLST="SD:*" //List all the file in SD.
+QFLST: "SD:10b.txt",10
C
+QFLST: "SD:50K.txt",51209
+QFLST: "SD:94k.jpg",95811
OK
The command deletes a single file or all the files in the specified storage.
OK
Write Command Response
AT+QFDEL=<file_name> OK
Or
+CME ERROR: <err>
Parameter
<file_name> Name of the file to be deleted. The max length of <file_name> is 80 bytes.
“*” Delete all the files in UFS (not delete the directory).
l
“<file_name>” Delete the specified file <file_name> in UFS.
“RAM:*” Delete all the files in RAM.
t e
“RAM:<file_name>” Delete the specified file <file_name> in RAM.
l
“SD:*” Delete all the files in SD card (not delete the directory).
c
“SD:<file_name>” Delete the specified file <file_name> in SD card.
e a
<err> The code of an error relating to ME or network. Please refer to Chapter 4
t i
for details.
u n
Example
Q ide
AT+QFDEL="*"
OK
AT+QFLST="RAM:*"
f
OK
n
AT+QFLST="SD:*"
OK
Co
2.4. AT+QFUPL Upload a File to Storage
The command can be used to upload a file to storage. If there is any file in the storage which has the
same name with the file to be uploaded, an error will be reported.
After executing the Write Command and “CONNECT” returns, the module will switch to data mode. When
the uploaded data reaches <file_size>, or there is no any data inputted when <timeout> reaches, then it
will exit from data mode automatically. During data transmission, customers can use “+++” or DTR to
make the module exit from data mode, and more details are provided in Chapter 1.2.
OK
OK
l
Or
+CME ERROR: <err>
t e l
Parameter
e c ia
<free_size> The free space size of <name_pattern>. Please refer to AT+QFLDS command for
t
more details of <name_pattern>.
u
<file_name> Name of the file to be uploaded. The maximum length is 80 bytes.
n
“<file_name>” Name of the file to be uploaded to UFS.
Q ide
“RAM:<file_name>” Name of the file to be uploaded to RAM.
“SD:<file_name>” Name of the file to be uploaded to SD card.
<file_size> The file size expected to be uploaded.
The default value is 10240. Unit: byte.
f
<upload_size> The actual size of the uploaded data. Unit: byte.
n
<timeout> The time waiting for data to be inputted to USB/UART. The default value is 5. Unit: s.
<ackmode> Whether to use ACK mode.
o
0 Turn off the ACK mode by default.
1 Turn on the ACK mode.
C
<checksum> The checksum of the uploaded data.
<err> The code of an error relating to ME or network. Please refer to Chapter 4
for details.
NOTES
1. It is strongly recommended to use DOS 8.3 file name format for <file_name>.
2. <checksum> is a 16 bit checksum based on bitwise XOR.
If the number of the characters is odd, set the last character as the high 8 bit, and the low 8 bit as 0,
and then use an XOR operator to calculate the checksum. “+++” sequence will cause TA to end the
command and switch to command mode. However, the data previously uploaded will be preserved
into the file.
3. When executing the command, the data must be entered after “CONNECT” is returned.
4. The ACK mode is provided to avoid the loss of data when uploading large files, in case hardware flow
l
The command downloads a specified file from the storage.
t e
AT+QFDWL Download a File from Storage
c l
Test Command Response
AT+QFDWL=? +QFDWL: <file_name>
e t ia
OK
u
Write Command Response
n
AT+QFDWL=<file_name> CONNECT
Q ide
TA switches to data mode, and the binary data of the file will
be outputted. When the file is read over, TA will return to
command mode and reply the following codes:
f
+QFDWL: <download_size>,<checksum>
n
OK
Or
o
+CME ERROR: <err>
C
Parameter
NOTES
1. “+++” sequence will cause TA to end the command and switch to command mode.
2. <checksum> is a 16 bit checksum based on bitwise XOR.
The command can be used to open a file and get the file handle to be used in commands such as
l
AT+QFREAD, AT+QFWRITE, AT+QFSEEK, AT+QFPOSITION, AT+QFTUCAT and AT+QCLOSE.
e
AT+QFOPEN Open a File
t
Test Command Response
c l
AT+QFOPEN=? +QFOPEN: <file_name>[,(0-2)]
e ia
OK
t
Read Command Response
u
AT+QFOPEN? +QFOPEN: <file_name>,<file_handle>,<mode>
n
[+QFOPEN: <file_name>,<file_handle>,<mode>
Q ide
[…]]
OK
f
Write Command Response
AT+QFOPEN=<file_name>[,<mode>] +QFOPEN: <file_handle>
n
OK
o
Or
+CME ERROR: <err>
C
Parameter
The command reads the data of a file which is specified by the file handle. The data starts from the
current position of the file pointer which belongs to the file handle.
l
AT+QFREAD Read a File
e
Test Command Response
t
AT+QFREAD=? +QFREAD: <file_handle>[,<length>]
c l
OK
e ia
Write Command Response
t
AT+QFREAD=<file_handle>[,<length> CONNECT <read_length>
u
] TA switches to data mode. When the total size of the data
n
reaches <length> (unit: byte), TA will return to command
Q ide
mode, display the result and then reply the following codes:
OK
Or
+CME ERROR: <err>
n f
Parameter
o
<file_handle> The handle of the file to be operated.
C
<length> The length of the file to be read out and the default is the file length.
<read_length> The actual read length.
<err> The code of an error relating to ME or network. Please refer to Chapter 4
for details.
The command is used to write data into a file. The data starts from the current position of the file pointer
which belongs to the file handle.
OK
Write Command Response
AT+QFWRITE=<file_handle>[,<length CONNECT
>[,<timeout>]] TA switches to data mode. When the total size of the written
data reaches <length> (unit: byte) or the time reaches
<timeout>, TA will return to command mode and reply the
l
following codes:
+QFWRITE: <written_length>,<total_length>
t e l
OK
c
Or
a
+CME ERROR: <err>
u e t i
Parameter
Q ide n
<file_handle> The handle of the file to be operated.
<length> The length of the file to be written, and the default length is 10K. The maximum
value of this parameter is determined by <free_size> of AT+QFUPL.
f
<timeout> The time waiting for data to be inputted to USB/UART. The default value is 5.
Unit: s.
n
<written_length> The actual written length.
<total_length> The total length of the file.
o
<err> The code of an error relating to ME or network. Please refer to Chapter 4
for details.
2.9. AT+QFSEEK
The command sets a file pointer to a specified position. This will decide the starting position of commands
such as AT+QFREAD, AT+QFWRITE, AT+QFPOSITION and AT+QFTUCAT.
OK
Parameter
l
0 The beginning of the file.
1 The current position of the pointer.
e
2 The end of the file.
t
<err> The code of an error relating to ME or network. Please refer to Chapter 4
c l
for details.
e t ia
NOTES
u
If <position> is 0 and <offset> exceeds the file size, the command will return “ERROR”.
n
1.
2. If <position> is 1 and the total size of <offset> and the current position of the pointer exceed the file
Q ide
size, the command will return “ERROR”.
3. If <position> is 2, the handle will move forth.
n f
2.10. AT+QFPOSITION Get the Offset of a File Pointer
o
The command gets the offset of a file pointer from the beginning of the file.
C
AT+QFPOSITION Get the Offset of a File Pointer
Test Command Response
AT+QFPOSITION=? +QFPOSITION: <file_handle>
OK
Write Command Response
AT+QFPOSITION=<file_handle> +QFPOSITION: <offset>
OK
Or
+CME ERROR: <err>
Parameter
l
The command will truncate all the data behind the position that the file pointer indicates.
e
AT+QFTUCAT Truncate a File from the File Pointer
t l
Test Command Response
c
AT+QFTUCAT=? +QFTUCAT: <file_handle>
e t ia
OK
u
Write Command Response
n
AT+QFTUCAT=<file_handle> OK
Q ide
Or
+CME ERROR: <err>
f
Parameter
n
<file_handle> The handle of the file to be operated.
o
<err> The code of an error relating to ME or network. Please refer to Chapter 4
for details.
2.12. AT+QFCLOSE
C Close a File
The command closes a file and ends the operation to the file. After that, the file handle is released and
should not be used again, unless open the file again with AT+QFOPEN.
OK
Write Command Response
AT+QFCLOSE=<file_handle> OK
Or
+CME ERROR: <err>
Parameter
t el
e c ia l
u n t
Q ide
n f
Co
3 Examples
l
3.1.1. Upload a File
t e
3.1.1.1. Non ACK Mode
c a l
AT+QFUPL="test1.txt",10 //Upload the text file “test1.txt” to UFS.
e i
CONNECT
u t
<Input file bin data>
n
+QFUPL: 10,3938
Q ide
OK
AT+QFUPL="RAM:test1.txt",10 //Upload the text file “RAM:test1.txt” to RAM.
CONNECT
f
<Input file bin data>
+QFUPL: 10,6466 //Get the bytes of the uploaded data and the checksum.
n
OK
C
3.1.1.2. ACK Mode
o
The ACK mode can make the data transmission more reliable. When transmitting a large file without
hardware flow control, the ACK mode is recommended to be used to prevent the data from being lost. For
more details about ACK mode, please refer to AT+QFUPL command.
OK
<Output Data>
el
+QFDWL: 10,613e //Get the bytes of the downloaded data and the checksum.
t l
OK
e c t ia
u
3.2. Write and Read Files
Q ide n
3.2.1. Write and Read a UFS File
f
OK
n
AT+QFWRITE=0,10 //Write 10 bytes to the file.
o
CONNECT
C
<Write Data>
+QFWRITE: 10,10 //The actual bytes written and the size of the file are returned.
OK
AT+QFSEEK=0,0,0 //Set the file pointer to the beginning of the file.
OK
AT+QFREAD=0,10 //Read 10 bytes from the file.
CONNECT 10
<Read Data>
OK
AT+QFCLOSE=0 //Close the file.
OK
OK
AT+QFOPEN="RAM:1",0 //Open the file in the RAM.
+QFOPEN: 3000
OK
AT+QFWRITE=3000,10 //Write 10 bytes to the file.
l
CONNECT
<Write Data>
e
+QFWRITE: 10,10 //The actual written bytes and the size of the file are returned.
c t l
OK
a
AT+QFSEEK=3000,0,0 //Set the file pointer to the beginning of the file.
e i
OK
u t
AT+QFREAD=3000,10 //Read the data.
n
CONNECT
<Read Data>
Q ide
OK
AT+QFCLOSE=3000 //Close the file.
f
OK
o n
C
AG35_FILE_AT_Commands_Manual Confidential / Released 21 / 24
LTE Module Series
AG35 FILE AT Commands Manual
l
Table 1: Summary of Error Codes
t e l
<err> Meaning
c a
400 Invalid input value
e t i
401 Larger than the size of the file
u n
402 Read zero byte
Q ide
403 Drive full
f
406 Invalid file name
n
407 File already exists
o
409 Fail to write the file
C
410 Fail to open the file
420 No space
t el
e c ia l
u n t
Q ide
n f
Co
5 Appendix A Reference
Abbreviation Description
l
COM Communication Port
t e
DOS Disk Operating System
c l
ME Mobile Equipment
e ia
RAM Random Access Memory
u n t
SD Secure Digital
Q ide
TA Terminal Adapter
f
UFS User File Storage
n
USB Universal Serial Bus
Co