Quectel BG96 FILE AT Commands Manual V1.0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 23

DownloadQuectel BG96 FILE AT Commands Manual V1.0
Open PDF In BrowserView PDF
BG96 FILE
AT Commands Manual
LTE Module Series
Rev. BG96_FILE_AT_Commands_Manual_V1.0
Date: 2018-01-24
Status: Released

www.quectel.com

LTE Module Series
BG96 FILE AT Commands Manual

Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
Quectel Wireless Solutions Co., Ltd.
7th Floor, Hongye Building, No.1801 Hongmei Road, Xuhui District, Shanghai 200233, China
Tel: +86 21 5108 6236
Email: info@quectel.com

Or our local office. For more information, please visit:
http://quectel.com/support/sales.htm

For technical support, or to report documentation errors, please visit:
http://quectel.com/support/technical.htm
Or email to: support@quectel.com

GENERAL NOTES
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
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
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.

COPYRIGHT
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
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. 2018. All rights reserved.

BG96_FILE_AT_Commands_Manual

1 / 22

LTE Module Series
BG96 FILE AT Commands Manual

About the Document
History
Revision

Date

Author

Description

1.0

2018-01-24

Matt YE/
Kennen WU

Initial

BG96_FILE_AT_Commands_Manual

2 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Contents
About the Document ................................................................................................................................... 2
Contents ....................................................................................................................................................... 3
Table Index ................................................................................................................................................... 4
1

Introduction .......................................................................................................................................... 5
1.1.
The Process of Using File AT Commands .............................................................................. 5
1.2.
Description of Data Mode ........................................................................................................ 6

2

Description of FILE AT Commands ................................................................................................... 7
2.1.
AT+QFLDS Get the Space Information of UFS .................................................................... 7
2.2.
AT+QFLST List Files ............................................................................................................. 8
2.3.
AT+QFDEL Delete Files ....................................................................................................... 9
2.4.
AT+QFUPL Upload a File ..................................................................................................... 9
2.5.
AT+QFDWL Download a File.............................................................................................. 11
2.6.
AT+QFOPEN Open a File .................................................................................................. 12
2.7.
AT+QFREAD Read a File ................................................................................................... 13
2.8.
AT+QFWRITE Write a File.................................................................................................. 13
2.9.
AT+QFSEEK Set File Pointer to a Position ........................................................................ 14
2.10.
AT+QFPOSITION Get the Offset of a File Pointer ............................................................. 15
2.11.
AT+QFTUCAT Truncate a File from the File Pointer .......................................................... 16
2.12.
AT+QFCLOSE Close a File ................................................................................................ 16

3

Examples ............................................................................................................................................ 18
3.1.
Upload and Download Files .................................................................................................. 18
3.1.1. Upload a File .................................................................................................................. 18
3.1.1.1. Non ACK Mode ..................................................................................................... 18
3.1.1.2. ACK Mode ............................................................................................................ 18
3.1.2. Download a File ............................................................................................................. 19
3.2.
Write and Read Files ............................................................................................................. 19
3.2.1. Write and Read a UFS File ............................................................................................ 19

4

Summary of ERROR Codes .............................................................................................................. 20

5

Appendix A Reference....................................................................................................................... 22

BG96_FILE_AT_Commands_Manual

3 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Table Index
TABLE 1: SUMMARY OF ERROR CODES ...................................................................................................... 20
TABLE 2: TERMS AND ABBREVIATIONS ........................................................................................................ 22

BG96_FILE_AT_Commands_Manual

4 / 22

LTE Module Series
BG96 FILE AT Commands Manual

1

Introduction

Quectel BG96 module provides AT commands to operate files on UFS (User File Storage directory, a
special directory on the flash file system). This document is a reference guide to these commands.

1.1. The Process of Using File AT Commands
The following illustrates the procedure to create, read and write a file in UFS of BG96:
1.

A file can be uploaded to UFS by AT+QFUPL, and can be outputted/downloaded through the serial
interfaces by AT+QFDWL.

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.





3.

