HCM111Z AT Commands Manual

Introduction

This document outlines the general AT commands and BLE related AT commands supported by Quectel HCM111Z module.

Definitions

  • <op> Carriage return character.
  • <LF> Line feed character.
  • <...> Parameter name. Angle brackets do not appear on the command line.
  • [...] Optional parameter of a command or an optional part of TA information response. Square brackets do not appear on the command line. When an optional parameter is not given in a command, the new value equals its previous value or the default settings, unless otherwise specified.
  • Underline Default setting of a parameter.

AT Command Syntax

All command lines must start with AT or at and end with <CR>. Information responses and result codes always start and end with a carriage return character and a line feed character: <CR><LF>. In tables presenting commands and responses throughout this document, only the commands and responses are presented, and <CR> and <LF> are deliberately omitted.

AT commands implemented by HCM111Z fall into two categories syntactically: "Basic" and "Extended", as listed below:

  • Basic Command

    These AT commands have the format of AT, or AT&, where <x> is the command, and <n> is/are the argument(s) for that command. An example of this is ATE, which tells the DCE (Data Circuit-terminating Equipment) whether received characters should be echoed back to the DTE (Data Terminal Equipment) according to the value of <n>. <n> is optional and a default will be used if it is omitted.

  • Extended Command

    Extended commands can be executed in several modes, as shown in the following table.

Types of AT Commands:

Command Type Syntax Description
Test Command AT+<cmd>=? Tests if the command exists and returns info about its type, value, or range.
Read Command AT+<cmd>? Reads the current parameter value of the command.
Write Command AT+<cmd>=<p1>[,<p2>[,<p3>]] Sets user-definable parameter values.
Execution AT+<cmd> Returns specific info or performs an action.

AT Command Input and Responses

Spaces should be ignored when you enter AT commands, except in the following cases:

  • Within quoted strings, where spaces are preserved;
  • Within an unquoted string or numeric parameter;
  • Within an IP address;
  • Within the AT command name up to and including a =, ? or =?.

On input, at least a carriage return is required. A newline character is ignored so it is permissible to use carriage return/line feed pairs on the input.

If no command is entered after the AT token, OK will be returned. If an invalid command is entered, ERROR will be returned.

Optional parameters, unless explicitly stated, need to be provided up to the last parameter being entered.

AT Command Responses

When the AT command processor has finished processing a line, it will output OK, ERROR or +CME ERROR: to indicate that it is ready to accept a new command. Solicited information responses are sent before the final OK, ERROR or +CME ERROR: .

Responses will be in the format of:

<CR>+CMD1: <LF>

<CR>OK<LF>

Or

<CR><LF>

<CR>OK<LF>

Declaration of AT Command Examples

The AT command examples in this document are provided to help you learn about the use of the AT commands introduced herein. The examples, however, should not be taken as Quectel's recommendations or suggestions about how to design a program flow or what status to set the module into. Sometimes multiple examples may be provided for one AT command. However, this does not mean that there is a correlation among these examples, or that they should be executed in a given sequence. The URLs, domain names, IP addresses, usernames/accounts, and passwords (if any) in the AT command examples are provided for illustrative and explanatory purposes only, and they should be modified to reflect your actual usage and specific needs.

AT Commands Description

Description of General AT Commands

AT+QRST

Description: Reboots the module.

Command Format:

AT+QRST

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: None

AT+QVERSION

Description: Gets the firmware version of the module.

Command Format:

AT+QVERSION

Response:

  • +QVERSION: \nOK (success)
  • ERROR (failure)

Parameter:

  • <version>: String type without double quotation marks. Firmware version number.

Maximum Response Time: 300 ms

Characteristics: None

AT+QECHO

Description: Enables or disables echo function.

Command Format:

AT+QECHO=<enable>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <enable>: Integer type. Enable/Disable echo function. 0 = Disable, 1 = Enable.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

AT+QSETBAUD

Description: Sets serial port baud rate and writes the baud rate to Flash.

Command Format:

AT+QSETBAUD=<baud_rate>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <baud_rate>: Integer type. Serial port baud rate. The values of the baud rate are 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800 and 921600. Unit: bps.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is saved automatically.

AT+QTXPOWER

Description: Sets TX power and writes the TX power to Flash.

Command Format:

AT+QTXPOWER? (read)

or

AT+QTXPOWER=<TX_power> (write)

Response:

  • +QTXPOWER: <TX_power>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <TX_power>: Integer type. TX power. Range: -16 to 10. Default value: 0. Unit: dBm.

Maximum Response Time: 300 ms

Characteristics: Takes effect after the module is rebooted. Configuration is saved automatically.

AT+QCFGRI

