Device Bluetooth Commands


Device Bluetooth Commands

1. Environment Setup

  • Communication test software: sscom32
  • Optical probe test fixture

OP Series Bluetooth Module AT Command Protocol

Communication is supported only via serial port (through the optical probe test fixture).

AT Command Format

  • AT commands are text-line commands parsed line by line (terminated by carriage return and line feed \r\n)
  • AT commands should use uppercase characters (some modules support mixed case). Commands are prefixed with AT+ and fall into parameter-setting commands and read commands
  • Set command format: AT+<CMD>=<param> — success returns OK\r\n, failure returns ERR\r\n
  • Read command format: AT+<CMD> — success returns +<CMD>:<param>\r\nOK\r\n, failure returns ERR\r\n
  • Invalid or unsupported commands return ERR\r\n or ERROR\r\n

Command List

Note: All commands end with \r\n. In the serial assistant, enable the “Append CR/LF” option, or enter the full command such as AT+BLENAME\r\n. The AT command set below is continuously being expanded; contact us if you need new features.

Command Function Response Notes
AT AT test; returns ok when communication is normal \r\nok\r\n
AT+RESET Save configuration and restart the chip \r\nok\r\n
AT+RESTORE Restore factory settings and restart the chip \r\nok\r\n
AT+VER Query module software version \r\n +VER=**** \r\nOK
AT+BLENAME Query current BLE Bluetooth name \r\n +NAME=**** \r\nOK
AT+SPPNAME Query current SPP Bluetooth name \r\n +NAME=**** \r\n OK Effective only in BLE & SPP dual-mode versions
AT+BLEMAC Query module BLE MAC address \r\n +MAC:********** \r\n OK
AT+SPPMAC Query module SPP MAC address \r\n +MAC:********** \r\n OK Effective only in BLE & SPP dual-mode versions
AT+BAUD Query system baud rate \r\n +BAUD=**** \r\n OK
AT+UUID Query all UUIDs on the chip
AT+MODE Query supported modes \r\n +MODE=* \r\n OK Effective only in BLE & SPP dual-mode versions0 = BLE only1 = BLE & SPP
AT+SECURITY Query pairing security mode \r\n +SECURITY=* \r\n OK 0 = no PIN pairing1 = simple pairing enabled2 = PIN pairing enabled
AT+PIN Query pairing PIN \r\n +PIN=****** \r\n OK
AT+ADVDATA Query advertising payload data \r\n +ADVDATA:*** \r\n OK
AT+ADVPARAM Query advertising interval \r\n +ADVPARAM:*** \r\n OK
AT+LPM Query low-power mode status \r\n +LPM=* \r\n OK Low-power mode applies only to BLE peripheral mode0 = not in low-power mode1 = in low-power mode
AT+LOG Query chip log output status \r\n +LOG=* \r\n OK 0 = disable chip-initiated log output1 = enable chip-initiated log output
AT+LED Query LED status pin behavior \r\n +LED:X \r\n OK 0 = off when disconnected (low), steady on when connected (high)1 = fast blink when disconnected, steady on when connected (square wave output; chip default is 1)
AT+ROLE Query current chip role \r\n +ROLE=**** \r\n OK SERVER = peripheral (chip default)CLIENT = central
AT+VBAT Query VBAT voltage \r\n +PIN=****** \r\n OK Query VBAT voltage; e.g. 3.3 V returns 330
AT+BAUD=XXXX Set serial baud rate; takes effect after reset \r\nok\r\n Parameters include 2400, 4800, 9600, etc.; see section 2.3
AT+MODE=X Set operating mode \r\n +MODE=* \r\n OK Effective only in BLE & SPP dual-mode versions0 = BLE only1 = BLE & SPP dual mode
AT+BLENAME=XXXX Set BLE channel Bluetooth name; takes effect after reset \r\nok\r\n
AT+SPPNAME=XXXX Set SPP channel Bluetooth name; takes effect after reset \r\nok\r\n
AT+SECURITY=0 Disable pairing; takes effect after reset \r\nok\r\n
AT+SECURITY=1 Enable simple pairing; takes effect after reset \r\nok\r\n
AT+SECURITY=2 Enable PIN pairing; takes effect after reset \r\nok\r\n
AT+PIN=XXXXXX Set pairing PIN to XXXXXX; takes effect after reset \r\nok\r\n BLE channel PIN must be 6 digits (default: 000000)
AT+BLEMAC=XXXX Set BLE MAC address (12-digit hex value); takes effect after reset \r\nok\r\n
AT+SPPMAC=XXXX Set SPP MAC address (12-digit hex value); takes effect after reset \r\nok\r\n Effective only in BLE & SPP dual-mode versions
AT+ADV=X Enable or disable advertising; takes effect after reset \r\nok\r\n 0 = off1 = on (default)
AT+ADVDATA=XXX Set advertising payload data \r\nok\r\n
AT+ADVPARAM=X Set advertising interval 10<=X<=4000, unit ms \r\nok\r\n Longer interval = lower power, longer connection time
AT+RFPWR Set transmit power 0–9 \r\nok\r\n Set RF transmit power (default level is 9)
AT+LED=X Set LED indicator behavior \r\nok\r\n 0 = off when disconnected (low), steady on when connected (high)1 = fast blink when disconnected (square wave), steady on when connected (high)
AT+LPM=0 Disable low-power mode; takes effect after reset \r\nok\r\n
AT+LPM=1 Enable low-power mode; takes effect after reset \r\nok\r\n Effective only in BLE low-power peripheral mode
AT+ROLE=X Set chip role; takes effect after reset \r\nok\r\n Used for central/peripheral mode switching
AT+CONN=XXX Central role initiates connection \r\nok\r\n XXX = MAC address of the target peripheral
AT+SLEEP Soft shutdown \r\nok\r\n
AT>X Switch to specified channel \r\nok\r\n 0 = central channel8 = BLE peripheral channel9 = AT command channel10 = SPP channel
AT+DISC=X Central or peripheral actively disconnects \r\nok\r\n 0 = central disconnects8 = BLE peripheral disconnects10 = SPP peripheral disconnectsNote: run AT>9 to switch to the AT command channel before this command
AT+LOG=X Enable or disable chip-initiated log output \r\nok\r\n 0 = disable chip-initiated log output1 = enable chip-initiated log output

