【Shengrun Bluetooth】Bluetooth 4.0BLE module (model CC2541) use log of mutual communication between two Bluetooth

Use Shengrun Bluetooth 4.0BLE module (model CC2541) to realize the communication between two Bluetooth modules

There is a lot of data on the communication between computers and mobile phones and the Bluetooth module, but the communication data between the Bluetooth modules is relatively small. This article takes the CC2541 module as an example to realize the data communication between two Bluetooth modules.

hardware preparation

  • 1. One CC2541 master-slave module
  • 2. One module of CC2541 slave
    Note: Bluetooth modules with almost the same appearance distinguish master and slave. Generally speaking, two Bluetooth devices that are all slaves cannot communicate with each other. Two masters and slaves can also be integrated. In short: there must be a module that can act as a host

Module introduction diagram

insert image description here
insert image description here
insert image description here

Physical map

Made a simple adapter board to lead out vcc, gnd, tx, rx. The filter capacitor is temporarily connected to 100pf.
insert image description here

software preparation

The debugging software uses the official software. TTC transparent transmission module parameter setting V3.4.9.6 Lite
insert image description here

Software and reference documentation package download

  • Method 1: Package and download
  • Method 2: A cloud link: https://pan.baidu.com/s/1NBp71S-lHyXA4jUvjE68tw Extraction code: 9x7n . If it doesn't work, comment or send a private message.

Implementation steps

Preparation part: Use two usb to ttl to connect the two bluetooth modules of the host and the slave respectively. (Note that tx is connected to rx, don't be wrong)

  • 1. Check and configure the same baud rate
  • First click on the detection module function insert image description here
    to detect the two Bluetooth modules I connected
    (if not detected, please detect the wiring, welding, power supply, etc.)
    insert image description here
    According to the detected information, open the serial port.
    insert image description here

Set the baud rate to 9600 (two software windows can be opened) and
click to set the serial port baud rate. AT+BAUD=0, there may be no reply at this time.

insert image description here
Close the serial port, change it to 9600 and open it again. The communication test is normal, indicating that the baud rate is successfully changed to 9600.
insert image description here

  • 2. The host is set to host mode AT+SETUP=81C0002C
    host com4 send AT+SETUP=81C0002C, set host mode. (The default is to start in slave mode, and this command is required to switch)
    (This command is only valid for the master-slave module, single-slave module is invalid.)
    insert image description here
    Reply AT+OK, indicating that the setting is successful. Restart the host
    com4 and set it to host mode. AT+SET=0

insert image description here
com3 is set to slave AT+SET=1insert image description here

  • 3. Connect to the slave machine AT+SCA=START
    scan, the following figure finds device 1, AT+NUM=1
    insert image description hereconnects to the slave machine AT+CON#1
    clicks device 1, and receives AT+CON=SUCCESS indicates that the connection is successful
    insert image description here

result test

Send 123, can receive. Indicates that the communication between the two Bluetooth modules is successful.
insert image description here

Instruction Statistics:

instruction normal reply
AT+SOFT_RST=1 Soft reset none
AT+ADV=0 AT+OK closes the broadcast
AT+ADV=1 AT+OK to turn on the broadcast
AT+SET=1 AT+OK set slave
AT+SET=0 AT+OK set host
AT+SCA=START AT+OK AT+NUM=1 to start scanning
AT+LIST_NUM=? 1 Get the list
AT+CON#1 AT+CON=OK Connection succeeded
AT+DISCON AT+OK closes the broadcast and disconnects the current connection

Guess you like

Origin blog.csdn.net/qq_44078824/article/details/122202118