ble 4.1 module software specificationiphone 6s in the free distance testing result.) 80m (output...

64
BLE 4.1 Module Software Specification Protocol Version: V1.7 Shenzhen Shengrun Technology Co.,Ltd August 1, 2016 all rights reserved

Upload: others

Post on 31-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • BLE 4.1 Module

    Software

    Specification

    Protocol Version: V1.7

    Shenzhen Shengrun Technology Co.,Ltd

    August 1, 2016

    all rights reserved

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 1

    Content

    1. BLE4.1 Module Brief Introduction ................................ 3

    1.1. Function Introduction ....................................... 3

    1.2. Main features .............................................. 4

    1.3. Electrical Characteristics ..................................... 6

    1.4. Bluetooth Module Power Consumption Table ................. 8

    1.5. Operating Mode Schematic Diagram ......................... 8

    1.5.1.Slave Mode ........................................... 8

    1.5.2.Master Mode .......................................... 9

    1.5.3.Master-slave Mode .................................... 9

    1.6. Module Pin Map ........................................... 10

    1.7. Pins Function .............................................. 12

    1.7.1 QFN 7*7 Module Pin Functions ........................ 12

    1.7.2 QFN 5*5 Module Pin Functions ........................ 14

    2. Command Description ........................................... 18

    2.1. Command Table ........................................... 18

    2.2. SPI Command Format Description .......................... 24

    2.2.1. SPI Write Command .................................. 25

    2.2.2. SPI Read Command .................................. 25

    2.3. Serial Ports Command Format Description .................. 26

    2.3.1. Serial Ports Read/Write Command .................... 26

    2.3.2. Serial Ports Receive BLE Data ......................... 27

    2.4. Bluetooth Read/Write Description .......................... 28

    2.4.1. UUID Description .................................... 28

    2.4.2. Module Bluetooth Channel Operating Instruction ...... 28

    2.5. Command Description ..................................... 29

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 2

    3.Tool APP Description ............................................. 59

    3.1.APP Read & Set the Module Parameter ...................... 60

    3.2.TX& RX Data ............................................... 61

    4.Contact Us ...................................................... 62

    5.Revision History ................................................. 63

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 3

    1. BLE4.1 Module Brief Introduction

    1.1. Function Introduction

    This is a Slave Module which support bridge mode (Transparent

    Transmission) and direct-drive mode. Module can automatically

    broadcast after the initial setup, with a specific APP phone will scan and

    dock with the module, after pairing success the APP can monitor the

    device through BLE protocol.

    In bridge mode, user’s CPU can communicate with the mobile

    device in two-way through module's UART. Users can also manage and

    control certain communication parameters through specific commands.

    The detailed meaning of the user data is defined by the up-application.

    Mobile devices can write to the module through the APP. And the data

    written will be sent to the user’s MCU through SPI. Then the module

    will transmit the data package from user MCU to the mobile devices

    automatically. In the development under this mode, the user needs to

    undertake the code design for MCU code, and the code design of APP

    for smart mobile terminals.

    In Direct-Drive mode, users take simple periphery expansion to the

    module. And APP drives the module directly through BLE protocol, to

    implement the monitoring and control of the module by smart mobile

    devices. In this mode, users only need to do the code design for smart

    mobile terminals.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 4

    1.2. Main features

    Easy to use, no need of any experience of Bluetooth protocol stack

    application.

    Support Bluetooth Multi-connection data transmission function.

    Support connection solutions:①Module acts as a Slave that can

    connect with 4 Masters; ②Module acts as a Master that can connect

    with 4 Slavers; ③When module Master and Slave integration that

    can connect with two Masters or Slavers.

    UART design for user interface, full-duplex bi-directional

    communication, and supporting the minimum baud rate of 75bps,

    maximum of 375000bps.

    Supporting bridge mode and direct-drive mode (no need of

    additional CPU), direct-drive mode support SPI/UART.

    Default connection interval of 40ms, which make quick connection.

    With the increase of connected devices, connected devices

    connection interval will gradually increase after 25ms.

    Support software reset module by AT/SPI command, and access to

    MAC address.

    Support adjust Bluetooth connection interval by AT/SPI command,

    and control of different forwarding rates (Dynamic power

    adjustment).

    Support to adjust Tx power by APP/SPI/UART command, modifying

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 5

    broadcasting interval/connection timeout time/product connection

    delay/serial port baud rate/module name.(all settings will power

    down save)

    Serial port data package length, less than or equal to

    80byte(automatic distribution)

    Multi-connection support connect with 4 device at the same time,

    two-way connection rate of 80byte/s.(If long time TX/RX data, then

    support maximum of 3 devices.)

    Supporting modify module name/serial port baud rate/product

    UUID through APP/SPI/AT, custom broadcast content, broadcast

    cycle, all power down save。

    Support mobile device remote reset to the module through APP /SPI

    / AT and set Tx power.

    Support mobile device adjust BLE connection interval through

    APP/SPI/AT, power down save (Dynamic power adjustment).

    Operating all IO extend through APP/SPI/AT.

    Supporting connection status/broadcasting status tip pin/general IO

    Configuration.

    16 two-way programmable IO port, all low power operation (Applied

    in lighting control, remote control toys, and various relating

    input/output/on/off things).

    2 ADC input(12 bit), Enable/Ban, free configuration of sampling cycle.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 6

    Mean filter setting.

    (Applied to measuring temperature and humidity, luminosity, etc.)

    6 programmable PWM output IO (2MHz at most).

    (Applied dimming, speed, etc.)

    Module end continuous acquisition RSSI (Anti-lost alarm

    application).

    Supporting device power level tips/power level read.

    Supporting internal RTC real time clock,APP end can always sync

    calibration.

    Supporting IO configuration and output state saving function,

    customizable initialization state.

    Supporting shallow/deep recovery mode, flexible restore user data,

    and save product configuration 。

    Supporting obtain Bluetooth connection state through UART/SPI.

    Supporting low enable and pulse enable mode, and remote

    shutdown.

    Ultra low power standby mode.

    1.3. Electrical Characteristics

    Modulation mode:GFSK

    Frequency range:2400-2483.5MHZ(2.4G ISM)

    Tx power :-20-+5 dBm(can be set by programming)

    Operating Ambient Temperature Range:-20℃-+70℃

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 7

    Storage temperature range:-30℃-+85℃

    Operating Humidity:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 8

    1.4. Bluetooth Module Power Consumption Table

    Bluetooth

    State Parameter Actual Interval(ms)

    Average

    Current

    broadcasting

    interval

    32 20 768uA

    160 100 201uA

    800 500 41.3uA

    1600 1000 21.3uA

    connection

    interval

    16 20 461uA

    80 100 95.7uA

    160 200 51.3uA

    400 500 25.6uA

    800 1000 16.9uA

    1.5. Operating Mode Schematic Diagram

    1.5.1.Slave Mode

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 9

    1.5.2.Master Mode

    1.5.3.Master-slave Mode

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 10

    1.6. Module Pin Map

    HY-264001

    HY-264002

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 11

    HY-264024

    HY-264008

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 12

    1.7. Pins Function

    1.7.1 QFN 7*7 Module Pin Functions

    Pin No. Pin

    Name

    Functional

    Description Function corresponds

    1 IO2_2 General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    2 IO2_1

    General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    OAD_CS Chip

    Select Pin

    OAD UPGRADING, Flash chip select

    Pin

    3 IO2_0

    General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    OAD_MISO Pin OAD UPGRADING, BLE MODULE

    OUTPUT PORT, Flash output port,

    4 IO1_7

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    SEL1Channel

    selection Pin

    MCU communication with the BLE

    select pin. See table 1-1

    5 IO1_6

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    SEL0Channel

    selection Pin

    MCU communication with the BLE

    select pin. See table 1-1

    6 IO3_1

    General IO Pin This Pin is IO3 Pin ,setting direction

    and Read/Write

    OAD_MOSI Pin OAD UPGRADING, BLE output port,,

    Flash input port

    7 IO1_5

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    PWM5 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    OAD_CLK PIN OAD UPGRADING, Flash clock signal

    terminal

    8 IO1_4 General IO Pin

    This Pin is IO1 Pin ,setting direction

    and Read/Write

    PWM4 Output 16-bit PWM Output Pin ,Duty-cycle

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 13

    Pin adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    9 IO1_3

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    PWM3 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    10 IO1_2

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    PWM2 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    11 IO3_0 General IO Pin This Pin is IO3 Pin ,setting direction

    and Read/Write

    12 GND GND BLE Ground Pin

    13 VDD VCC BLE Power Pin, Voltage:1.8-3.8V

    14 IO1_1

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    PWM1 Output

    Pin

    16 bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    15 IO1_0

    General IO Pin This Pin is IO1 Pin ,setting direction

    and Read/Write

    PWM0 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    16 IO0_7 General IO Pin This Pin is IO0 Pin ,setting direction

    and Read/Write

    17 IO0_6 General IO Pin

    This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    INT PIN interrupt Output Pin

    18 IO0_5 General IO Pin

    This Pin is IO0 Pin ,setting direction

    and Read/Write 。

    Note: This pin can only read direction/power level

    and cannot write when SPI.

    CLK PIN SPI bus clock signal terminal

    19 IO0_4 General IO Pin This Pin is IO0 Pin ,can only read

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 14

    direction/power level,but not write.

    WAKEUP Pin BLE WAKEUP Pin,Low wake, high BLE

    module automatically sleep

    20 IO0_3

    General IO Pin This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    UART_TX Pin Serial port bus data output port,

    MOSI Pin SPI,MCU output,BLE input port

    21 IO0_2

    General IO Pin This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    UART_RX Pin Serial port bus data input port

    MISO Pin SPI,MCU input,BLE output port,

    22 IO0_1 General IO Pin

    This Pin is IO0 Pin ,setting direction

    and Read/Write

    ADC0 Pin 12 bit ADC, channel 0

    23 IO0_0 General IO Pin

    This Pin is IO0 Pin ,setting direction

    and Read/Write

    ADC1 Pin 12 bit ADC, channel 1

    24 RESET Reset Pin BLE hardware Reset Pin,low Reset

    Table 1 - 1

    1.7.2 QFN 5*5 Module Pin Functions

    Pin No. Pin

    Name

    Functional

    Description Function corresponds

    1 ANT Antenna Pin Offer to external antenna

    2 GND Ground BLE Ground Pin

    3 IO2_2

    General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    Watchdog

    Output Pin

    When device operating normally,

    device IO power level change in

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 15

    every 500ms.

    4 IO2_1

    General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    OAD_CS Chip

    Select Pin

    OAD UPGRADING, Flash chip select

    Pin

    5 IO2_0

    General IO Pin This Pin is IO2 Pin ,setting direction

    and Read/Write

    OAD_MISO Pin OAD UPGRADING, BLE MODULE

    OUTPUT PORT, Flash output port,

    Bluetooth Switch

    Pin

    If this function Enable, pull low this

    pin to open Bluetooth, pull high to

    close Bluetooth broadcasting.

    6 IO1_6

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    SEL0 Channel

    selection Pin

    MCU communication with the BLE

    select pin. See table 1-1

    7 IO1_5

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    SEL0 Channel

    selection Pin

    MCU communication with the BLE

    select pin. See table 1-1

    8 TMS Burning

    Firmware \

    9 TCK Burning

    Firmware \

    10 IO1_4

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    OAD_MOSI Pin OAD UPGRADING, BLE output port,,

    Flash input port

    11 IO1_3

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    PWM3 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    OAD_CLK Pin When OAD upgrading,Flash clock

    signal terminal

    12 VDD_EB VDD BLE Power Pin, Voltage:1.8-3.8V

    13 GND Ground BLE Ground Pin

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 16

    14 RESET Reset Pin BLE hardware Reset Pin,low power

    level reset

    15 IO0_4 General IO Pin

    This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    INT PIN interrupt Output Pin

    16 IO1_2

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    PWM2 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    ADC0 Pin 12bit ADC,Channel1

    17 IO1_1

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    PWM1 Output

    Pin

    16 bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    ADC1 Pin 12bit ADC,Channel1

    18 IO1_0

    General IO Pin This Pin is IO1 Pin, setting direction

    and Read/Write

    PWM0 Output

    Pin

    16-bit PWM Output Pin ,Duty-cycle

    adjustable range:1%-99%, Output

    frequency range:1KHz-2MHz

    Bluetooth

    Indicator Pin

    If this function Enable, this pin will

    pull low after Bluetooth connected

    device; this pin will pull high after

    Bluetooth disconnected with device.

    19 IO0_3 General IO Pin

    This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    Note:When SPI, this pin can only read direction

    and power level, but not write.

    CLK PIN SPI bus clock signal terminal

    20 IO0_2

    General IO Pin This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    WAKEUP Pin

    BLE WAKEUP Pin,Low power level

    wake, high power level BLE module

    automatically sleep

    21 IO0_1 General IO Pin This Pin is IO0 Pin ,can only read

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 17

    direction/power level,but not write.

    UART_TX Pin Serial port bus data output port,

    MISO Pin SPI,MCU input,BLE output port,

    22 IO0_0

    General IO Pin This Pin is IO0 Pin ,can only read

    direction/power level,but not write.

    UART_RX Pin Serial port bus data input port

    MISO Pin SPI,MCU input,BLE output port,

    Select the Communication Mode

    Channel selection PIN

    Status

    Communication

    Port Status Mark

    SEL1 SEL0 UART SPI

    Please contact the

    vendor for the

    command ways

    0 0 OK X

    0 1 0K X

    1 0 X OK

    1 1 OK X

    X X OK X Note: 0: LOW; 1:High; X:Vacant

    Table 1 - 1

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 18

    2.Command Description

    2.1. Command Table

    Regist

    er

    ADD

    AT COMMAND

    Note: The end of all AT

    COMMAND must paired

    with “\r\n”

    pow

    er

    dow

    n

    save

    SPI/UAR

    T

    Read/W

    rite

    APP

    Read/W

    rite

    Mark

    0x02 AT+MOD=n NO R/W NO Data Mode

    Selection

    0x06 / NO R NO

    View the

    current

    command state

    0x07 AT+SYS_STATE=? NO R NO System State

    0x0B

    / NO R NO

    received data

    length of the

    module(SPI)

    0x0D AT+BAUD=n YES R/W R/W Baud Rate

    Setting

    0x0E AT+NAME=xxx YES R/W R/W BLE MODULE

    NAME SETTING

    0x0F AT+PSWD=xxx YES R/W R/W

    Connection

    password

    setting(not

    open)

    0x11 AT+DEVID=? YES R R Local MAC

    Addressread

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 19

    0x50 AT+DEV0=? NO R R

    Read connected

    device 0’s MAC

    adress

    0x51 AT+DEV1=? NO R R

    Read connected

    device 1’s MAC

    adress

    0x52 AT+DEV2=? NO R R

    Read connected

    device 2’s MAC

    adress

    0x53 AT+DEV3=? NO R R

    Read connected

    device 3’s MAC

    adress

    0x54 AT+DEV0_ROLE=? NO R R

    Read the role of

    module which

    connected with

    device 0

    0x55 AT+DEV1_ROLE=? NO R R

    Read the role of

    module which

    connected with

    device 1

    0x56 AT+DEV2_ROLE=? NO R R

    Read the role of

    module which

    connected with

    device 2

    0x57 AT+DEV3_ROLE=? NO R R

    Read the role of

    module which

    connected with

    device 3

    0x1D AT+FUNSTATE0=? NO R R State Register 0

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 20

    0x1E AT+FUNSTATE1=

    ? NO R/W R/W State Register 1

    0x24 AT+TX=n YES R/W R/W TX Power

    Register

    0x26 AT+ADV_INTERV

    AL=n YES R/W R/W

    Broadcast

    interval

    0x27 AT+CON_INTERV

    AL=n YES R/W R/W

    connection

    interval

    0x29 AT+ADV=n NO R/W R/W Broadcast

    switcher

    0x1C AT+DISCON=n NO W NO Disconnect

    connection

    0x2A AT+SOFT_RST=1 NO W NO Software reset

    0x3D AT+VERION=? NO R R Software

    version number

    0x3E / NO W NO Clear Bluetooth

    data buffer(SPI)

    0x42 AT+SLAVE_LATEN

    CY=n YES R/W R/W

    Bluetooth Slaver

    delay

    0x43 AT+CONN_TIME

    OUT=n YES R/W R/W

    connection

    overtime

    0x44 AT+PSD_EN=n YES R/W R/W

    Password

    Enable(not

    open)

    0x47 AT+ADV_MFR_SPC

    =xxx YES R/W R/W Broadcast data

    0x58 AT+RSSI_READ0=? NO R NO Read device 0

    RSSI

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 21

    0x59 AT+RSSI_READ1=? NO R NO Read device 1

    RSSI

    0x5A AT+RSSI_READ2=? NO R NO Read device 2

    RSSI

    0x5B AT+RSSI_READ3=? NO R NO Read device 3

    RSSI

    0x12 AT+RSSI_PERIOD

    =n YES R/W R/W

    RSSI RECEIVE

    CYCLE SETTING

    0x2C AT+IO0=n NO R/W R/W IO0 read/write

    0x2D AT+IO1=n NO R/W R/W IO1 read/write

    0x2E AT+IO2=n NO R/W R/W IO2 read/write

    0x2F AT+IO3=n NO R/W R/W IO3 read/write

    0x30 AT+DIR0=n NO R/W R/W IO0 direction

    0x31 AT+DIR1=n NO R/W R/W IO1 direction

    0x32 AT+DIR2=n NO R/W R/W IO2 direction

    0x33 AT+DIR3=n NO R/W R/W IO3 direction

    0x34 AT+PWM0_PER=

    n YES R/W R/W

    PWM0

    frequency

    setting

    0x35 AT+PWM1_PER=

    n YES R/W R/W

    PWM1

    frequency

    setting

    0x36 AT+PWM2_PER=

    n YES R/W R/W

    PWM2

    frequency

    setting

    0x37 AT+PWM3_PER=

    n YES R/W R/W

    PWM3

    frequency

    setting

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 22

    0x4A AT+PWM0_DUTY

    =n YES R/W R/W

    PWM0

    duty-cycle

    0x4B AT+PWM1_DUTY

    =n YES R/W R/W

    PWM1

    duty-cycle

    0x4C AT+PWM2_DUTY

    =n YES R/W R/W

    PWM2

    duty-cycle

    0x4D AT+PWM3_DUTY

    =n YES R/W R/W

    PWM3

    duty-cycle

    0x2B AT+UTC_TIME=xx NO R/W R/W Real time clock

    0x1F AT+ADCCFG=n NO R/W R/W

    ADC

    configuration

    register

    0x20 AT+ADCVAL=? NO R R Receive ADC

    value

    0x41 AT+BAT_LEVEL=? NO R R battery power

    level percentage

    0x21 AT+NV_ADDR=n NO R/W R/W

    Nonvolatile

    memory

    address

    0x22 AT+NV_DAT_LEN

    =n NO R/W R/W

    Nonvolatile

    memory data

    length

    0x23 AT+NV_DATA=xx

    x YES R/W R/W

    Nonvolatile

    memory data

    0x5C AT+D0=xxx NO R/W NO

    read/write

    device 0

    Bluetooth data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 23

    0x5D AT+D1=xxx NO R/W NO

    read/write

    device 1

    Bluetooth data

    0x5E AT+D2=xxx NO R/W NO

    read/write

    device 2

    Bluetooth data

    0x5F AT+D3=xxx NO R/W NO

    read/write

    device 3

    Bluetooth data

    \ AT+DATA=xxx NO W NO

    UART SEND ALL

    DEVICE

    TRANSPARENT

    TRANSMISSION

    DATA

    \ \ \ \ \

    UART RECEIVE

    ALL DEVICE

    TRANSPARENT

    TRANSMISSION

    DATA

    Table 2-1

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 24

    2.2. SPI Command Format Description

    SPI Protocol use message mechanism to feedback data, data read effective

    when “INT”Low.

    SPI Protocol question and answer mode interaction data, data read and Write

    determined by Register Read/Write.

    SPI Data containing: Data Head、data length、Register Address、Data、

    Check.

    Data Head:Fixed:0xFE。

    Register address: See Table 2-1

    data length:Register Address(1 byte)+Data content length

    (nByte)

    Check:data length^ Register Address^ Data 1^Data 2^...Data n

    SPI DATA FORMAT:

    Byte 1:0xFE(Data Head)

    Byte 2:data length

    Byte 3:Register Address

    Byte 4:Data content

    ...

    Byten:Data content

    Byten + 1:Check

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 25

    2.2.1. SPI Write Command

    △a-b >= 600 us

    △a-c > △b-c

    Example:

    Write Data Head data length Command 1'Byte Check

    0XFE 0X02 0X21 0x01 0x22

    2.2.2. SPI Read Command

    SPI Read Request

    △a-b >= 600 us

    △a-c > △b-c

    SPI READ DATA

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 26

    △a-b >= 600 us

    Example:

    Write Data Head data length Command Check

    0XFE 0X01 0X23 0x22

    read Null

    Data

    Head

    data

    length

    Com

    mand 1'Byte

    … N'Byte Check

    0X00 0XFE N+1 0x23 n … n XX

    2.3. Serial Ports Command Format Description

    1. Serial Port send AT COMMAND (Detail see Table 2-1). If command success,

    it will return “AT+OK\r\n”. If failure, it will return error state.

    2. Serial Port read/write determined by register Read/Write.

    3. Query register which has read attribute, you can add “?” after

    the AT COMMAND,then you can get the relevant content.

    Note: All AT COMMAND will end with“\r\n”.

    2.3.1. Serial Ports Read/Write Command

    Example:

    Serial Port Write:AT+NV_ADDR=1\r\n

    Module Return Data: AT+OK\r\n

    Serial Port Read:AT+NV_ADDR=?\r\n

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 27

    Module Return Data: AT+OK\r\n1\r\n

    △a-b >= 600 us

    △c-d

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 28

    2.4. Bluetooth Read/Write Description

    2.4.1. UUID Description

    UUID Type Value Attribute data

    length(Byte) Mark

    Service

    UUID 0X1000 NC NC NC

    Characteri

    stics UUID

    0X1001 READ/WRITE/ NOTIFY 20 BLE RX

    0X1002 READ/NOTIFY 20 BLE TX

    0X1003 WRITE 20 REG_WRITE

    0x1004 READ 20 REG_READ

    0x1005 READ/WRITE 20 REG

    Note: You can direct modify or set the register through UUID 1003、1004、

    1005.

    2.4.2. Module Bluetooth Channel Operating Instruction

    1. Operation Example: Query the current system state

    Step one: Write 0x07 to REG(UUID1005)(Register Address)。

    Step two: Read REG_READ(UUID1004), will return 0x05,this means

    the current slave is in connection state.

    2. Operation Example: Query the current command state

    Step one: Write 0x06 to REG(UUID1005)(Register Address)。

    Step two: Read REG_READ(UUID1004),will return 0x01,this means

    the nearest command is correct.

    3. Operation Example: Set the module name

    Step one: Write 0x06 to REG(UUID1005)(Register Address)。

    Step two: Write 0x62, 0x6c, 0x75, 0x65, 0x74, 0x6f, 0x6f, 0x74, 0x68

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 29

    to REG_WRITE(UUID1003)

    Step three: Disconnect connection, the name will be“Bluetooth”

    after reconnecting

    Note: Other register operation and Write content see 2.5 Command

    Description

    2.5. Command Description Note:

    UART Mode:Data are ASCII format.

    SPI Mode:The following is SPI command data content, data are HEX format.

    (SPI data format pls see 2.2 SPICommand format description)

    2.5.1. Data Mode Selection(0x02)

    Character Mode: You will receive ASCII format data to

    bluetooth receiver after selecting the character mode.

    HEX Mode: You will receive HEX format data to bluetooth

    receiver after selecting the Hex mode.

    AT Command:

    Character Mode:AT+MOD=0\r\n

    Hex mode:AT+MOD=1\r\n

    Read data mode:AT+MOD=?\r\n

    SPI Data:

    Character Mode: 0x00

    Hex mode:0x01

    Read data mode:no need fill in the data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 30

    2.5.2. View the Current Command Status(0x06)

    AT Command:

    null

    SPI Data:

    Read the current command state:Do not fill in the data

    SPI data read return content, data content length:1,Data

    content see table 2-2.

    State Byte(HEX) Description

    0X00 No response

    0X01 Respond ok

    0X02 no this command

    0X03 device not ready,or buffer overflow,pls operate

    latter

    0X04 Not enough space,or the current task being

    performed, or not ready

    0X05 scan error

    0X06 The device is connected or uninitialized

    0X07 The device is disconnected or uninitialized,or

    device index exceed

    0X08 Device is disconnect or uninitialized

    0X09 index exceed

    0X0A Parameter overflow

    0X0B Save failed

    0X0C Parameter error

    Table 2-2

    2.5.3. View the System Status(0x07)

    AT Command:

    read System State:AT+SYS_STATE=?\r\n

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 31

    SPI Data:

    Read System State:Do not fill in the data

    Data content length: 1byte, data content low four bit

    corresponding to connected number.

    Data content high four bit see table 2-3

    State Byte(HEX)

    Description

    Master Mode(Not

    supported) Slave Mode

    0X00 Master idle Initialization

    0X10 Master is connecting Started slave mode, but there is

    no broadcast

    0X20 Master connected Being broadcasting

    0X30 Master disconnected

    Module had reached to

    maximum connecting number,

    no broadcast then

    0X40 NC Invalid state

    Table 2-3

    2.5.4. Received Bluetooth Data Length(SPI)(0x0B)

    AT Command:

    Null

    SPI Data:

    Read Bluetooth data length:Do not fill in the data

    Data content length: 4 byte

    Data content byte 1~4 corresponding to BLE data length of

    device 0~3

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 32

    2.5.5. Serial Port Baud Rate Setting(0x0D)

    AT Command:

    Set the Baud Rate:AT+BAUD=n\r\n (parameter see table

    2-4)

    Read Baud Rate:AT+BAUD=?\r\n

    SPI Data:

    Set Baud Rate:n (Parameter see table 2-4)

    read Baud Rate:Do not fill in the data

    Data

    Parameter Baud Rate Data Parameter Baud Rate

    0 9600 bps 10 110 bps

    1 19200 bps 11 150 bps

    2 38400 bps 12 300 bps

    3 57600 bps 13 600 bps

    4 115200 bps 14 1200 bps

    5 14400 bps 15 1800 bps

    6 128000 bps 16 2400 bps

    7 256000 bps 17 4800 bps

    8 375000 bps 18 7200 bps

    9 75 bps / /

    Table 2-4

    2.5.6. BLE Module Name Setting(0x0E)

    AT Command:

    Set module name:AT+NAME=xxxxxxx\r\n

    Read module name:AT+NAME=?\r\n

    SPI Data:

    Set module name:use HEX format to write module name

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 33

    (ASCII FORMAT DATA)

    Read module name:Do not fill in the data

    Note: length cannot over 18Byte

    2.5.7. Device MAC Address Reading(0x11)

    AT Command:

    Read local MAC address: AT+DEVID=?\r\n

    SPI Data:

    Read local MAC address: Do not fill in the data

    2.5.8 Read MAC Address of Connected Device 0(0x50)

    AT COMMAND:

    Read MAC Address of Connected Device 0:AT+DEV0=?\r\n

    SPI DATA:

    Read MAC Address of Connected Device 0:no need to fill in

    data

    2.5.9. Read MAC Address of Connected Device 1(0x51)

    AT COMMAND:

    Read MAC Address of Connected Device 1:AT+DEV1=?\r\n

    SPI DATA:

    Read MAC Address of Connected Device 1:no need to fill in

    data

    2.5.10. Read MAC Address of Connected Device 2(0x52)

    AT COMMAND:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 34

    Read MAC Address of Connected Device 2:AT+DEV2=?\r\n

    SPI DATA:

    Read MAC Address of Connected Device 2:no need to fill in

    data

    2.5.11. Read MAC Address of Connected Device 3(0x53)

    AT COMMAND:

    Read MAC Address of Connected Device 3:AT+DEV3=?\r\n

    SPI DATA:

    Read MAC Address of Connected Device 3:no need to fill in

    data

    2.5.12. Read the Role of Module Which connected with Device 0(0x54)

    AT COMMAND:

    Read the Role of Module Which connected with Device 0:

    AT+DEV0_ROLE=?\r\n

    SPI DATA:

    Read the Role of Module Which connected with Device 0:no

    need to fill in data

    Read the data see table 2-5

    2.5.13. Read the Role of Module Which connected with Device 1(0x55)

    AT COMMAND:

    Read the Role of Module Which connected with Device 1:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 35

    AT+DEV1_ROLE=?\r\n

    SPI DATA:

    Read the Role of Module Which connected with Device 1:no

    need to fill in data

    Read the data see table2-5

    2.5.14. Read the Role of Module Which connected with Device 2(0x56)

    AT COMMAND:

    Read the Role of Module Which connected with Device 2:

    AT+DEV2_ROLE=?\r\n

    SPI DATA:

    Read the Role of Module Which connected with Device 2:no

    need to fill in data

    Read the data see table2-5

    2.5.15. Read the Role of Module Which connected with Device 3(0x57)

    AT COMMAND:

    Read the Role of Module Which connected with Device 3:

    AT+DEV3_ROLE=?\r\n

    SPI DATA:

    Read the Role of Module Which connected with Device 3:no

    need to fill in data

    Read the data see table2-5

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 36

    Data Parameter Role Type

    1 The role of broadcast

    2 The role of observe

    4 Slave role

    8 Master role

    Table 2-5

    2.5.16. Status 0 Register(0x1D)

    AT Command:

    read Status 0 Register :AT+FUNSTATE0=?\r\n

    SPI Data:

    Read State 0 Register :Do not fill in the data

    Return data length: 1byte,detail see the following table.

    Bit Name Initial

    Value R/W

    Description

    3~7 NC 0 R/W

    Save

    2 scanRdy 0 R Scan busy flag 1; scanning 0; end scan

    (Not supported)

    1 NC 0 R save

    0 adcRdy 0 R ADC forward to flag 1:ready 0:is

    forwarding

    Table 2-6

    2.5.17. Status 1 Register (0x1E)

    AT Command:

    Set Status 1Register :AT+FUNSTATE1=n\r\n (Parameter see

    table 2-6)

    read Status 1Register :AT+FUNSTATE1=?\r\n

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 37

    SPI Data:

    Set Status 1Register:n (Parameter see table 2-7)

    read Status 1Register :Do not fill in the data

    Bit Name Initial

    Value R/W

    Description

    7 NC 0 R/W save

    6 speakerEn 0 R/W Buzzer enable,1:turn on Buzzer;0:turn

    off Buzzer

    5 pwm5En 0 R/W PWM5 ENABLE,1:TURN ON PWM5; 0:

    TURN OFF PWM5

    4 pwm4En 0 R/W PWM4 ENABLE,1:TURN ON PWM4; 0:

    TURN OFF PWM4

    3 pwm3En 0 R/W PWM3 ENABLE,1:TURN ON PWM3; 0:

    TURN OFF PWM3

    2 pwm2En 0 R/W PWM2 ENABLE,1:TURN ON PWM2; 0:

    TURN OFF PWM2

    1 pwm1En 0 R/W PWM1 ENABLE,1:TURN ON PWM1; 0:

    TURN OFF PWM1

    0 pwm0En 0 R/W PWM0 ENABLE,1:TURN ON PWM0; 0:

    TURN OFF PWM0

    Table 2-7

    2.5.18. Tx Power Register (0x24)

    AT Command:

    Set Tx power :AT+TX=n\r\n (Parameter see table 2-8)

    read Tx power :AT+TX=?\r\n

    SPI Data:

    Set Tx power :n (Parameter see table 2-8)

    read Tx power :Do not fill in the data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 38

    Data Parameter TX Power

    0 -21dbm

    1 -18dbm

    2 -15dbm

    3 -12dbm

    4 -9dbm

    5 -6dbm

    6 -3dbm

    7 0dbm

    8 1dbm

    9 2dbm

    10 3dbm

    11 4dbm

    12 5dbm

    Table 2-8

    2.5.19. Broadcasting Interval(0x26)

    AT Command:

    Set broadcasting interval:AT+ADV_INTERVAL=n\r\n

    read broadcasting interval:AT+ADV_INTERVAL=?\r\n

    SPI Data:

    Set broadcasting interval:Byte 1:fill in LSB data, Byte 2:fill in

    MSB data.

    read broadcasting interval:Do not fill in the data

    Note: n range:32-24000,1 unit/625us, actual corresponding time:20ms-15000ms(15s),send in big-endian.

    2.5.20. Connection interval (0x27)

    AT Command:

    Set connection interval :AT+CON_INTERVAL=n\r\n

    read connection interval :AT+CON_INTERVAL=?\r\n

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 39

    SPI Data:

    Set connection interval :Byte 1:fill in LSB data, Byte 2:fill in

    MSB data.

    read connection interval :Do not fill in the data

    Note: n range:16-3200,1 unit /1.25ms,actual corresponding time:20ms-4000ms(4s),send in big-endian.

    When IOS setting, the Parameter no more than 1578, no less than 17(corresponding 20-2s), or IOS system will

    use default parameter,(need to open BLE_TRANS_SPEED), this parameter must set before Role setting, next boot

    still valid.

    2.5.21. Broadcasting On/Off(0x29)

    AT Command:

    Set broadcasting on/off:AT+ADV=n\r\n(Parameter see table

    2-11)

    read broadcasting on/off:AT+ADV=?\r\n

    SPI Data:

    Set broadcasting on/off:n(Parameter see table 2-11)

    read broadcasting on/off:Do not fill in the data

    Data Parameter transfer speed

    0 Close broadcasting

    1 Open broadcasting

    Table 2-9

    2.5.22. Disconnect the Current Connection(0x1C)

    AT Command:

    Set disconnect the current connection:AT+DISCON\r\n

    SPI Data:

    Set disconnect the current connection:n (fill in any data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 40

    except 0x00disconnect the current connection)

    2.5.23. Software Reset (0x2A)

    AT Command:

    Set software reset :AT+SOFT_RST=1\r\n

    SPI Data:

    Set software reset :0x01

    2.5.24. Software Version Number(0x3D)

    AT Command:

    Set software Version:AT+VERION=?\r\n

    SPI Data:

    Set software Version:Do not fill in the data

    2.5.25. Clear Bluetooth Data Cache(SPI)(0x3E)

    AT Command:

    Null

    SPI Data:

    Set Clear Data Cache:n (Fill in any value)

    2.5.26.BLE Slaver Delay(0x42)

    AT Command:

    Set slaver delay:AT+SLAVE_LATENCY=n\r\n

    Read the slave delay:AT+SLAVE_LATENCY=?\r\n

    SPI Data:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 41

    Set slaver delay:Byte 1:fill in LSB data, Byte 2:fill in MSB data.

    Read the slave delay:Do not fill in the data

    Note:The Slave delay range: 0-500

    2.5.27.Connection Timed out(0x43)

    AT Command:

    Set connection timed out time: AT+CONN_TIMEOUT=n\r\n

    Read connection timed out time: AT+CONN_TIMEOUT=?\r\n

    SPI Data:

    Set connection timed out time: Byte 1:fill in LSB data, Byte 2:

    fill in MSB data.

    Read connection timed out time: Do not fill in the data

    Note: The Slave delay range: 0-1000,unit:10ms

    2.5.28.Broadcasting Data(0x47)

    AT Command:

    Set Broadcasting Data: AT+ADV_MFR_SPC=xxxx\r\n

    Read Broadcasting Data: AT+ADV_MFR_SPC=?\r\n

    SPI Data:

    Set Broadcasting Data: xxx

    Read Broadcasting Data: Do not fill in the data

    Note: Broadcasting data length no more than 18Byte。

    2.5.29. Read Device 0 RSSI(0x58)

    AT COMMAND:

    Read RSSI Value: AT+RSSI_READ0=?\r\n

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 42

    SPI DATA:

    Read RSSI Value: no need to fill in data

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.30. Read Device 1 RSSI(0x59)

    AT COMMAND:

    Read RSSI Value:AT+RSSI_READ1=?\r\n

    SPI DATA:

    Read RSSI Value: no need to fill in data

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.31. Read Device 2 RSSI(0x5A)

    AT COMMAND:

    Read RSSI Value: AT+RSSI_READ2=?\r\n

    SPI DATA:

    Read RSSI Value: no need to fill in data

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.32. Read Device 3 RSSI(0x5B)

    AT COMMAND:

    Read RSSI Value: AT+RSSI_READ3=?\r\n

    SPI DATA:

    Read RSSI Value: no need to fill in data

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.33. RSSI Received Cycle Setting(0x12)

    AT Command:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 43

    Set RSSI received cycle:AT+RSSI_PERIOD=n\r\n

    Read RSSI received cycle:AT+RSSI_PERIOD=?\r\n

    SPI Data:

    Set RSSI received cycle:Byte 1:fill the data LSB,Byte 2:fill

    the data MSB

    read RSSI received cycle:Do not fill in the data

    Note: Cycle value decimal data, range:20ms-5000ms.Transmit data in big-endian mode.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.34. IO0 Read/Write(0x2C)

    AT Command:

    Set IO0output power level :AT+IO0=n\r\n( send in HEX

    format)

    read IO0 power level:AT+IO0=?\r\n

    SPI Data:

    Set IO0 output power level:n

    read O0 power level:Do not fill in the data

    Note: IO0 Read/Write Register see can be taken IO0_0-IO0_7for reference.

    Data send in HEX format, and every data corresponding to each IO port. Data LSB corresponding to

    IO0_0, which in turn pushed up

    Write 1 to Register means output high power level, 0 means output low power level.

    Read 1 from Register means current high power level;0 means low power level.

    Note: this function for custom functions, users can be made according to your

    requirements.

    2.5.35. IO1 Read/Write(0x2D)

    AT Command:

    Set IO1 output power level:AT+IO1=n\r\n(send in HEX

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 44

    format)

    read IO1power level:AT+IO1=?\r\n

    SPI Data:

    Set IO1 output power level:n

    read IO 1 power level:Do not fill in the data

    Note: IO1 Read/Write Register see can be taken IO1_0-IO1_7 for reference.

    Data send in HEX format, and every data corresponding to each IO port. Data LSB corresponding to

    IO1_0, which in turn pushed up

    Write 1 to Register means output high power level, 0 means output low power level.

    Read 1 from Register means current high power level;0 means low power level.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.36. IO2 Read/Write(0x2E)

    AT Command:

    Set IO2output power level : AT+IO2=n\r\n ( send in hex

    format)

    read IO2power level:AT+IO2=?\r\n

    SPI Data:

    Set IO2output power level:n

    read IO2power level:Do not fill in the data

    Note: IO2Read/Write Register see can be takenIO2_0-IO2_2 for reference.

    Data send in HEX format, and every data corresponding to each IO port. Data LSB corresponding to

    IO2_0, which in turn pushed up

    Write 1 to Register means output high power level, 0 means output low power level.

    Read 1 from Register means current high power level;0 means low power level.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.37. IO3 Read/Write(0x2F)

    AT Command:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 45

    Set IO3output power level : AT+IO3=n\r\n ( send in hex

    format)

    read IO3power level:AT+IO3=?\r\n

    SPI Data:

    Set IO3output power level:n

    read IO3power level:Do not fill in the data

    Note: IO3 Read/Write Register can read/write on IO3_0-IO3_1.

    Data send in hex format,and every data corresponding to each IO port. Data LSB corresponding to

    IO3_0, which in turn pushed up

    Write 1 to Register means output high power level, 0 means output low power level.

    Read 1 from Register means current high power level;0 means low power level.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.38. IO0 Direction(0x30)

    AT Command:

    Set IO0 input output direction:AT+DIR0=n\r\n(send in hex

    format)

    read IO0 direction:AT+DIR0=?\r\n

    SPI Data:

    Set IO0 input output direction:n

    read IO0 direction:Do not fill in the data

    Note: IO0 directionRegister can read and set the input output direction of the IO0_0-IO0_7.

    Data send in hex format,and every data corresponding to each IO port. Data LSB corresponding to

    IO0_0, which in turn pushed up

    write 1 to Register means output;0 means input.

    Read from Register,1 means output;0 means input.

    Note: this function for custom functions, users can be made according to your requirements.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 46

    2.5.39. IO1 Direction(0x31)

    AT Command:

    Set IO1 input output direction:AT+DIR1=n\r\n(send in hex

    format)

    read IO1 direction:AT+DIR1=?\r\n

    SPI Data:

    Set IO1 input output direction:n

    read IO1 direction:Do not fill in the data

    Note: IO1 directionRegister can read and set the input output direction of the IO0_0-IO0_7.

    Data send in hex format,and every data corresponding to each IO port. Data LSB corresponding to

    IO1_0, which in turn pushed up

    write 1 to Register means output;0 means input.

    Read from Register,1 means output;0 means input.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.40. IO2 Direction(0x32)

    AT Command:

    Set IO2 input output direction:AT+DIR2=n\r\n(send in hex

    format)

    read IO2 direction:AT+DIR2=?\r\n

    SPI Data:

    Set IO2 input output direction:n

    read IO2 direction:Do not fill in the data

    Note: IO2 directionRegister can read and set the input output direction of theIO2_0-IO2_2.

    Data send in hex format, Data LSB corresponding to IO2_0, which in turn pushed up

    write 1 to Register means output;0 means input.

    Read from Register,1 means output;0 means input.

    Note: this function for custom functions, users can be made according to your requirements.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 47

    2.5.41. IO3 Direction(0x33)

    AT Command:

    Set IO3 input output direction:AT+DIR3=n\r\n(send in hex

    format)

    read IO3 direction:AT+DIR3=?\r\n

    SPI Data:

    Set IO3 input output direction:n

    read IO3 direction:Do not fill in the data

    Note: IO3 directionRegister can read and set the input output direction of theIO3_0-IO3_1.

    Data send in hex format, and each data corresponding an IO, Data LSB corresponding to IO3_0,which in turn

    pushed up

    write 1 to Register means output;0 means input.

    Read from Register,1 means output;0 means input.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.42. PWM0 Frequency Setting(0x34)

    AT Command:

    Set PWM0 FREQUENCY : AT+PWM0_PER=n\r\n ( Send in

    decimal format)

    read PWM0 FREQUENCY:AT+PWM0_PER=?\r\n

    SPI Data:

    Set PWM0 FREQUENCY:n

    read PWM0 FREQUENCY:Do not fill in the data

    Note: PWM Frequency Setting range: 1KHz-2MHz

    Note: this function for custom functions, users can be made according to your requirements.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 48

    2.5.43. PWM1 Frequency Setting(0x35)

    AT Command:

    Set PWM1 FREQUENCY : AT+PWM1_PER=n\r\n ( Send in

    decimal format)

    read PWM1 FREQUENCY:AT+PWM1_PER=?\r\n

    SPI Data:

    Set PWM1 FREQUENCY:n

    read PWM1 FREQUENCY:Do not fill in the data

    Note: PWM Frequency Setting range: 1KHz-2MHz

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.44. PWM2 Frequency Setting(0x36)

    AT Command:

    Set PWM2 FREQUENCY : AT+PWM2_PER=n\r\n ( Send in

    decimal format)

    read PWM2 FREQUENCY:AT+PWM2_PER=?\r\n

    SPI Data:

    Set PWM2 FREQUENCY:n

    read PWM2 FREQUENCY:Do not fill in the data

    Note: PWM Frequency Setting range: 1KHz-2MHz

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.45. PWM3 Frequency Setting(0x37)

    AT Command:

    Set PWM3 FREQUENCY : AT+PWM3_PER=n\r\n ( Send in

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 49

    decimal format)

    read PWM3 FREQUENCY:AT+PWM3_PER=?\r\n

    SPI Data:

    Set PWM3 FREQUENCY:n

    read PWM3 FREQUENCY:Do not fill in the data

    Note: PWM Frequency Setting range: 1KHz-2MHz

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.46. PWM 0 Duty-cycle(0x4A)

    AT Command:

    Set PWM 0 Duty-cycle:AT+PWM0_DUTY=n\r\n(Send in

    decimal format)

    read PWM 0 Duty-cycle:AT+PWM0_DUTY=?\r\n

    SPI Data:

    Set PWM 0 Duty-cycle:n

    read PWM 0 Duty-cycle:Do not fill in the data

    Note: PWM Duty-cycle setting range:1-99,unit:%

    2.5.47. PWM1 Duty-cycle(0x4B)

    AT Command:

    Set PWM1 Duty-cycle : AT+PWM1_DUTY=n\r\n ( Send in

    decimal format)

    read PWM1 Duty-cycle:AT+PWM1_DUTY=?\r\n

    SPI Data:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 50

    Set PWM1 Duty-cycle:n

    read PWM1 Duty-cycle:Do not fill in the data

    Note: PWM Duty-cycle setting range:1-99,unit:%

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.48. PWM2Duty-cycle(0x4C)

    AT Command:

    Set PWM2 Duty-cycle : AT+PWM2_DUTY=n\r\n ( Send in

    decimal format)

    read PWM2 Duty-cycle:AT+PWM2_DUTY=?\r\n

    SPI Data:

    Set PWM2 Duty-cycle:n

    read PWM2 Duty-cycle:Do not fill in the data

    Note: PWM Duty-cycle setting range:1-99,unit:%

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.49. PWM3Duty-cycle(0x4D)

    AT Command:

    Set PWM3 Duty-cycle : AT+PWM3_DUTY=n\r\n ( Send in

    decimal format)

    read PWM3 Duty-cycle:AT+PWM3_DUTY=?\r\n

    SPI Data:

    Set PWM3 Duty-cycle:n

    read PWM3 Duty-cycle:Do not fill in the data

    Note: PWM Duty-cycle setting range:1-99,unit:%

    Note: this function for custom functions, users can be made according to your requirements.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 51

    2.5.50. Real Time Clock(0x2B)

    AT Command:

    Set real time clock:

    AT+UTC_TIME=ssmmhhDDMMY1Y1Y2Y2\r\n (Send in HEX

    format)

    Serial port set UTC clock format:

    ss:second

    mm:minute

    hh:hour

    DD: day

    MM:month

    Y1Y1:year(LSB)

    Y2Y2:year(MSB)

    Example:set date 2016-01-01 12:30:00

    AT+UTC_TIME=001E0C0101E007\r\n

    read real time clock:AT+UTC_TIME=?\r\n

    Example:read date 2016-01-01 12:30:00

    Module return:AT+OK\r\n2016-01-01\r\n12:30:00\r\n

    SPI Data:

    Set real time clock:xxxx

    read broadcasting on/off:Do not fill in the data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 52

    SPI real time clock setting and read format(HEX):

    Byte 1:second

    Byte 2:minute

    Byte 3:hour

    Byte 4:day

    Byte 5:month

    Byte 6:year(LSB)

    Byte 7:year(MSB)

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.51. ADC Configuration Register (0x1F)

    AT Command:

    Set Status 1 Register :AT+ADCCFG=n\r\n (Parameter see

    table 2-7)

    read Status 1 Register :AT+ADCCFG=?\r\n

    SPI Data:

    Set Status 1 Register :n (Parameter see table 2-7)

    read Status 1 Register :Do not fill in the data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 53

    Bit Name Initial

    Value R/W

    Description

    15~8 Filtering

    times 0 R/W

    Fill in filtering times

    7~6 Reference

    voltage 0 R/W

    Reference voltage selection( 00:4.3V

    01:VDD)

    10:Peripheral reference voltage(not

    open)

    5~4 Channel

    selection 0 R/W

    Channel selection 00: channel 0

    01: channel 1

    3~0 Sampling

    Duration 0 R/W

    Sampling duration:

    0011: 2.7us

    0100: 5.3us

    0101: 10.6us

    0110: 21.3us

    0111: 42.6us

    1000: 85.3us

    1001: 170us

    1010: 341us

    1011: 682us

    Table 2-10

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.52. Receive ADC Value(0x20)

    AT Command:

    Read ADC Value: AT+ADCVAL=?\r\n

    SPI Data:

    Read ADC Value: Do not fill in the data

    Note: returned AD value did not forward to voltage value,need user do it by himself.

    Note: this function for custom functions, users can be made according to your requirements.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 54

    2.5.53. The Percentage of Battery Charge(0x41)

    AT Command:

    Read The percentage of battery charge:AT+BAT_LEVEL=?\r\n

    SPI Data:

    Read The percentage of battery charge:Do not fill in the data

    Note: this function for custom functions, users can be made according to your

    requirements.

    2.5.54. Nonvolatile Memorizer Address(0x21)

    AT Command:

    Set Nonvolatile Memorizer address: AT+NV_ADDR=n\r\n (n

    range: 0-8)

    Read Nonvolatile Memorizer address: AT+NV_ADDR=?\r\n

    SPI Data:

    Set Nonvolatile Memorizer address: AT+NV_ADDR=n\r\n (n

    range: 0-8)

    Read Nonvolatile Memorizer address: Do not fill in the data

    Note: this function for custom functions, users can be made according to your

    requirements.

    2.5.55. Nonvolatile Memorizer Data Length(0x22)

    AT Command:

    Set Nonvolatile Memorizer data length:

    AT+NV_DAT_LEN=n\r\n (n range: 1-90)

    Read Nonvolatile Memorizer data length:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 55

    AT+NV_DAT_LEN=?\r\n

    SPI Data:

    Set Nonvolatile Memorizer data length:n (n range: 1-64)

    Read Nonvolatile Memorizer data length:Do not fill in the

    data

    Note: this function for custom functions, users can be made according to your

    requirements.

    2.5.56. Nonvolatile Memorizer Data(0x23)

    AT Command:

    Set Nonvolatile Memorizer Data: AT+NV_DATA=xxxx\r\n

    (Storage data content,ASCII format)

    Read Nonvolatile Memorizer Data: AT+NV_DATA=?\r\n

    SPI Data:

    Set Nonvolatile Memorizer Data: Storage data content(HEX

    format)

    Read Nonvolatile Memorizer Data: Do not fill in the data

    Note: 1.Before write and read nonvolatile memorizer data, please set nonvolatile memorizer address and

    nonvolatile memorizer data length first.

    2.Note data length no more than 20.

    Note: this function for custom functions, users can be made according to your requirements.

    2.5.57. Read Bluetooth Data of Device 0(0x5C)

    AT COMMAND:

    AT+D0=xxx\r\n

    SPI DATA:

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 56

    Write Bluetooth data:Write data content which need to send

    Read Bluetooth data:no need to fill in data

    Notes:

    This command can only send data to the device 0 which has been connected.

    UART data, each packet allows data maximum of 80 bytes (including AT commands).

    SPI data, each packet allowsdata maximum of 80 bytes.

    The module will automatically subcontracted, 20 bytes per packet

    The maximum data Interval = (maximum amount of data (total number of bytes (not including AT

    command)) / 20) * Maximum transmission interval.

    Please reduce the occurrence of the circumstances of each packet interval of data is far less than

    the maximum Bluetooth connection interval, this easily lead to data loss.

    UART data transmission volume calculation method to calculate the amount of data sent as follows:

    HEX mode: The actual number of bytes sent = (total number of bytes of data packets - AT

    commands (10 bytes)) / 2

    Character mode: The actual number of bytes sent = total number of bytes of data packets - AT

    commands (10 byte)

    Data transmission interval not less than 250ms

    2.5.58. Read Bluetooth Data of Device 1(0x5D)

    AT COMMAND:

    AT+D1=xxx\r\n

    SPI DATA:

    Write Bluetooth data:Write data content which need to send

    Read Bluetooth data:no need to fill in data

    Notes:

    This command can only send data to the device 1which has been connected.

    UART data, each packet allows data maximum of 80 bytes (including AT commands).

    SPI data, each packet allowsdata maximum of 80 bytes.

    The module will automatically subcontracted, 20 bytes per packet

    The maximum data Interval = (maximum amount of data (total number of bytes (not including AT

    command)) / 20) * Maximum transmission interval.

    Please reduce the occurrence of the circumstances of each packet interval of data is far less than

    the maximum Bluetooth connection interval, this easily lead to data loss.

    UART data transmission volume calculation method to calculate the amount of data sent as follows:

    HEX mode: The actual number of bytes sent = (total number of bytes of data packets - AT

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 57

    commands (10 bytes)) / 2

    Character mode: The actual number of bytes sent = total number of bytes of data packets - AT

    commands (10 byte)

    Data transmission interval not less than 250ms

    2.5.59. Read Bluetooth Data of Device 2(0x5E)

    AT COMMAND:

    AT+D2=xxx\r\n

    SPI DATA:

    Write Bluetooth data:Write data content which need to send

    Read Bluetooth data:no need to fill in data

    Notes:

    This command can only send data to the device 2which has been connected.

    UART data, each packet allows data maximum of 80 bytes (including AT commands).

    SPI data, each packet allowsdata maximum of 80 bytes.

    The module will automatically subcontracted, 20 bytes per packet

    The maximum data Interval = (maximum amount of data (total number of bytes (not including AT

    command)) / 20) * Maximum transmission interval.

    Please reduce the occurrence of the circumstances of each packet interval of data is far less than

    the maximum Bluetooth connection interval, this easily lead to data loss.

    UART data transmission volume calculation method to calculate the amount of data sent as follows:

    HEX mode: The actual number of bytes sent = (total number of bytes of data packets - AT

    commands (10 bytes)) / 2

    Character mode: The actual number of bytes sent = total number of bytes of data packets - AT

    commands (10 byte)

    Data transmission interval not less than 250ms

    2.5.60. Read Bluetooth Data of Device 3(0x5F)

    AT COMMAND:

    AT+D3=xxx\r\n

    SPI DATA:

    Write Bluetooth data:Write data content which need to send

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 58

    Read Bluetooth data:no need to fill in data

    Notes:

    This command can only send data to the device 3which has been connected.

    UART data, each packet allows data maximum of 80 bytes (including AT commands).

    SPI data, each packet allowsdata maximum of 80 bytes.

    The module will automatically subcontracted, 20 bytes per packet

    The maximum data Interval = (maximum amount of data (total number of bytes (not including AT

    command)) / 20) * Maximum transmission interval.

    Please reduce the occurrence of the circumstances of each packet interval of data is far less than

    the maximum Bluetooth connection interval, this easily lead to data loss.

    UART data transmission volume calculation method to calculate the amount of data sent as follows:

    HEX mode: The actual number of bytes sent = (total number of bytes of data packets - AT

    commands (10 bytes)) / 2

    Character mode: The actual number of bytes sent = total number of bytes of data packets - AT

    commands (10 byte)

    Data transmission interval not less than 250ms

    2.5.61. Transparent Transmission Data of Serial Port(/)

    AT Command:

    Send transparent transmission data: AT+DATA=xxx\r\n

    SPI Data:

    null

    Notes:

    This command can only send data to the device which has been connected.

    UART data, each packet allows data maximum of 80 bytes (including AT commands).

    The module will automatically subcontracted, 20 bytes per packet

    The maximum data Interval = (maximum amount of data (total number of bytes (not including AT

    command)) / 20) * Maximum transmission interval.

    Please reduce the occurrence of the circumstances of each packet interval of data is far less than

    the maximum Bluetooth connection interval, this easily lead to data loss.

    UART data transmission volume calculation method to calculate the amount of data sent as follows:

    HEX mode: The actual number of bytes sent = (total number of bytes of data packets - AT

    commands (10 bytes)) / 2

    Character mode: The actual number of bytes sent = total number of bytes of data packets - AT

    commands (10 byte)

    Data transmission interval not less than 250ms

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 59

    2.5.62. UART Receiving Data Description

    Under UART Mode, Module will send Dn:xxxxxxx to MCU after

    receiving Bluetooth data.

    Here Dn means device number which connected to module, n range: 0-3

    3.Tool APP Description

    Attached Qr Code is developed by TCC, all right reserved. This Tool APP

    has Android and IOS Version, please scan this Qr Code and download

    this Tool APP.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 60

    3.1.APP Read & Set the Module Parameter

    Note:

    ①APP will get current information of

    the module;

    ② APP will read the current

    parameter;

    ③Select or fill in the parameter;

    ④APP will set these parameters to

    module.

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 61

    3.2.TX& RX Data

    Note:

    ①Clear data;

    ②Display received data;

    ③Input data which need to send;

    ④On / off timer functions to send

    data.

    ⑤Modify send data time interval of

    timer function;

    ⑥Select send/display format

    (ASCII/HEX)。

    ⑦Single transmit data

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 62

    4.Contact Us

    深圳市昇润科技有限公司

    ShenZhen ShengRun Technology Co.,Ltd.

    Tel: 0755-86233846

    Fax: 0755-82970906

    Website: www.tuner168.com

    Alibaba Shop:http://shop1439435278127.1688.com

    E-mail: [email protected]

    address: The 6th Floor B Block of Jingu Pioneer Park, Longzhu 4th Road,

    Xili Town, Nanashan District, Shenzhen, Guangdong Province

    http://www.tuner168.com/http://shop1439435278127.1688.com/mailto:[email protected]

  • BLE 4.1 Module specification

    ShenZhen ShengRun Technology Co., Ltd. 63

    5.Revision History

    Version Time Revision Content

    V1.0 2016-05-04 Specification release

    V1.1 2016-05-10 1.Modify errors

    2.Modify APP pictures

    V1.2 2016-05-15 1.Modify power consumption testing results

    V1.3 2016-05-25 1.Modify Baud rate setting range

    2.Add product pictures and dimension

    V1.4 2016-06-01 1.Add QFN 5x5

    V1.5 2016-06-23 1.Modify errors

    V1.6 2016-07-16

    1.Add multi-connection description

    2.Modify command table

    3.Modify Baud rate number

    V1.7 2016-08-01 1.Modify SPI command number

    1. BLE4.1 Module Brief Introduction1.1. Function Introduction1.2. Main features1.3. Electrical Characteristics1.4. Bluetooth Module Power Consumption Table1.5. Operating Mode Schematic Diagram1.5.1.Slave Mode1.5.2.Master Mode1.5.3.Master-slave Mode

    1.6. Module Pin Map1.7. Pins Function1.7.1 QFN 7*7 Module Pin Functions1.7.2 QFN 5*5 Module Pin Functions

    2. Command Description2.1. Command Table2.2. SPI Command Format Description2.2.1. SPI Write Command2.2.2. SPI Read Command

    2.3. Serial Ports Command Format Description2.3.1. Serial Ports Read/Write Command2.3.2. Serial Ports Receive BLE Data

    2.4. Bluetooth Read/Write Description2.4.1. UUID Description2.4.2. Module Bluetooth Channel Operating Instruction

    2.5. Command Description2.5.1. Data Mode Selection(0x02)2.5.2. View the Current Command Status(0x06)2.5.3. View the System Status(0x07)2.5.4. Received Bluetooth Data Length(SPI)(0x0B)2.5.5. Serial Port Baud Rate Setting(0x0D)2.5.6. BLE Module Name Setting(0x0E)2.5.7. Device MAC Address Reading(0x11)2.5.8 Read MAC Address of Connected Device 0(0x50)2.5.9. Read MAC Address of Connected Device 1(0x51)2.5.10. Read MAC Address of Connected Device 2(0x52)2.5.11. Read MAC Address of Connected Device 3(0x53)2.5.12. Read the Role of Module Which connected with Device 0(0x54)2.5.13. Read the Role of Module Which connected with Device 1(0x55)2.5.14. Read the Role of Module Which connected with Device 2(0x56)2.5.15. Read the Role of Module Which connected with Device 3(0x57)2.5.16. Status 0 Register(0x1D)2.5.17. Status 1 Register (0x1E)2.5.18. Tx Power Register (0x24)2.5.19. Broadcasting Interval(0x26)2.5.20. Connection interval (0x27)2.5.21. Broadcasting On/Off(0x29)2.5.22. Disconnect the Current Connection(0x1C)2.5.23. Software Reset (0x2A)2.5.24. Software Version Number(0x3D)2.5.25. Clear Bluetooth Data Cache(SPI)(0x3E)2.5.26.BLE Slaver Delay(0x42)2.5.27.Connection Timed out(0x43)2.5.28.Broadcasting Data(0x47)2.5.29. Read Device 0 RSSI(0x58)2.5.30. Read Device 1 RSSI(0x59)2.5.31. Read Device 2 RSSI(0x5A)2.5.32. Read Device 3 RSSI(0x5B)2.5.33. RSSI Received Cycle Setting(0x12)2.5.34. IO0 Read/Write(0x2C)2.5.35. IO1 Read/Write(0x2D)2.5.36. IO2 Read/Write(0x2E)2.5.37. IO3 Read/Write(0x2F)2.5.38. IO0 Direction(0x30)2.5.39. IO1 Direction(0x31)2.5.40. IO2 Direction(0x32)2.5.41. IO3 Direction(0x33)2.5.42. PWM0 Frequency Setting(0x34)2.5.43. PWM1 Frequency Setting(0x35)2.5.44. PWM2 Frequency Setting(0x36)2.5.45. PWM3 Frequency Setting(0x37)2.5.46. PWM 0 Duty-cycle(0x4A)2.5.47. PWM1 Duty-cycle(0x4B)2.5.48. PWM2Duty-cycle(0x4C)2.5.49. PWM3Duty-cycle(0x4D)2.5.50. Real Time Clock(0x2B)2.5.51. ADC Configuration Register (0x1F)2.5.52. Receive ADC Value(0x20)2.5.53. The Percentage of Battery Charge(0x41)2.5.54. Nonvolatile Memorizer Address(0x21)2.5.55. Nonvolatile Memorizer Data Length(0x22)2.5.56. Nonvolatile Memorizer Data(0x23)2.5.57. Read Bluetooth Data of Device 0(0x5C)2.5.58. Read Bluetooth Data of Device 1(0x5D)2.5.59. Read Bluetooth Data of Device 2(0x5E)2.5.60. Read Bluetooth Data of Device 3(0x5F)2.5.61. Transparent Transmission Data of Serial Port(/)2.5.62. UART Receiving Data Description

    3.Tool APP Description3.1.APP Read & Set the Module Parameter3.2.TX& RX Data

    4.Contact Us5.Revision History