BLE5.0 AT Command Set

Inplay BLE 5.0 AT Command Set #


INTRODUCTION #

Inplay IN6xx BLE module is a standard Bluetooth Low Energy (BLE) 5.0 certified RF module. It introduces a private service as interface of data streaming between two BLE devices transparently.

IN6xx BLE module provides the control interface based on ASCII commands, say AT commands. They are used to configure parameters, retrieve module state, control actions of module, etc. All configuration changes can be optionally remained in Non-Volatile Memory (Flash) and survive the following power cycle.

CONTROL INTERFACE #

The AT commands are transmitted over standard UART interface. A terminal emulator, such as TeraTerm (Windows) or CoolTerm (Mac OS-X®), can be used to control the module from a computer, with the following default port settings:

  • 115,200 bps
  • 8 bits
  • No Parity
  • 1 Stop bit
  • Hardware flow control disabled

The serial port parameter configure command can modify the UART settings permanently.

SYNTAX #

The AT commands can be divided into 3 main categories: Command, Response and Event. The module receives Command and, after execution, sends back Response to the command initiator. When something happens in the module, such as an unexpected disconnection, receiving data from a remote device, etc., a corresponding Event is sent.

COMMAND SYNTAX #

An AT command is composed of the Prefix, CommandID, CommandBody and Terminator as shown below.

                AT+<CommandID>=<CommandBody><Terminator>

The Prefix of each command is fixed ASCII string “AT” or “at”.

CommandID is an ASCII string representing different command. It’s case sensitive.

CommandBody can be either ASCII ‘?’ if the command gets a parameter or parameters set if the command sets parameter. A parameter set is a collection of parameters surrounded by ‘[]’, each separated by ‘,’.

Terminator of each command is carriage return (CR, ‘\r’, \x0d) and line feed (LF, ‘\n’, \x0a). Command is accepted and executed only when the Terminator is received.

RESPONSE SYNTAX #

After an AT command is executed, a response will be sent back. Response consists of corresponding CommandID, ResponseBody and Terminator as shown below.

                +<CommandID>=<ResponseBody><Terminator>

If command is to set parameter, the ResponseBody is either parameter set read or just a numerical error result code. The format of the read parameter set is same as the format of the set parameters of the corresponding command. Only result code is returned for set parameter commands.

EVENT SYNTAX #

An event is a message reported by the module initiatively, rather than a response obtained through the AT command. An event consists of EventID, EventBody and Terminator as shown in below.

                +<EventID>=<EventBody><Terminator>

EventID is an ASCII string representing different event. It’s case sensitive. EventBody is a parameter set and its format is same as CommandBody in AT command. Terminator is same as that in AT command response.

PARAMETER VALUE #

Parameter in parameter set supports numeric values, strings. There are three format of string: ASCII format string, Byte Array format string and Base64 encoding format string.

EXAMPLES #

The below table lists some examples of AT commands and their responses and events.

Command/EventFunctionResponse
AT+DEVCFG=[10,"112222222211",0,"Slave",1]Set device general configuration+DEVCFG=0000H
AT+DEVCFG=?Get device general configuration+DEVCFG=[10,"112222222211",0,"Slave",1]
AT+CFGADVACTV=[1,0,1,500,0,"BwlJbnBsYXk="]Create legacy connectable advertising in 500ms interval. The payload is local name "Inplay"+CFGADVACTV=0000H: successful
+CFGADVACTV=0043H: error advertising can't be create
-EVTCONN=[1,"EFBBCCCCDDEF",1,1]Connected with device "EF:DD:CC:CC:BB:EF" on 1M PHY

COMMAND REFERENCE #

This section describes AT commands in detail and provides examples. Those parameter surrounded by ‘<>’ brackets are optional in some cases. If an optional parameter needs to be set, all optional parameters prior to that optional parameter must also be provided.

Since the responseBody of the response returned by the get command is the same as the CommandBody of the corresponding set command, for simplicity, only the format of the get command is listed.

  1. Get Module State #

This command gets the current status of the module.

Command: AT+STATE=?

Response: +STATE=[sys_state,pair_state,conn_state,scan_state,adv_state]