AT Commands for Central (Host) Mode Only

Command Function Response Notes
AT+ROLE Query current chip role \r\nok\r\n
AT+ROLE=1 Set as central \r\nok\r\n
AT+ROLE=0 Set as peripheral \r\nok\r\n
AT+ROLE Query whether current role is central or peripheral Central returns “CLIENT”Peripheral returns “SERVER”
AT+SCAN=1 Start scanning \r\nok\r\n
AT+SCANM=0,0 Set number of devices to find and scan timeout in central mode (unit: seconds) \r\nok\r\n 0 <= device count <= 15 (default 5)0 <= timeout <= 40 (default 5)Default returns 5,5
AT+SCANPARAM=0,0,0 Set scan type, scan interval, and scan window \r\nok\r\n First value: 0 = passive scan, 1 = active scan (default 1)Second value: central scan interval (default 20)Third value: central scan window size (default 15)Note: scan interval must be greater than scan window
AT+CLRBIND Clear saved peripheral addresses \r\nok\r\n
AT+TARGETUUID Set target UUID (service/characteristic) to connect \r\nok\r\n Must include NOTIFY and WRITE/WRITE NO RESPONSE properties, otherwise connection fails

Baud Rate List

Supported serial baud rates: 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600, 115200, 230400, 256000, 460800, 530000, 1000000.


3. Bluetooth Transparent Transmission — BLE

3.1 BLE UUID Reference

Insert image

  1. Service UUID is 18F0.
  2. Characteristic 1 UUID is 2AF0, property is notify.
  3. Characteristic 2 UUID is 2AF1, property is write.

To query the chip’s current UUID configuration, use:

AT+UUID\r\n

UUIDs support 16-bit or 128-bit formats. To use other UUIDs, the chip supports custom UUID configuration as follows:

AT+UUID=[UUID index],[target UUID value]\r\n
AT+RESET\r\n

Examples:

  1. Change the UUID labeled “3” in the diagram to FF47:

    AT+UUID=3,FF47\r\n
    AT+RESET\r\n
    
  2. Change the UUID labeled “3” in the diagram to 00112233445566778899AABBCCDDEEFF:

    AT+UUID=3,FFEEDDCCBBAA99887766554433221100\r\n // enter byte-by-byte in reverse order (every two characters)
    AT+RESET\r\n // after modification, re-pair or restart Bluetooth on the phone for correct display
    

Other: to restore factory default UUIDs, run AT+RESTORE to reset the chip to factory settings.

3.2 BLE Testing Instructions

For Android app testing, we recommend our Demo app (in the Demo APP directory; currently BLE mode only; SPP mode is under development).

Other professional test tools: nRF Connect (Android version provided in this directory; iOS version available on the App Store).

For iOS app testing, we recommend “BLE Tools”, searchable on the App Store.

Contact us anytime for custom app development.

Test steps:

We use BLE Tools (iOS version, downloaded from the App Store)

  1. Launch the BLE Tools app;
  2. Select the device with the matching Bluetooth name, such as “TD5322A”, and tap Connect.
  3. After connecting, the interface shows the device name and services.
  4. Locate the required service, which is FF01;
  5. Tap “Listen”;
  6. Send test characters from the serial port (e.g. using a PC serial debug tool);
  7. The phone displays the received characters.
  8. Locate the required service, which is FF02;
  9. Tap “Write”;
  10. Enter test characters;
  11. Bluetooth transparent transmission forwards the data to the UART on the Bluetooth chip (can be verified with a PC serial