When the file is opened by AT+QFOPEN, it can be set as overwrite mode or read-only mode or
others by the parameter . (For more information about , please refer to Chapter
2.6). After the file is opened, a  is assigned to it. Then the file can be operated via
this .
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  becomes meaningless any more.

The following are several commonly used commands to manage files in UFS:
1.
2.
3.

AT+QFLDS: Get the storage size
AT+QFLST: List the file information in UFS.
AT+QFDEL: Delete the file(s)

BG96_FILE_AT_Commands_Manual

5 / 22

LTE Module Series
BG96 FILE AT Commands Manual

1.2. Description of Data Mode
The COM port of BG96 module has two working modes: AT command mode and data mode. In AT
command mode, the inputted data via COM port will be treated as AT command. While in data mode, it
will be treated as data.
Inputting “+++” or pulling up DTR (AT&D1 should be set first) can make the COM port exit from data mode.
To prevent the “+++” from being misinterpreted as data, the following sequence should be followed:
1)
2)
3)

Do not input any character within 1s or longer before inputting “+++”.
Input “+++” within 1s, and no other characters can be inputted during the time.
Do not input any character within 1s after “+++” has been inputted.

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
port cannot reenter data mode by executing ATO command.

BG96_FILE_AT_Commands_Manual

6 / 22

LTE Module Series
BG96 FILE AT Commands Manual

2

Description of FILE AT Commands

2.1. AT+QFLDS

Get the Space Information of UFS

The command responds the space information of UFS.

AT+QFLDS

Get the Space Information of UFS

Test Command
AT+QFLDS=?

Response
OK

Write Command
AT+QFLDS=

Response
+QFLDS: ,
OK
If there is any error:
+CME ERROR: 

Execution Command
AT+QFLDS

Response
Return the UFS information:
+QFLDS: ,
OK
If there is any error:
+CME ERROR: 

Parameter


Storage pattern.
“UFS”
UFS

The free space size of . Unit: byte.

The total size of . Unit: byte.

The size of all files in UFS. Unit: byte
 The number of files in UFS.

An error code relating to ME or network. Please refer to Chapter 4 for details.

BG96_FILE_AT_Commands_Manual

7 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Example
AT+QFLDS="UFS"
+QFLDS: 12987840,14483456

//Query the space information of UFS.

OK

2.2. AT+QFLST

List Files

The command lists the information of a specified file or all files in UFS.

AT+QFLST

List Files

Test Command
AT+QFLST=?

Response
OK

Write Command
AT+QFLST=

Response
+QFLST: ,
[+QFLST: ,
[…]]
OK
If there is any error:
+CME ERROR: 

Execution Command
AT+QFLST

Response
Return the information of the UFS files:
+QFLST: ,
[+QFLST: ,
[…]]
OK
If there is any error:
+CME ERROR: 

Parameter






The file to be listed.
“*”
All the files in UFS.
“”
A specified file  in UFS.
Name of the file.
Size of the file. Unit: byte.
An error code relating to ME or network. Please refer to Chapter 4 for details.

BG96_FILE_AT_Commands_Manual

8 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Example
AT+QFLST="*"
+QFLST: "F_M12-1.bmp",562554
+QFLST: "F_M12-10.bmp",562554
+QFLST: "F_M12-11.bmp",562554

//List all the file in UFS.

2.3. AT+QFDEL Delete Files
The command deletes a specified file or all the files in UFS.

AT+QFDEL Delete Files
Test Command
AT+QFDEL=?

Response
+QFDEL: 
OK

Write Command
AT+QFDEL=

Response
OK
If there is any error:
+CME ERROR: 

Parameter




Name of the file to be deleted. The maximum length of  is 80 bytes.
“*”
Delete all the files in UFS (not delete the directory).
“”
Delete a specified file  in UFS.
An error code relating to ME or network. Please refer to Chapter 4 for details.

Example
AT+QFDEL="*"
OK

2.4. AT+QFUPL Upload a File
The command can be used to upload a file to UFS. If there is any file in UFS which has the same name
with the file to be uploaded, an error will be reported.

BG96_FILE_AT_Commands_Manual

9 / 22

LTE Module Series
BG96 FILE AT Commands Manual