ParameterTypeValue
sys_stateNumber0: Not ready;
1: Ready
pair_stateNumber0: Not paired;
1: Paired
conn_stateNumber0: Unconnected
1: Connecting
2: Connected
scan_stateNumber0: Scanning Stopped;
1: Scanning Started
adv_stateNumber0: Advertising Stopped;
1: Advertising Started

Example:

→AT+STATE=?
←+STATE=[1,0,0,0,0]

  • Get Version #

This command gets the version of the module including chip version, sdk version and firmware version

Command: AT+VER=?

Response: +VER=[chip_ver,sdk_ver,fw_ver]

ParameterTypeValue
chip_verStringChip version
sdk_verStringSDK version
fw_verStringFirmware version

Example:

→AT+VER=?
←+VER=[“602F0100”,“3.0.0”,“xxxx”]

  • UART Configuration #

This command sets UART parameters. Once UART parameter is changed, module will automatically reset and all parameters configured before will be lost.

Command: AT+CFGUART=[baud_rate,<data_bit>,,<stop_bit>]

Response: +CFGUART=err_code

ParameterTypeValue
baud_rateNumberStandard UART baud rate value
data_bitNumber5 - 8 bits
polarityNumber0:No polarity
1:Odd polarity
2:Even polarity
Other: invalid value
stop_bitNumber0: 1 stop bits
1: 2 stop bits

Example:

→AT+CFGUART=[921600,8,0,1]
←+CFGUART=0000H

  • Device General Configuration #

This command gets or sets the general parameters of the module.

Command: AT+CFGDEV=[role,dev_addr,addr_type,dev_name,phy]

Response: +CFGDEV=err_code

ParameterTypeValue
roleNumber
1Observer
2Broadcaster
5Central
10Peripheral
15All Role
dev_addrStringByte Array format string representing MAC address of device in little-endian mode
addr_typeNumber0: Public address;
1: Static random address
dev_nameStringASCII
phyNumber
0Random
11M Phy
22M Phy
4Coded Phy

Example:

//Set device as BLE Peripheral, device public MAC address is 11-22-22-22-22-11, device name is “Slave” and prefered PHY is 1M PHY
→AT+CFGDEV=[10,“112222222211”,0,“Slave”,1]
←+CFGDEV=0000H

//Set device as All role and prefered PHY is Coded Phy
→AT+CFGDEV=[15,“AABB0101BBAA”,0,“Slave”,4]
←+CFGDEV=0000H

  • Data Transparent Transmission Service Configuration #

This command gets or sets parameters of Inplay private data transparent tranmission service as GATT server, including service UUID, maximum data transmission size etc. After the execution of the command, the service with specified parameters will be created. It MUST be sent after +CFGDEV

It is only allowed by device with ‘Peripheral role’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGTRXSVC=[start_hdl,svc_uuid,max_data_sz]

Response: +CFGTRXSVC=err_code

ParameterTypeValue
start_hdlNumberThe start GATT handle of service
0: automatically created
other: user specific handle number
svc_uuidStringByte Array format string representing 16-byte service UUID in little-endian mode. If it is empty, default "ccddb4f8-cdf3-11e9-a32f-2a2ae2dbcce4" is applied
max_data_szNumberMaximum data transmission size
0: Default 20 bytes
1 - 1024: Maximum data size

Example:

//Set service UUID as 1122b4f8-cdf3-11e9-a32f-2a2ae2dbcce4 and the maximum transmission data as 512 bytes.
→AT+CFGTRXSVC=[0,“e4ccdbe22a2a2fa3e911f3cdf8b42211”,512]
←+CFGTRXSVC=0000H

//Set service UUID by default. Fixed service start handle to 20
→AT+CFGTRXSVC=[20,"",0]
←+CFGTRXSVC=0000H

  • Data Transparent Transmission Client Configuration #

This command gets or sets parameter of Inplay private data transparent tranmission service as GATT client. If parameters are not set or parameter ‘start_hdl’ is set to 0, device will initiate a Service Discovery Process (SDP) to find remote service after connection.

It is only allowed by device with ‘Central role’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGTRXCLT=[start_hdl,svc_uuid]

Response: +CFGTRXCLT=err_code

ParameterTypeValue
start_hdlNumberThe start GATT handle of service
0: automatically get by SDP
other: user specific handle number
svc_uuidStringByte Array format string representing 16-byte service UUID in little-endian mode. If it is empty, default "ccddb4f8-cdf3-11e9-a32f-2a2ae2dbcce4" is applied