Description: Enables or disables RI pin, configures the latency of URC output after the RI pin level flip and sets the duration of the RI pin low-level state.

Command Format:

AT+QCFGRI=<RI_enable>[,<URC_delay>[,<RI_hold>]]

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <RI_enable>: Integer type. Enable or disable RI pin. The RI pin corresponds to ADC3 pin on module. 0 = Disable, 1 = Enable.
  • <URC_delay>: Integer type. The latency of URC output after the RI pin level flip. The parameter is only valid when <RI_enable> is 1. Range: 10--50. Default value: 20. Unit: ms.
  • <RI_hold>: Integer type. The duration of the RI pin low-level state. The parameter is only valid when <RI_enable> is 1. Range: 10--50. Default value: 20. Unit: ms.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

Note:
The RI pin level is high by default. After the RI pin is enabled through AT+QCFGRI=1,20,20, it switches to a low level for 20 ms. When the state of the RI pin in low level is ended and then after 20 ms, the URC is output.

AT+QBLEINIT

Description: Initializes BLE functionality. You only need to execute the command once to initialize BLE functionality after the module is booted.

Command Format:

AT+QBLEINIT? (read)

or

AT+QBLEINIT=<role>[,<auto_adv>] (write)

Response:

  • +QBLEINIT: <role>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <role>: Integer type. Set module role when initializing BLE functionality.
    • 1: Set module as a central device
    • 2: Set module as a peripheral device. The advertisement is turned on automatically by default after the BLE disconnection. If you do not need this feature, you can execute AT+QBLEINIT=2,0 during BLE functionality initialization to turn it off.
    • 4: Set module as a multi-connectable device. A maximum of 2 central devices and 5 peripheral devices can be connected to the module simultaneously.
  • <auto_adv>: Integer type. Whether the advertisement is turned on automatically after the BLE disconnection when the module is operating as a peripheral device or a multi-connectable device. 0 = Not turn on advertisement, 1 = Turn on advertisement.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

AT+QBLEADDR

Description: Queries BLE device address.

Command Format:

AT+QBLEADDR?

Response:

  • +QBLEADDR: <BLE_addr>\nOK (success)
  • ERROR (failure)

Parameter:

  • <BLE_addr>: String type. BLE device address. 48-bit address as hexadecimal string, e.g. "58D391010203".

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLENAME

Description: Sets the BLE device name.

Command Format:

AT+QBLENAME? (read)

or

AT+QBLENAME=<BLE_name> (write)

Response:

  • +QBLENAME: <BLE_name>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <BLE_name>: String type. BLE device name. Max length: 25 bytes. Default: "HCM111Z".

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is saved automatically.

AT+QBLEADVPARAM

Description: Configures BLE advertising parameters when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEADVPARAM? (read)

or

AT+QBLEADVPARAM=<adv_int_min>,<adv_int_max> (write)

Response:

  • +QBLEADVPARAM: <adv_int_min>,<adv_int_max>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <adv_int_min>: Integer type. Minimum advertising interval for non-directional and low duty cycle directional advertising. Range: 32--16384 (Time range: 20 ms--10.24 s). Default value: 160 (100 ms). Unit: timeslot (1 timeslot = 0.625 ms).
  • <adv_int_max>: Integer type. Maximum advertising interval for non-directional advertising and low duty cycle directional advertising. Range: 32--16384 (Time range: 20 ms--10.24 s). Default value: 160 (100 ms). Unit: timeslot (1 timeslot = 0.625 ms).

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

Note:
The BLE advertising parameters configured by AT+QBLEADVPARAM can only take effect after the BLE advertising is started again.

AT+QBLEADVDATA

Description: Sets BLE advertising data when the module is operating as a peripheral device or a multi-connectable device.

BLE Advertising Format

Command Format:

AT+QBLEADVDATA=<adv_data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <adv_data>: String type without double quotation marks. Advertising data (AD). It consists of multiple AD Structure fields and should comply with the BLE advertising format. The fields included are as follows:
    • Length: Length of AD Structure. The length includes AD Type and AD Data but not 1-byte length of the Length field itself. The maximum length is 0x1e, i.e., the maximum length of a Data field is 30 bytes.
    • AD Type: Advertising data type, such as TX Power Level (0x0A), Local Name (0x09), Le Role (0x1C) and Service UUIDs (0x16). After the peer scans the advertisement, the meaning of the advertising data can be determined from the AD Type.
    • AD Data: Advertising data in big-endian byte order.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