After executing the Write Command and “CONNECT” returns, the module will switch to data mode. When
the uploaded data reaches , or there is no any data inputted when  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.

AT+QFUPL Upload a File
Test Command
AT+QFUPL=?

Response
+QFUPL: [,(1-)[,(1-65535)[,(0,1)]]]
OK

Write Command
AT+QFUPL=[,[,
[,]]]

Response
CONNECT
TA switches to the data mode (transparent access mode), and
the binary data of file can be inputted. When the total size of
the inputted data reaches  (unit: byte), TA will
return to command mode and reply the following codes:
+QFUPL: ,
OK
If there is any error:
+CME ERROR: 

Parameter










The free space size of . Please refer to AT+QFLDS command for
more details of .
Name of the file to be uploaded. The maximum length is 80 bytes.
“”
Name of the file to be uploaded to UFS.
The file size expected to be uploaded.
The default value is 10240. Unit: byte.
The actual size of the uploaded data. Unit: byte.
The time waiting for data to be inputted to USB/UART. The default value is 5. Unit: s.
Whether to use ACK mode.
0
Turn off the ACK mode by default.
1
Turn on the ACK mode.
The checksum of the uploaded data.
An error code relating to ME or network. Please refer to Chapter 4 for details.

BG96_FILE_AT_Commands_Manual

10 / 22

LTE Module Series
BG96 FILE AT Commands Manual

NOTES
1.
2.

3.
4.

It is strongly recommended to use DOS 8.3 file name format for .
 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.
When executing the command, the data must be entered after “CONNECT” is returned.
The ACK mode is provided to avoid the loss of data when uploading large files, in case hardware flow
control does not work. The ACK mode works as follows:
1) Run AT+QFUPL=,,,1 command to enable the ACK mode.
2) BG96 outputs “CONNECT”.
3) MCU sends 1K bytes data, and then BG96 will respond with an “A”.
4) MCU receives this “A” and then sends the next 1K bytes data;
5) Repeat step 3) and 4) until the transfer is completed.

2.5. AT+QFDWL Download a File
The command downloads a specified file from UFS.

AT+QFDWL Download a File
Test Command
AT+QFDWL=?

Response
+QFDWL: 
OK

Write Command
AT+QFDWL=

Response
CONNECT
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:
+QFDWL: ,
OK
If there is any error:
+CME ERROR: 

Parameter


Name of the file to be downloaded. The maximum length is 80 bytes.

BG96_FILE_AT_Commands_Manual

11 / 22

LTE Module Series
BG96 FILE AT Commands Manual



”
Name of the UFS file to be downloaded.
The size of the downloaded data. Unit: byte.
The checksum of the downloaded data.
An error code relating to ME or network. Please refer to Chapter 4 for details.

NOTES
1. “+++” sequence will cause TA to end the command and switch to command mode.
2.  is a 16 bit checksum based on bitwise XOR.

2.6. AT+QFOPEN

Open a File

The command can be used to open a file and get the file handle to be used in commands such as
AT+QFREAD, AT+QFWRITE, AT+QFSEEK, AT+QFPOSITION, AT+QFTUCAT and AT+QCLOSE.

AT+QFOPEN Open a File
Test Command
AT+QFOPEN=?

Response
+QFOPEN: [,(0-2)]
OK

Read Command
AT+QFOPEN?

Response
+QFOPEN: ,,
[+QFOPEN: ,,
[…]]
OK

Write Command
AT+QFOPEN=[,]

Response
+QFOPEN: 
OK
If there is any error:
+CME ERROR: 

Parameter




Name of the file to be opened. The maximum length is 80 bytes.
“”
Name of the UFS file to be opened.
The handle of the file. The data type is 4 bytes.
The open mode of the file.
0 If the file does not exist, it will be created. If the file exists, it will be directly

BG96_FILE_AT_Commands_Manual

12 / 22

LTE Module Series
BG96 FILE AT Commands Manual



opened. And both of them can be read and written.
1 If the file does not exist, it will be created. If the file exists, it will be overwritten
and cleared. And both of them can be read and written.
2 If the file exists, open it and it can be read only. When the file does not exist, it
will respond an error.
An error code relating to ME or network. Please refer to Chapter 4 for details.