Example:

//Set to discover service by SDP.
→AT+CFGTRXCLT=[0,“e4ccdbe22a2a2fa3e911f3cdf8b42211”]
←+CFGTRXCLT=0000H

//Set specific start handle and leave other in default, so that SDP is not necessary.
→AT+CFGTRXCLT=[20,""]
←+CFGTRXCLT=0000H

  • RF Configuration #

This command gets or sets RF related parameter.

Command: AT+CFGRF=[tx_power]

Response: +CFGRF=err_code

ParameterTypeValue
tx_powerNumberTX power:
0Max TX power (~8dBm)
1-157dBm to 0dBm with step 0.5dBm
16-22-1dBm to -7dBm with step -1dBm

Example:

//Set TX power +3dBm
→AT+CFGRF=[9]
←+CFGRF=0000H

  • SMP Configuration #

This command gets or sets security parameters of the module.

Command: AT+CFGSMP=[smp,dev_io_cap,pairing_code]

Response: +CFGSMP=err_code

ParameterTypeValue
smpNumber (1 byte)
----LE Secure ConnectionMITM-Encryption
----Bit3Bit2-Bit0
0: false; 1: true
dev_io_capNumber
0Display Only
1Display Yes No
2Keyboard Only
3Keyboard Display
4No Input No Output
pairing_codeStringASCII Paring code

Example:

//Set SMP to MITM security and encryption, with ability of keyboard input. The corresponding MITM pairing code is 012345
→AT+CFGSMP=[5,2,“012345”]
←+CFGSMP=0000H

  • Target Device Configuration #

This command gets or sets the target devices that are allowed to connect or scan. If initiating activity is configured as direct connection type, only first device in the device list is the target. Maximum 25 target devices can be set.

It is only allowed by device with ‘Central role’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGTARGET=[dev1_addr,dev1_addr_type,<dev2_addr>,<dev2_addr_type>,…]

Response: +CFGTARGET=err_code

ParameterTypeValue
dev_addrStringByte Array format string representing MAC address of target device in little-endian mode
dev_addr_typeNumber0: Public address;
1: Static random address

Example:

→AT+CFGTARGET=[“112222222211”,0,“AABBCCCCDDEE”,0]
←+CFGTARGET=0000H

  • Advertising Activity Configuration #

This command sets parameter to create BLE advertising activity. Maximum 2 advertising activities can be created.

It is only allowed for device which role is configured as ‘Peripheral’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGADVACTV=[actv_id,adv_type,connectable,intv,chn,payload]

Response: +CFGADVACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for advertising activity
adv_typeNumber0: Legacy Advertise
1: Extended Advertise
connectableNumber0: Unconnectable
1: Connectable
intvNumber20-10240ms
chnNumber0: all BLE advertising channel
37-39: Fixed channel
payloadStringBLE standard advertising data format in base64 encoding
Length (1 byte) + Type (1 byte) + Content (length -1 byte)

Example:

//Set legacy connectable advertising in 500ms interval. The payload is local name “Inplay”
→AT+CFGADVACTV=[1,0,1,500,0,“BwlJbnBsYXk=”]
//Successfully set
←+CFGADVACTV=0000H

  • Scan Activity Configuration #

This command sets parameter to create BLE scan activity. Only one scan activity can be created.

It is only allowed by device with ‘Central role’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGSCANACTV=[actv_id,type]

Response: +CFGSCANACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for scan activity
typeNumber2: Observer
3: Selective observer. Only devices configured by +CFGTARGET will be reported

Example:

//Set scan activity
→AT+CFGSCANACTV=[20,3]
//Successfully set
←+CFGSCANACTV=0000H

  • Initiating Activity Configuration #

This command sets parameter to create BLE initiating activity to establish connections with the target device. Only one initiating activity can be created.

It is only allowed for device which role is configured as ‘Central’ or ‘All role’, otherwise 1001H error code is returned.

Command: AT+CFGINITACTV=[actv_id,type]

Response: +CFGINITACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for advertising activity
typeNumber0: Direct connect
1: Auto connect. Only devices configured by +CFGTARGET can be connected

Example:

//Create initiating activity to auto connect with target devices.
→AT+CFGINITACTV=[10,1]
//Successfully set
←+CFGINITACTV=0000H

