Development record of AP6275S Bluetooth module based on rk3588 platform

Table of contents

linux bluetooth test tool

Bluetoothctl

hciconfig

hcitool

Enable spp service

1. Module configuration

2. Add SPP service

3. View SPP services

Linux Bluetooth mobile phone debugging

problem analysis:

windowsPC bluetooth test

1. Select more Bluetooth options in Windows Bluetooth settings

2. Add virtual incoming and outgoing exits

3. Use the serial port assistant to perform transceiver testing

Compile rkwifibt-app in Rockchip rk3588 sdk

problem analysis

Missing library when cross compiling rkwifibt on Ubuntu

Reference documentation:


linux bluetooth test tool

Bluetoothctl

As shown in the figure below, bluetoothctl can perform Bluetooth scanning, trust, pairing and other functions

hciconfig

Enter hciconfig on the command line to display device information.

Commonly used commands:

Turn on/off/reset hci device: hciconfig hci0 up/down/reset
authentication turn on/off: hciconfig hci0 auth/noauth, directly reflected in whether to enter the connection PIN password when making a Bluetooth connection, used for PIN pairing
to view/change the Bluetooth master Slave status: hciconfig hci0 lm master (change to master mode), hciconfig hci0 lm slave (change to slave mode)
View/set Bluetooth name: hciconfig hci0 name, hciconfig hci0 name LPA3588

hcitool

View HCI device information: hcitool dev
discovers surrounding Bluetooth devices: hcitool -i hci0 inq
Bluetooth scan: hcitool -i hci0 inq
View detected Bluetooth information: hcitool -i hci0 name 88:A9:B7:E6:F1:8F
Send CMD Bluetooth command: hcitool cmd --help

Enable spp service

1. Module configuration

Turn off Bluetooth
sudo hciconfig hci0 down

Reset bluetooth
sudo hciconfig hci0 reset

Turn on Bluetooth
sudo hciconfig hci0 up

Make Bluetooth connectable and discoverable
sudo hciconfig hci0 piscan 

2. Add SPP service

After configuration, you need to manually add the SPP service

sudo sdptool add SP

If the addition is successful, the following results will be returned:

Serial Port service registered    

3. View SPP services

sudo sdptool browse local 

question:

Error reported after running: Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory

Solution: Modify the startup option of the Bluetooth service in the system. -C means compat and run the Bluetooth service in compatibility mode.

sudo vim /lib/systemd/system/bluetooth.service

ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd -C

Restart Bluetooth service:

sudo systemctl daemon-reload
sudo systemctl restart bluetooth.service

View again

sudo sdptool browse local 

Find the above service and the serial port service SPP is opened successfully.

Linux Bluetooth mobile phone debugging

hcitool scan scans Bluetooth devices 

sdptool add SP adds SPP service to the local device (focused on in the previous section)

Open the Bluetooth serial port tool on the mobile phone (in order to add SPP service)

sdptool browse Bluetooth mac address to check which channel the mobile phone Bluetooth SPP service is on (for example, my Bluetooth mobile phone SPP service is on channel 4)

mknod /dev/rfcomm0 c 216 0 Create device node

chmod 666 /dev/rfcomm0 set permissions

rfcomm bind 0 Bluetooth device mac address 4 (channel 4, don’t forget the channel where the SPP service was searched before)

rfcomm connect 0 Bluetooth device mac address 4 (connect to Bluetooth device)

If Can't create RFCOMM TTY: Address already in use appears at this time 

rfcomm release 0 (release the used Bluetooth rfcomm tty)

Just connect again #rfcomm connect 0 Bluetooth device mac address 4 (connect to Bluetooth device)

problem analysis:

An error occurs when executing rfcomm: RFCOMM TTY support not available

Cause of the problem: The rfcomm tty option in the kernel is not turned on

Solution:

Find this option in the kernel directory of the sdk and enable it

CONFIG_BT_RFCOMM=y

After modification, recompile the kernel and burn it into the board.
 

windowsPC bluetooth test

1. Select more Bluetooth options in Windows Bluetooth settings

2. Add virtual incoming and outgoing exits

3. Use the serial port assistant to perform transceiver testing

Compile rkwifibt-app in Rockchip rk3588 sdk

problem analysis

Missing library when cross compiling rkwifibt on Ubuntu

No package 'glib-2.0' found

Solution: sudo apt-get install libglib2.0-dev

No package 'dbus-1' found
Solution: sudo apt-get install libdbus-1-dev

Reference documentation:

Implementing Bluetooth serial port communication (SPP) on Ubuntu_ubuntu Bluetooth serial port_Chuck_lin's blog-CSDN blog

Linux bluetooth establishes spp service connection_Bluetooth spp_Bai Xiaoxi via's blog-CSDN blog

The most comprehensive Bluetooth debugging tool in history [Collection Summary] - Zhihu

Ubuntu Bluetooth Bluetooth command line connection complete process of sending files_ubuntu Bluetooth sending command_Xinchao Technology Research Institute's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/quququuquq/article/details/131805413