2.7. AT+QFREAD

Read a File

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.

AT+QFREAD

Read a File

Test Command
AT+QFREAD=?

Response
+QFREAD: [,]
OK

Write Command
AT+QFREAD=[,]

Response
CONNECT 
TA switches to data mode. When the total size of the data
reaches  (unit: byte), TA will return to command
mode, display the result and then reply the following codes:
OK
If there is any error:
+CME ERROR: 

Parameter





The handle of the file to be operated.
The length of the file to be read out and the default is the file length. Unit: byte.
The actual read length. Unit: byte.
An error code relating to ME or network. Please refer to Chapter 4 for details.

2.8. AT+QFWRITE

Write a File

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.

BG96_FILE_AT_Commands_Manual

13 / 22

LTE Module Series
BG96 FILE AT Commands Manual

AT+QFWRITE

Write a File

Test Command
AT+QFWRITE=?

Response
+QFWRITE: [,[,]]
OK

Write Command
AT+QFWRITE=[,
[,]]

Response
CONNECT
TA switches to data mode. When the total size of the written
data reaches  (unit: byte) or the time reaches
, TA will return to command mode and reply the
following codes:
+QFWRITE: ,
OK
If there is any error:
+CME ERROR: 

Parameter







The handle of the file to be operated.
The length of the file to be written, and the default length is 10K. The maximum
value of this parameter is determined by  of AT+QFUPL. Unit: byte.
The time waiting for data to be inputted to USB/UART. The default value is 5.
Unit: s.
The actual written length. Unit: byte.
The total length of the file. Unit: byte.
An error code relating to ME or network. Please refer to Chapter 4 for details.

2.9. AT+QFSEEK

Set File Pointer to a Position

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.

AT+QFSEEK Set File Pointer to a Position
Test Command
AT+QFSEEK=?

Response
+QFSEEK: ,[,]
OK

BG96_FILE_AT_Commands_Manual

14 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Write Command
AT+QFSEEK=,[,<
position>]

Response
OK
If there is any error:
+CME ERROR: 

Parameter






The handle of the file to be operated.
The number of bytes of the file pointer movement.
Pointer movement mode.
0
The beginning of the file.
1
The current position of the pointer.
2
The end of the file.
An error code relating to ME or network. Please refer to Chapter 4 for details.

NOTES
1.
2.
3.

If  is 0 and  exceeds the file size, the command will return “ERROR”.
If  is 1 and the total size of  and the current position of the pointer exceed the file
size, the command will return “ERROR”.
If  is 2, the handle will move forth.

2.10. AT+QFPOSITION Get the Offset of a File Pointer
The command gets the offset of a file pointer from the beginning of the file.

AT+QFPOSITION Get the Offset of a File Pointer
Test Command
AT+QFPOSITION=?

Response
+QFPOSITION: 
OK

Write Command
AT+QFPOSITION=

Response
+QFPOSITION: 
OK
If there is any error:
+CME ERROR: 

BG96_FILE_AT_Commands_Manual

15 / 22

LTE Module Series
BG96 FILE AT Commands Manual

Parameter




The handle of the file to be operated.
The offset from the beginning of the file.
An error code relating to ME or network. Please refer to Chapter 4 for details.

2.11. AT+QFTUCAT

Truncate a File from the File Pointer

The command will truncate all the data behind the position that the file pointer indicates.

AT+QFTUCAT

Truncate a File from the File Pointer

Test Command
AT+QFTUCAT=?

Response
+QFTUCAT: 
OK

Write Command
AT+QFTUCAT=

Response
OK
If there is any error:
+CME ERROR: 

Parameter



The handle of the file to be operated.
An error code relating to ME or network. Please refer to Chapter 4 for details.

2.12. AT+QFCLOSE

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.

AT+QFCLOSE

Close a File

Test Command
AT+QFCLOSE=?

Response
+QFCLOSE: 
OK

Write Command
AT+QFCLOSE=

BG96_FILE_AT_Commands_Manual

Response
OK

16 / 22

LTE Module Series
BG96 FILE AT Commands Manual