//Create initiating activity to direct connect with remote device.
→AT+CFGINITACTV=[10,0]
//Successfully set
←+CFGINITACTV=0000H

  • Start Advertising Activity #

This command start advertising activity that is created by previous +CFGADVACTV command.

Command: AT+ADVACTV=[actv_id,op,<duration>]

Response: +ADVACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for advertising activities
opNumber0: Stop Activity
1: Start Activity
durationNumber0: Forever
10-65535: Actual duration (in unit of 10ms)
Default 0

Example:

//Start advertising activty permanently
→AT+ADVACTV=[1,1,0]
//Successfully set
←+ADVACTV=0000H

//Stop advertising activity
→AT+ADVACTV=[1,0]
←+ADVACTV=0000H

  • Start Scan Activity #

This command start scan activity that is created by previous +CFGSCANACTV command. If target devices are not configured by +CFGTARGET command, advertisement from any devices scaned will be reported.

Command: AT+SCANACTV=[actv_id,op,<intv>,<wnd>,<chn>,<duration>,<dup_filter>]

Response: +SCANACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for scan activity
opNumber0: Stop Activity
1: Start Activity
intvNumberScan activity interval 3-40959 ms
Default 200ms
wndNumberScan running time, must be less than intv
Default 100ms
chnNumber0: Scan on three channel alternately
37-39: Scan on fixed channel
Default 0
durationNumber0: Forever
10-655350: Actual duration in ms
Default 0
dup_filterNumber0: No filtering
1: Filter duplicates within the duration
Default 0

Example:

//Start scan activty permanently
→AT+SCANACTV=[20,1,200,100,0,0,1]
//Successfully set
←+SCANACTV=0000H

//Stop scan activity
→AT+SCANACTV=[20,0]
←+SCANACTV=0000H

  • Start Initiating Activity #

This command start initiating activity that is created by previous +CFGINITACTV command. If target devices are not configured by +CFGTARGET command, activity cann’t be started and retures error response. When it is started permanently, it will end until all target devices configured are connected.

Command: AT+INITACTV=[actv_id,op,<conn_intv>,<latency>,<sup_tmo>,<duration>]

Response: +INITACTV=err_code

ParameterTypeValue
actv_idNumberUnique ID for initiating activity
opNumber0: Stop Activity
1: Start Activity
conn_intvNumberConnection interval: 8 - 4800 ms
Default 100 ms
latencyNumber0 - 499
Default 0
sup_tmoNumber100 - 32000 ms
Default 20000 ms
durationNumber0: Forever
10-655350: Actual duration in ms
Default 0

Example:

//Start initiating activty
→AT+INITACTV=[10,1,200,0,20000,0]
//Successfully set
←+INITACTV=0000H

//Stop initiating activity
→AT+INITACTV=[10,0]
←+INITACTV=0000H

  • Get current connection list #

This command gets a list of currently connected devices.

Command: AT+CONNLST=?

Response: +CONNLST=[<dev1_addr>,<dev1_role>,<dev2_addr>,<dev2_role>,…]

ParameterTypeValue
dev_addrStringThe Byte Array format string representing MAC address of peer device in little-endian mode
dev_roleNumber0: Peer device as Master role;
1: Peer device as Slave role

Example:

→AT+CONNLST=?
//Connect to master device “66-55-44-33-22-11” and a peripheral device “FF-EE-DD-CC-BB-AA”
←+CONNLST=[“112233445566”,0,“AABBCCDDEEFF”,1]

  • Start Pairing #

This command start operation of BLE pairing with connected device.

Command: AT+BOND=[op,dest_addr,<pairing_code>]

Response: +BOND=err_code

ParameterTypeValue
opNumber0: Cancel pairing
1: Start pairing
dest_addrStringThe Byte Array format string representing MAC address of connected device in little-endian mode
pairing_codeString6 bytes ASCII pairing code

Example:

→AT+BOND=[1,“112233445566”,“012345”]
←+BOND=0000H

//Stop pairing
→AT+BOND=[0,“112233445566”]
←+BOND=0000H

  • Data Transmit #

This command transmit data via Inplay private transparent transmission service.

Command: AT+DATATX=[dest_addr,data]

Response: +DATATX=err_code

ParameterTypeValue
dest_addrStringThe Byte Array format string representing MAC address of destination connected device in little-endian mode
dataStringBase64 encoding string representing binary data to transmit