Note:
For details of AD types, see Core Specification 5.2 (https://www.bluetooth.com/specifications/specs/core-specification/).

AT+QBLESRDATA

Description: Sets BLE scan response data when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLESRDATA=<sr_data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <sr_data>: String type without double quotation marks. Scan response data, which is similar to <adv_data>.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

AT+QBLEGATTSSRV

Description: Establishes a BLE service when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEGATTSSRV=<srv_UUID>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <srv_UUID>: String type without double quotation marks. BLE service UUID. Length: 4 bytes or 32 bytes.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

Note:
Only two BLE services can be established at most through the command. And the BLE service cannot be established repeatedly.
You must first initialize the BLE functionality through AT+QBLEINIT to set the module as a peripheral device or a multi-connectable device, and then establish a BLE service through AT+QBLEGATTSSRV. Otherwise, the BLE advertising, scan and connection functions will not operate correctly.

AT+QBLEGATTSCHAR

Description: Sets BLE characteristic UUID when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEGATTSCHAR=<char_UUID>[,<att_cfg>]

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <char_UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <att_cfg>: Integer type. Property configuration of characteristic UUID. Range: 0--255. bit7--bit0 represent different properties:
    • bit0: Write
    • bit1: Write no response
    • bit2: Notify
    • bit3: Indicate
    • bit4: Read
    • bit5--bit7: Reserve

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

Note:
Only five BLE characteristic UUIDs can be set at most for a service through this command. And the BLE characteristic UUIDs cannot be established repeatedly. When <att_cfg> is omitted, the property of each characteristic UUID is Read, Notify and Write no response by default.
When the module is operating as a peripheral or a multi-connectable device, this command should be used to set a BLE characteristic UUID after creating a BLE service through AT+QBLEGATTSSRV. Otherwise, functions such as BLE advertising, scanning and connection will not operate correctly.

AT+QBLEGATTSSRVDONE

Description: Completes the BLE service establishment when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEGATTSSRVDONE

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: None

Note:
When the module is operating as a peripheral device or a multi-connectable device, you must set BLE characteristic UUID through AT+QBLEGATTSCHAR, and then complete the BLE service establishment through the command. Otherwise, the BLE advertising, scan and connection functions will not operate correctly.

AT+QBLEADVSTART

Description: Starts BLE advertising when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEADVSTART? (read)

or

AT+QBLEADVSTART (execute)

Response:

  • +QBLEADVSTART: <adv_state>\nOK (read)
  • OK (execute success)
  • ERROR (failure)

Parameter:

  • <adv_state>: Integer type. Advertising state. 0 = The advertising is stopped, 1 = The advertising is started.

Maximum Response Time: 1000 ms

Characteristics: None

AT+QBLEADVSTOP

Description: Stops BLE advertising when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEADVSTOP

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEGATTSNTFY

Description: Sends GATT data by notification when the module is operating as a peripheral device or a multi-connectable device.

Command Format:

AT+QBLEGATTSNTFY=<conn_idx>,<UUID>[,<hex_length>],<data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a peripheral device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <hex_length>: Integer type. Hex data length. The module will convert <data> to hexadecimal format before sending data when this optional parameter is used.
  • <data>: String type without double quotation marks. GATT data.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEGATTSCFGREAD

Description: Configures BLE characteristic UUID with read property when the module is operating as a peripheral device.

Command Format:

AT+QBLEGATTSCFGREAD=<UUID>[,<hex_length>],<data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <hex_length>: Integer type. Hex data length. The module will convert <data> to hexadecimal format before sending data when this optional parameter is used.
  • <data>: String type without double quotation marks. GATT data. The maximum length: 64 bytes.

Maximum Response Time: 300 ms

Characteristics: None

Note:
This command can be used only after the BLE service is added.

AT+QBLESCAN

Description: Enables or disables BLE scan when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLESCAN? (read)

or

AT+QBLESCAN=<scan>[,<timeout>] (write)

Response:

  • +QBLESCAN: <scan_state>\nOK (read)
  • OK (write success)
  • +QBLESCAN: <name>,<address_type>,<BLE_addr> (when <scan>=1)
  • +QBLESCAN: <name>,<address_type>,<BLE_addr>,<RSSI>,<adv_data> (when <scan>=2 or 3)
  • ERROR (failure)

Parameter:

  • <scan_state>: Integer type. The current scan state. 0 = The scan is stopped, 1 = The scan is started.
  • <scan>: Integer type. Enable/disable BLE scan.
    • 0: Disable
    • 1: Enable BLE scan but do not output <adv_data>
    • 2: Enable BLE scan and output <adv_data>. It is required to specify <timeout> in this mode.
    • 3: Enable BLE scan and output <adv_data>. Only the connectable advertising is scanned in this mode.
  • <timeout>: Integer type. Scan duration. Range: 500--10000. Unit: ms. It must be set when <scan> is 2.
  • <name>: String type without double quotation marks. Scanned BLE device name.
  • <address_type>: Integer type. BLE device address type. 0 = Public address, 1 = Random address.
  • <BLE_addr>: String type without double quotation marks. BLE device address. 48-bit address as hexadecimal string.
  • <RSSI>: Integer type. The signal strength value.
  • <adv_data>: String type without double quotation marks. Scanned BLE data and response data.

Maximum Response Time: 1000 ms

Characteristics: None

AT+QBLESCANPARAM

Description: Queries or sets BLE scan parameters when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLESCANPARAM? (read)

or

AT+QBLESCANPARAM=<scan_interval>,<scan_window> (write)

Response:

  • +QBLESCANPARAM: <scan_interval>,<scan_window>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <scan_interval>: Integer type. BLE scan interval. Range: 18--4096 (Time range: 11.25 ms to 2.56 s). Default value: 100 (62.5 ms). Unit: timeslot (1 timeslot = 0.625 ms).
  • <scan_window>: Integer type. BLE scan duration. <scan_window> shall be less than or equal to <scan_interval>. Range: 17--4096 (Time range: 10.625 ms--2.56 s). Default value: 30 (18.75 ms). Unit: timeslot (1 timeslot = 0.625 ms).

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

Note:
The configured scan parameters do not take effect immediately during the scan process. You must disable the scan and then enable the scan again. After that, the parameters can take effect.

AT+QBLESCANKWSET

Description: Sets the keyword filtering.

Command Format:

AT+QBLESCANKWSET=<enable>[,<keyword_num>[,<keyword1>[,<keyword2>[,<keyword3>[,<keyword4>[,<keyword5>]]]]]]

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <enable>: Integer type. Enable or disable keyword filtering. 0 = Disable, 1 = Enable.
  • <keyword_num>: Integer type. Number of keywords. Range: 0--5.
  • <keywordx>: String type without double quotation marks. The keywords of the target device advertisement data.

Maximum Response Time: 1000 ms

Characteristics: Takes effect immediately. Configurations are not saved.

AT+QBLECONN

Description: Connects to a peripheral device when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLECONN=<addr_type>,<peer_addr>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <addr_type>: Integer type. Peripheral device address type. 0 = Public address, 1 = Random address.
  • <peer_addr>: String type without double quotation marks. Peripheral device address.

Maximum Response Time: 3000 ms

Characteristics: Takes effect immediately. Configurations are not saved. The connection timeout is 15 seconds.

AT+QBLECONNPARAM

Description: Configures connection parameters when the module is operating as a peripheral device or a central device.

Command Format:

AT+QBLECONNPARAM? (read)

or

AT+QBLECONNPARAM=<con_interval>,<timeout>,<latency> (write)

Response:

  • +QBLECONNPARAM: <con_interval>,<timeout>,<latency>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <con_interval>: Integer type. Connection interval. Range: 6--3200 (Time range: 7.5 ms--4 s). Default value: 40 (50 ms). Unit: 1.25 ms.
  • <timeout>: Integer type. BLE Link supervision timeout. Range: 10--3200 (Time range: 100 ms--32 s). Default value: 500 (5 s). Unit: 10 ms.
  • <latency>: Integer type. Number of connection events skipped by the peripheral device. Range: 0--499 (0x0000--0x01F3). Default value: 0.

Maximum Response Time: 300 ms

Characteristics: None

Note:
The relationship among <con_interval>, <timeout> and <latency> should be as follows: <con_interval> × <latency> is less than the value of <timeout>.

AT+QBLEGATTCRD

Description: Reads GATT data when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLEGATTCRD=<conn_idx>,<UUID>

Response:

  • OK
  • <data>
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a central device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <data>: String type without double quotation marks. The read GATT data.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

AT+QBLEGATTCWR

Description: Sends GATT data by writing commands when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLEGATTCWR=<conn_idx>,<UUID>[,<hex_length>],<data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a central device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <hex_length>: Integer type. Hex data length. The module will convert <data> to hexadecimal format before sending data when this optional parameter is used.
  • <data>: String type without double quotation marks. GATT data.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEGATTCWRREQ

Description: Sends GATT data by writing requests when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLEGATTCWRREQ=<conn_idx>,<UUID>[,<hex_length>],<data>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a central device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <hex_length>: Integer type. Hex data length. The module will convert <data> to hexadecimal format before sending data when this optional parameter is used.
  • <data>: String type without double quotation marks. GATT data.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEGATTCNTFCFG

Description: Enables or disables notification when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLEGATTCNTFCFG=<conn_idx>,<UUID>,<enable>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a central device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <enable>: Integer type. Enable/Disable notification. 0 = Disable, 1 = Enable.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEGATTCINDCFG

Description: Enables or disables indication when the module is operating as a central device or a multi-connectable device.

Command Format:

AT+QBLEGATTCINDCFG=<conn_idx>,<UUID>,<enable>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. When the module operates as a central device, the value of <conn_idx> is fixed as 0.
  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.
  • <enable>: Integer type. Enable/Disable indication. 0 = Disable, 1 = Enable.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEDISCONN

Description: Disconnects a BLE connection when the module is operating as a central device or a peripheral device.

Command Format:

AT+QBLEDISCONN

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEIDXDISC

Description: Disconnects the BLE connection with a specific device when the module is operating as a multi-connectable device.

Command Format:

AT+QBLEIDXDISC=<conn_idx>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

AT+QBLESTAT

Description: Queries the state of BLE device when the module is operating as a peripheral device or a central device.

Command Format:

AT+QBLESTAT

Response:

  • +QBLESTAT: <BLE_state>\nOK (success)
  • ERROR (failure)

Parameter:

  • <BLE_state>: String type. Current state of BLE device.
    • NOINIT: Uninitialized
    • INIT: Initialized
    • ADVERTISING: Advertising
    • CONNECTED: Connected
    • DISCONNECTED: Disconnected

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLEIDXCONNSTAT

Description: Queries the BLE connection state of a specified device when the module is operating as a multi-connectable device.

Command Format:

AT+QBLEIDXCONNSTAT=<conn_idx>

Response:

  • +QBLEIDXCONNSTAT: <conn_idx>,<conn_state>\nOK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6.
  • <conn_state>: Integer type. BLE connection state. 0 = Disconnected, 1 = Connected.

Maximum Response Time: 300 ms

Characteristics: None

AT+QBLECONNLIST

Description: Queries the list of connected devices when the module is operating as a multi-connectable device.

Command Format:

AT+QBLECONNLIST

Response:

  • +QBLECONNLIST: <conn_idx>[,<peer_role>,<MTU_value>,<BLE_addr>]\n...\nOK (success)
  • ERROR (failure)

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6.
  • <peer_role>: Integer type. Peer device role. 0 = Central device, 1 = Peripheral device.
  • <MTU_value>: Integer type. Maximum transmission unit value. Range: 23--247. Unit: byte.
  • <BLE_addr>: String type without double quotation marks. Peer device address. 48-bit address as hexadecimal string.

Maximum Response Time: 500 ms

Characteristics: None

Note:
When you execute AT+QBLECONNLIST to query the list of connected devices, if there is no BLE connection for the peer device index, <peer_role>, <MTU_value> and <BLE_addr> are omitted. for example: +QBLECONNLIST:<conn_idx>,,,

AT+QBLETRANMODE

Description: Specifies the characteristic UUID and enables the module to enter transparent transmission mode when the module is operating as a peripheral device or central device.

Command Format:

AT+QBLETRANMODE=<UUID>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.

Maximum Response Time: 500 ms

Characteristics: Takes effect immediately. Configuration is not saved.

Note:
When the module is operating as a central device, after establishing the BLE connection and having completed the discovering of peer device service (URC: +QBLEINFO: "DOWN"), execute the command to set the module to transparent transmission mode. After disconnecting the BLE connection, the module exits transparent transmission mode automatically. You can only send data in transparent transmission mode by writing commands.
When the module is operating as a peripheral device, after enabling advertising or establishing the BLE connection, execute the command to set the module to transparent transmission mode. If automatic advertising is enabled, the module does not exit transparent transmission mode after the BLE connection is terminated. If the automatic advertising is disabled, the module exits transparent transmission mode automatically after the BLE connection is terminated. You can only send data in transparent transmission mode by Notify.

AT+QBLETRANMODES

Description: Specifies a characteristic UUID, enables the module to enter transparent transmission mode and saves the current parameter configuration when the module is operating as a peripheral device or a central device. After the module reboots, it automatically operates according to the previous parameter configurations and uses the saved characteristic UUID to enter transparent transmission mode.

Command Format:

AT+QBLETRANMODES=<UUID>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <UUID>: String type without double quotation marks. Characteristic UUID. Length: 4 bytes or 32 bytes.

Maximum Response Time: 300 ms

Characteristics: None

Note:
Use AT+QBLETRANMODES to save the current parameters, including advertising data, BLE device name, scan response data, advertising interval, BLE service UUID, BLE characteristic UUID set through AT+QBLEGATTSCHAR, and the characteristic UUID specified by AT+QBLETRANMODES.
After AT+QBLETRANMODES is executed, if you need to modify the saved parameters, execute +++ to exit transparent transmission mode, execute AT+QBLESERVERENV=0 to clear the saved parameters, and then reconfigure the parameters after the module is reset.
Execute AT+QBLEGATTSSRVDONE to completes the BLE service establishment before saving the configured parameters through AT+QBLETRANMODES.

+++

Description: Enables the module to exit the transparent transmission mode.

Command Format:

+++

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. The command does not require <LF>.

AT+QBLEPAIRENABLE

Description: Enables or disables BLE pairing with other devices when the module is operating as a peripheral device.

Command Format:

AT+QBLEPAIRENABLE? (read)

or

AT+QBLEPAIRENABLE=<enable> (write)

Response:

  • +QBLEPAIRENABLE: <enable>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <enable>: Integer type. Enable or disable BLE pairing with other devices.
    • 0: Disable
    • 1: Enable. PIN code is not required for pairing.
    • 2: Enable. PIN code is required for pairing.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is not saved.

Note:
This command must be executed before the creation of BLE service, and can only be executed once after the module is powered on.
When pairing function is enabled, the module adds the HID service to the service list.

AT+QBLERFCHALCFG

Description: Enables or disables the BLE channels in a specified range. There are 40 BLE channels with 2 MHz spacing. Channels 37, 38, and 39 are advertising channels, while the others are data channels.

BLE Channels

Command Format:

AT+QBLERFCHALCFG=<op>[,<start_chl>,<end_chl>]

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <op>: Integer type. Enable or disable the BLE channels in a specified range.
    • 0: Disable
    • 1: Enable all channels.
  • <start_chl>: Integer type. BLE channel. Range: 0--39. It can be configured only when <op> is 0. When this parameter is used with <end_chl>, it indicates that all channels between <start_chl>--<end_chl> are disabled.
  • <end_chl>: Integer type. BLE channel. Range: 0--39. It can be configured only when <op> is 0. When this parameter is used with <start_chl>, it indicates that all channels between <start_chl>--<end_chl> are disabled.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configurations are not saved.

Note:
This command must be executed after the BLE service is added.
Do not disable all advertising channels.
A maximum of 20 channels can be disabled.
Disabling the channel will increase the frequency-hopping probability and narrow the frequency-hopping interval, which will reduce the BLE performance. Please use in caution.

AT+QBLESERVERENV

Description: Saves or clears the configured parameters when the module is operating as a peripheral device. If the configured parameters are saved successfully, they are still valid after the module is rebooted.

Command Format:

AT+QBLESERVERENV=<env>

Response:

  • OK (success)
  • ERROR (failure)

Parameter:

  • <env>: Integer type. Save/Clear configured parameters.
    • 0: Clear the configured parameters
    • 1: Save the configured parameters, including the advertising data, BLE device name, the scan response data, the advertising interval, service UUID and characteristic UUID.

Maximum Response Time: 300 ms

Characteristics: None

Note:
If you need to save the parameters that have been cleared, you need to configure the corresponding parameters through the related commands again after the module is rebooted, and then save the related parameters through the command.
You must complete the BLE service establishment through AT+QBLEGATTSSRVDONE first, and then save the configured parameters through the command.

AT+QBLEPASSCODECFG

Description: Queries or sets the PIN code for pairing when the module is operating as a peripheral device.

Command Format:

AT+QBLEPASSCODECFG? (read)

or

AT+QBLEPASSCODECFG=<passcode> (write)

Response:

  • +QBLEPASSCODECFG: <passcode>\nOK (read)
  • OK (write success)
  • ERROR (failure)

Parameter:

  • <passcode>: Integer type. PIN code for BLE pairing. Range: 000000--999999. After the module is powered on and reset for the first time, a 6-digit PIN code is randomly generated and saved.

Maximum Response Time: 300 ms

Characteristics: Takes effect immediately. Configuration is saved automatically.

AT+QBLECLRPAIRINFO

Description: Clears the BLE pairing information when the module is operating as a peripheral device.

Command Format:

AT+QBLECLRPAIRINFO

Response:

  • OK (success)
  • ERROR (failure)

Maximum Response Time: 300 ms

Characteristics: None

Description of URCs

+QBLESTAT

Description: This URC indicates BLE state changes.

URC Format:

+QBLESTAT: <event>

Parameter:

  • <event>: String type. Event reported when BLE state changes.
    • NOINIT: Uninitialized
    • INIT: Initialized
    • ADVERTISING: Advertising
    • CONNECTED: Connected
    • PAIRED: Paired
    • DISCONNECTED: Disconnected
    • TIMEOUT: Connection timeout event. This event is generated when the connection is not successfully established within 5 seconds after a connection request is sent to the specified device.

+QBLEMTU

Description: This URC indicates BLE MTU value changes.

URC Format:

+QBLEMTU: <MTU_value>

Parameter:

  • <MTU_value>: Integer type. Maximum transmission unit value. Range: 23--247. Unit: byte.

+QBLEINFO

Description: When the module successfully connects to the peer device as a central device or a multi-connectable device, the URC is reported to display the handle and characteristic UUID of the peer device.

URC Format:

+QBLEINFO: <handle> <UUID>

or

+QBLEINFO: DOWN

Parameter:

  • <handle>: Integer type. Handle of the connected peer device. Range: 0--255.
  • <UUID>: String type. Characteristic UUID of the connected peer device. Length: 4 bytes or 32 bytes.
  • "DOWN": Completion of discovering the peer device service.

+QBLEPEERINFO

Description: This URC indicates BLE device receives messages from peer after BLE connection, BLE disconnection or MTU update.

URC Format:

+QBLEPEERINFO: <conn_idx>,<peer_role>,<BLE_addr>

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6. The <conn_idx> in the +QBLEPEERINFO output after +QBLESTAT:CONNECTED indicates the index assigned by the module to the connected devices on the connected link.
  • <peer_role>: Integer type. Peer device role. 0 = Central device, 1 = Peripheral device.
  • <BLE_addr>: String type without double quotation marks. Peer device address. 48-bit address as hexadecimal string.

+QBLERECV

Description: This URC indicates BLE device receives data.

URC Format:

+QBLERECV: <conn_idx>,<UUID>,<length>\r\n<data>\r\n

Parameter:

  • <conn_idx>: Integer type. The peer device index assigned by the module automatically when the BLE connection is established. Range: 0--6.
  • <UUID>: Integer type. Characteristic UUID of the connected BLE device. Range: 0000--ffff.
  • <length>: Integer type. Length of received data. Unit: byte.
  • <data>: String type without double quotation marks. Received data.

Examples

Peripheral Role

During the connection establishment process, the BLE device that accepts the connection request is defined as the peripheral device. After the BLE connection is established, the peripheral device operates as a slave in the link layer.

Setting Module as a Peripheral Device

AT+QBLEINIT=2  // Set the module as a peripheral device for initializing BLE.
OK
AT+QBLEADVPARAM=150,150  // Set BLE advertising parameters.
OK
AT+QBLEGATTSSRV=fff1  // Establish a BLE service and set the service UUID to "fff1".
OK
AT+QBLEGATTSCHAR=fff2  // Set characteristic UUID to "fff2".
OK
AT+QBLEGATTSCHAR=fff3  // Set characteristic UUID to "fff3".
OK
AT+QBLEGATTSSRVDONE  // Complete the BLE service establishment.
OK
AT+QBLENAME=QuecHCM111Z  // Set BLE device name to "QuecHCM111Z".
OK
AT+QBLEADDR?  // Query BLE device address.
+QBLEADDR:D11:33:33:35:32:94
OK
AT+QBLEADVSTART  // Start BLE advertising.
OK

Connecting to nRF Connect Application

Step 1: Click "SCAN" to scan for peripheral devices, select "QuecHCM111Z" in the scan results and then click "CONNECT", as shown in the figure below.


Step 2: After the module is connected successfully, "CONNECTED" is displayed in the interface, and the added UUIDs is displayed in "CLIENT":

Sending Data to Module

Step 1: Select an editable characteristic, and click the upward arrow.

Step 2: Input the data to be sent in "TEXT" format. Then click "SEND", as shown in the figure below.

Once the data is sent successfully, the data received by the module is output via the serial port and displayed in the QCOM tool.Below is the URC indicating the received data. Below is the URC indicating the received data.

from phone

Sending Data to nRF Connect Application

Step 1: Use the QCOM tool to send the following command to send data to UUID 0xFFF3 by notification:

AT+QBLEGATTSNTFY=0,fff3,from HCM111Z
OK

Step 2: The received data is displayed in the Value field of the Unknown Characteristic with UUID 0xFFF3 in the nRF Connect application, as shown in the figure below.

Central Role

During the connection establishment process, the BLE device that initiates the connection request is defined as the central device. After the BLE connection is established, the central device operates as a host in the link layer.

Setting Module as a Central Device

AT+QBLEINIT=1  // Set the module as the central device for initializing BLE.
OK
AT+QBLESCAN=1  // Enable BLE scan.
OK
+QBLESCAN:test_phone,1,50081759010f
AT+QBLESCAN=0  // Disable BLE scan.
OK
AT+QBLECONN=1,50081759010f  // Connect a peripheral device.
OK
+QBLESTAT:CONNECTED
+QBLEMTU:247
+QBLEINFO: 8 2ac9
+QBLEINFO: 15 fff1
+QBLEINFO: 18 fff2
+QBLEINFO:DOWN
+QBLECONNPARAM:24,500,0

Configuring nRF Connect Application

Adding a Peripheral Device

Step 1: Start nRF Connect application. Then click "Configure GATT server", as shown in the figure below.

Step 2: Add a peripheral device named "HCM111Z". Set service UUID to 0xFFF1 and characteristic UUID to 0xFFF2, as shown in the figure below.

Adding Advertiser and Start Advertising

Step 1: Select "ADVERTISER" and click the "+" sign in the lower right corner, as shown in the figure below.


Step 2: First, input "test_phone" in "Display name". Then, click "Connectable" in "Options". Finally, click "OK".

Step 3: Advertising starts after the configuration is completed. You can set the advertisement duration manually, as shown in the figure below.


Sending Data to Module

Step 1: Select an editable characteristic, and click the upward arrow, as shown in the figure below.

Step 2: Input the data to be sent in "TEXT" format. Then click "SEND", as shown in the figure below.

Multi-connectable Device Role

The module can be connected as a peripheral device by central devices or connect peripheral devices as a central device. A maximum of 2 central devices and 5 peripheral devices can be connected to the module simultaneously.

AT+QBLEINIT=4  // Set the module as a multi-connectable device for initializing BLE.
OK
AT+QBLEGATTSSRV=fff1  // Establish a BLE service and set the service UUID to "fff1".
OK
AT+QBLEGATTSCHAR=fff2  // Set characteristic UUID to "fff2".
OK
AT+QBLEGATTSCHAR=fff3  // Set characteristic UUID to "fff3".
OK
AT+QBLEGATTSSRVDONE  // Complete the BLE service establishment.
OK
AT+QBLENAME=QuecHCM111Z  // Set BLE device name to "QuecHCM111Z".
OK
AT+QBLEADDR?  // Query BLE device address.
+QBLEADDR:D1:33:33:35:32:94
OK
AT+QBLEADVPARAM=150,150  // Set BLE advertising parameters.
OK
AT+QBLEADVSTART  // Start BLE advertising.
OK
+QBLESTAT:CONNECTED  // Connect a central device.
+QBLEPEERINFO:0,0,54:f9:67:e8:28:74  // The peer device information, including the index, role and MAC address.
+QBLEMTU:247  // MTU is 247 bytes.
+QBLEPEERINFO:0,0,54:f9:67:e8:28:74  // The peer device information, including the index, role and MAC address.
AT+QBLEADVSTART  // Start BLE advertising.
OK
+QBLESTAT:CONNECTED
+QBLEPEERINFO:1,0,5b:4d:48:bd:f5:14
+QBLEMTU:247  // MTU is 247 bytes.
+QBLEPEERINFO:1,0,5b:4d:48:bd:f5:14
AT+QBLESCAN=1  // Enable BLE scan.
OK
+QBLESCAN:Simple_Peripheral,1,cc3732356583  // The target peripheral device is scanned.
AT+QBLESCAN=0  // Disable BLE scan.
OK
AT+QBLECONN=1,cc3732356583  // Connect a peripheral device.
OK
+QBLESTAT:CONNECTED  // Successfully connection.
+QBLEPEERINFO:2,1,cc:37:32:35:65:83  // The peer device information, including the index, role and MAC address.
+QBLEMTU:247
+QBLEPEERINFO:2,1,cc:37:32:35:65:83
+QBLEINFO: 8 2ac9  // Service UUID of the peer device.
+QBLEINFO: 15 0783b03e8535b5a07140a304d2495cb8  // Service UUID of the peer device.
+QBLEINFO: 17 2901
+QBLEINFO: 19 0783b03e8535b5a07140a304d2495cba  // Service UUID of the peer device.
+QBLEINFO: 20 2901
+QBLEINFO: 22 fff3  // Service UUID of the peer device.
+QBLEINFO: 23 2901
+QBLEINFO:DOWN  // Completion of discovering the peer device service.
...
AT+QBLEGATTSNTFY=0,fff3,FROM BLE MASTER  // Send data to the target central device when the module is operating as a peripheral device.
OK
AT+QBLEGATTCWR=2,fff2,from HCM111Z  // Send data to the target peripheral device when the module is operating as a central device.
OK
AT+QBLEIDXDISC=0  // Disconnect the Bluetooth connection of the specific device.
OK
+QBLESTAT:DISCONNECTED  // Successful disconnection.
+QBLEPEERINFO:0,0,54:f9:67:e8:28:74  // The peer device information, including the index, role and MAC address.

Appendix References

Abbreviation Description
BLE Bluetooth Low Energy
DTE Data Terminal Equipment
GATT Generic Attribute Profile
LE Low Energy
MAC Medium Access Control
MTU Maximum Transmission Unit
RI Ring Indicator
TX Transmit
URC Unsolicited Result Code
UUID Universally Unique Identifier