If there is any error:
+CME ERROR: 

Parameter



The handle of the file to be operated.
An error code relating to ME or network. Please refer to Chapter 4 for details.

BG96_FILE_AT_Commands_Manual

17 / 22

LTE Module Series
BG96 FILE AT Commands Manual

3

Examples

3.1. Upload and Download Files
3.1.1. Upload a File
3.1.1.1. Non ACK Mode
AT+QFUPL="test1.txt",10
CONNECT

+QFUPL: 10,3938

//Upload the text file “test1.txt” to UFS.

OK

3.1.1.2. ACK Mode
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.
AT+QFUPL="test.txt",3000,5,1
CONNECT

A

//Upload the text file “test.txt” to UFS.

//After receiving 1024 bytes data, BG96 will respond
an “A”. And then the next 1024 bytes data can be
inputted.


A

+QFUPL: 3000,B34A
OK

BG96_FILE_AT_Commands_Manual

18 / 22

LTE Module Series
BG96 FILE AT Commands Manual

3.1.2. Download a File
//Download the text file “test.txt” from UFS.

AT+QFDWL="test.txt"
CONNECT

+QFDWL: 10,613e

//Get the bytes of the downloaded data and the checksum.

OK

3.2. Write and Read Files
3.2.1. Write and Read a UFS File
AT+QFOPEN="test",0
+QFOPEN: 0
OK
AT+QFWRITE=0,10
CONNECT

+QFWRITE: 10,10
OK
AT+QFSEEK=0,0,0
OK
AT+QFREAD=0,10
CONNECT 10

OK
AT+QFCLOSE=0
OK

BG96_FILE_AT_Commands_Manual

//Open the file to get the file handle.

//Write 10 bytes to the file.

//The actual bytes written and the size of the file are returned.

//Set the file pointer to the beginning of the file.
//Read 10 bytes from the file.

//Close the file.

19 / 22

LTE Module Series
BG96 FILE AT Commands Manual

4

Summary of ERROR Codes

The error code  indicates an error related to mobile equipment or network. The details about 
are described in the following table, and these error codes are only related to file operation of BG96
module.

Table 1: Summary of Error Codes


Meaning

400

Invalid input value

401

Larger than the size of the file

402

Read zero byte

403

Drive full

405

File not found

406

Invalid file name

407

File already existed

409

Fail to write the file

410

Fail to open the file

411

Fail to read the file

413

Reach the max number of file allowed to be opened

414

The file read-only

416

Invalid file descriptor

417

Fail to list the file

418

Fail to delete the file

419

Fail to get disk info

BG96_FILE_AT_Commands_Manual

20 / 22

LTE Module Series
BG96 FILE AT Commands Manual

420

No space

421

Time out

423

File too large

425

Invalid parameter

426

File already opened

BG96_FILE_AT_Commands_Manual

21 / 22

LTE Module Series
BG96 FILE AT Commands Manual

5

Appendix A Reference

Table 2: Terms and Abbreviations
Abbreviation

Description

COM

Communication Port

DOS

Disk Operating System

ME

Mobile Equipment

TA

Terminal Adapter

UART

Universal Asynchronous Receiver-Transmitter

UFS

User File Storage

USB

Universal Serial Bus

BG96_FILE_AT_Commands_Manual

22 / 22



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Encryption                      : Standard V4.4 (128-bit)
User Access                     : Print, Copy, Extract, Print high-res
Author                          : Eileen
Create Date                     : 2018:01:24 11:17:44+08:00
Modify Date                     : 2018:01:24 11:21:35+08:00
Language                        : zh-CN
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-20:48:00
Format                          : application/pdf
Creator                         : Eileen
Creator Tool                    : Microsoft® Word 2016
Metadata Date                   : 2018:01:24 11:21:35+08:00
Producer                        : Microsoft® Word 2016
Document ID                     : uuid:3a483c73-900c-4aed-bda1-e71dafba97f5
Instance ID                     : uuid:fadcc8c5-eeaa-4183-80e3-ea7afa652923
Page Mode                       : UseOutlines
Page Count                      : 23
EXIF Metadata provided by EXIF.tools

Navigation menu