Example:

//Send data “0x0001020304050607080910” to remove device “66-55-44-33-22-11”
→AT+DATATX=[“112233445566”,“AAECAwQFBgcICRA=”]
←+DATATX=0000H

  • Reset #

This command causes the system to reset. While execution, application can choose whether to save or clear current configured parameters permanently. This command don’t have any response. The application determines whether reset is complete or not by receiving the +EVTREADY event.

Command: AT+SYSRST=[op]

Response: N/A

ParameterTypeValue
opNumber0: Reset module
1: Reset after saving current parameters to Flash
2: Reset after clearing current parameter from Flash

Example:

→AT+SYSRST=[1]

  • Watchdog #

This command set up watch dog.

Command: AT+SYSWDT=[wdt_enable,wdt_int_pol,wdt_tmo]

Response: +SYSWDT=err_code

ParameterTypeValue
wdt_enableNumber0: Disable
1: Enable
wdt_int_polNumber0: Low level trigger interrupt
1: High level trigger interrupt
wdt_tmoNumber1 - 65536 seconds

Example:

→AT+SYSWDT=[1,0,60]
←+SYSWDT=0000H

EVENT REFERENCE #

  • -EVTREADY #

This event indicates module is ready to accept AT commands. It is usually received after power on reset or +SYSRST command is executed.

Event: -EVTREADY=[prev_state]

ParameterTypeValue
prev_stateNumber
0Power on reset or reset command with op 0
1Reset command with op 1
2Reset command with op 2
3Watch dog reset

Example:

-EVTREADY=[1]

  • -EVTCONN #

This event indicates device has been connected or disconnected.

Event: -EVTCONN=[state,peer_addr,role,phy]

ParameterTypeValue
stateNumber0: Disconnect
1: Connect
peer_addrStringByte Array format string representing MAC address of peer device in little
roleNumber5: Device is connected as Master role;
10: Device is connected as Slave role
phyNumberPhy that connection on. Please refer to PHY parameter in command +DEVCFG

Example:

//Successfully connected with remote Master device “EF:DD:CC:CC:BB:EF” on 1M PHY.
-EVTCONN=[1,‘EFBBCCCCDDEF’,1,1]

  • -EVTDATA #

This event indicates the data reception from peer device.

Event: -EVTDATA=[peer_addr,data]

ParameterTypeValue
peer_addrStringByte Array format string representing MAC address of peer device in little-endian mode
dataStringBase64 encoding format string representing binary data received

Example:

//Data “0x0001020304050607080910” received from remove device “66-55-44-33-22-11”
-EVTDATA=[“112233445566”,“AAECAwQFBgcICRA=”]

  • -EVTADV #

This event indicates that an advertising signal has been scanned.

Event: -EVTADV=[dev_addr,addr_type,connectable,rssi,payload]

ParameterTypeValue
dev_addrStringByte Array format string representing MAC address of advertising device in little-endian mode
addr_typeNumber0: Public
1: Static random
connectableNumber0: Unconnectable
1: Connectable
rssiNumberSigned integer in dBm
payloadStringBase64 encoding format string representing advertising payload binary data

Example:

//A connectable ad with local name ‘Inplay’ as payload from device ‘66-55-44-33-22-11’ is scanned. RSSI is -80dBm.
-EVTADV=[“112233445566”,0,1,-80,“BwlJbnBsYXk=”]

  • -EVTACTVEND #

This event indicates the termination of the command +SCANACTV, +ADVACTV, +INITACTV and +BOND, whether the commands are terminated automatically or manually.

Event: -EVTACTVEND=[actv_type,actv_id]

ParameterTypeValue
actv_typeNumber
0Advertising activity
1Scan activity
2Initiating activity
3Bond
actv_idNumberUnique ID for activity

Example:

//Advertising activity 1 has ended
-EVTACTVEND=[0,1]

//Scan activity has ended
-EVTACTVEND=[1,20]

ERROR CODE #

The ERROR CODE is returned as a hexadecimal value. Please refer to following table for details.

0000HCommand executed successfully
1001HWrong command execution
100AHWrong CommandID
100BHWrong format
100DHWrong parameter
100EHExecution overtime
OthersBLE error. Refer to in_ble_error.h in SDK