ble_spp_server_demo device association fail

accacca
Posts: 34
Joined: Mon Aug 06, 2018 4:59 pm

ble_spp_server_demo device association fail

Postby accacca » Wed May 10, 2023 12:13 pm

I wanted to test the bluetooth connection between my ESP32S3 WROOM 1 module and the PC (WIN10).
I used the BLE_SPP_server example compiled and loaded into the module.
PC sees the device with name ESP_SPP_SERVER but cannot connect.
I also tried with a phone (Honor 7C) and equally the device is seen but not connected
I have to change something in the code?
Thanks

Logs:

After reset

Code: Select all

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0xb (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3810,len:0x1648
load:0x403c9700,len:0xbe0
load:0x403cc700,len:0x2ef8
entry 0x403c9900
I (25) boot: ESP-IDF v5.0.1 2nd stage bootloader 
I (25) boot: compile time 12:37:02
I (25) boot: chip revision: v0.1
I (27) boot.esp32s3: Boot SPI Speed : 80MHz      
I (31) boot.esp32s3: SPI Mode       : DIO        
I (36) boot.esp32s3: SPI Flash Size : 2MB        
I (41) boot: Enabling RNG early entropy source...
I (46) boot: Partition Table:
I (50) boot: ## Label            Usage          Type ST Offset   Length  
I (57) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (65) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (72) boot:  2 factory          factory app      00 00 00010000 00100000
I (80) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=3c090020 size=2f014h (192532) map
I (127) esp_image: segment 1: paddr=0003f03c vaddr=3fc97000 size=00fdch (  4060) load
I (128) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=86af8h (551672) map
I (231) esp_image: segment 3: paddr=000c6b20 vaddr=3fc97fdc size=02600h (  9728) load
I (234) esp_image: segment 4: paddr=000c9128 vaddr=40374000 size=12fd0h ( 77776) load
I (262) boot: Loaded app from partition at offset 0x10000
I (262) boot: Disabling RNG early entropy source...
I (274) cpu_start: Pro cpu up.
I (274) cpu_start: Starting app cpu, entry point is 0x40375400
0x40375400: call_start_cpu1 at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/esp_system/port/cpu_start.c:142

I (0) cpu_start: App cpu up.
I (288) cpu_start: Pro cpu start user code
I (288) cpu_start: cpu freq: 160000000 Hz
I (288) cpu_start: Application information:
I (291) cpu_start: Project name:     ble_spp_server_demo
I (297) cpu_start: App version:      1
I (302) cpu_start: Compile time:     May 10 2023 12:35:20
I (308) cpu_start: ELF file SHA256:  5ce07fbd36c23ee7...
I (314) cpu_start: ESP-IDF:          v5.0.1
I (319) cpu_start: Min chip rev:     v0.0
I (323) cpu_start: Max chip rev:     v0.99 
I (328) cpu_start: Chip rev:         v0.1
I (333) heap_init: Initializing. RAM available for dynamic allocation:
I (340) heap_init: At 3FCAA4C0 len 0003F250 (252 KiB): D/IRAM
I (347) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (353) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (359) heap_init: At 600FE010 len 00001FF0 (7 KiB): RTCRAM
I (367) spi_flash: detected chip: generic
I (371) spi_flash: flash io: dio
W (374) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (388) coexist: coexist rom version e7ae62f
I (393) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (460) BT_INIT: BT controller compile version [80abacd]
I (460) phy_init: phy_version 540,a5d905b,Oct 20 2022,19:36:11
I (500) system_api: Base MAC address is not set
I (500) system_api: read default base MAC address from EFUSE
I (500) BT_INIT: Bluetooth MAC: 7c:df:a1:e3:6b:fa

I (510) GATTS_SPP_DEMO: app_main init bluetooth

I (520) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (520) BT_BTM: BTM_SEC_REG[0]: id 50, is_orig 1, psm 0x001f, proto_id 0, chan_id 0

I (530) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (540) BT_BTM: btm_sec_set_security_level : sec: 0x0

I (540) BT_BTM: BTM_SEC_REG[0]: id 50, is_orig 0, psm 0x001f, proto_id 0, chan_id 0

I (550) BT_BTM:                : sec: 0x80, service name [] (up to 21 chars saved)

I (560) BT_GATT: GATT_Register
I (560) BT_GATT: allocated gatt_if=1

I (570) BT_GATT: GATT_StartIf gatt_if=1
I (570) BT_GATT: GATTS_CreateService

I (580) BT_GATT: GATTS_StartService
I (580) BT_GATT: GATT_Register
I (580) BT_GATT: allocated gatt_if=2

I (590) BT_GATT: GATT_StartIf gatt_if=2
I (590) BT_GATT: GATTS_CreateService

I (600) BT_GATT: GATTS_StartService
I (620) BT_BTM: BTM_SetPageScanType

I (620) BT_BTM: BTM_SetInquiryScanType

I (620) BT_GATT: GATT_Register
I (620) BT_GATT: allocated gatt_if=3

I (630) BT_GATT: GATT_StartIf gatt_if=3
I (630) GATTS_SPP_DEMO: EVT 0, gatts if 3

I (640) GATTS_SPP_DEMO: event = 0

I (640) GATTS_SPP_DEMO: gatts_profile_event_handler 493

I (650) GATTS_SPP_DEMO: gatts_profile_event_handler 496

I (650) GATTS_SPP_DEMO: gatts_profile_event_handler 499

I (660) BT_GATT: GATTS_CreateService

I (670) GATTS_SPP_DEMO: EVT 22, gatts if 3

I (670) GATTS_SPP_DEMO: event = 16

I (670) GATTS_SPP_DEMO: The number handle =b

E (680) GATTS_SPP_DEMO: GAP_EVT, event 4

I (680) BT_GATT: GATTS_StartService
I (690) BT_APPL: BTA_DmSetBleAdvParamsAll: 32, 64

I (690) BT_APPL: adv_type = 0, addr_type_own = 0, chnl_map = 7, adv_fil_pol = 0

I (700) GATTS_SPP_DEMO: EVT 12, gatts if 3

I (700) GATTS_SPP_DEm�I
when I try t connect

Code: Select all

 
 ......
 ......
 
(700) GATTS_SPP_DEm�I (9270) BT_BTM: BTM_InqDbRead: bd addr [30e37a983d7e]

I (9380) BT_GATT: GATT_GetConnIdIfConnected status=1

I (9380) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (9390) BT_GATT: GATT_GetConnectionInfor conn_id=3
I (9390) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
I (9400) GATTS_SPP_DEMO: EVT 14, gatts if 3

I (9400) GATTS_SPP_DEMO: event = e

I (9410) GATTS_SPP_DEMO: EVT 4, gatts if 3

I (9410) GATTS_SPP_DEMO: event = 4

E (9440) GATTS_SPP_DEMO: GAP_EVT, event 10

I (9500) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (9620) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (9740) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (9860) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (9980) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10100) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10220) BT_GATT: GATTS_SendRsp: conn_id: 1  trans_id: 1  Status: 0x0000

I (10220) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10340) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10460) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10580) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10700) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10820) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (10940) BT_GATT: GATTS_SendRsp: conn_id: 2  trans_id: 2  Status: 0x0000

I (10940) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (11060) BT_GATT: GATTS_SendRsp: conn_id: 2  trans_id: 3  Status: 0x0000

I (11060) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (11180) BT_GATT: GATTS_SendRsp: conn_id: 2  trans_id: 4  Status: 0x0000

I (11180) BT_L2CAP: L2CA_SendFixedChnlData()  CID: 0x0004  BDA: 30e37a983d7e
I (39370) BT_GATT: GATT_GetConnIdIfConnected status=0

I (39370) BT_BTM: BTM_InqDbRead: bd addr [30e37a983d7e]

I (39370) BT_BTM: BTM_IsAclConnectionUp: RemBdAddr: 30e37a983d7e

E (39370) BT_BTM: Device not found

W (39380) BT_HCI: hcif disc complete: hdl 0x1, rsn 0x13
I (39380) BT_BTM: BTM_IsAclConnectionUp: RemBdAddr: 30e37a983d7e

I (39390) BT_L2CAP: L2CA_SetDesireRole() new:x1, disallow_switch:0
I (39400) GATTS_SPP_DEMO: EVT 15, gatts if 3

I (39400) GATTS_SPP_DEMO: event = f

E (39410) GATTS_SPP_DEMO: GAP_EVT, event 8

I (39410) BT_APPL: BTA_DmSetBleAdvParamsAll: 32, 64

I (39420) BT_APPL: adv_type = 0, addr_type_own = 0, chnl_map = 7, adv_fil_pol = 0

E (39430) GATTS_SPP_DEMO: GAP_EVT, event 6


MicroController
Posts: 1216
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ble_spp_server_demo device association fail

Postby MicroController » Wed May 10, 2023 9:25 pm

The issue may be that there is no BLE-SPP standard. Hence, every device can/must implement its own emulation of the "SPP" protocol, and use custom UUIDs for the attributes involved. The BLE-SPP example uses non-standard UUIDs starting from 0xABF0, and custom messages in the exchange. For these reasons, there is no standard BLE-SPP device (driver) for PCs or phones and these clients won't recognize the service(s) provided by your ESP.

You can somewhat test your BLE-SPP application using the Nordic NRF Connect app, or Microsoft's "Bluetooth LE Explorer".

Then there is the Nordic NRF BLE-SPP example which is used by many makers/hobbyists and may have some support with certain apps.

accacca
Posts: 34
Joined: Mon Aug 06, 2018 4:59 pm

Re: ble_spp_server_demo device association fail

Postby accacca » Thu May 11, 2023 7:15 am

Thanks MicroController for infos.
I solved,
As you say, the problem is not related to the ESP example but in the program I was using to connect to ESP32
I use this app
https://play.google.com/store/apps/deta ... l=it&gl=US

Scan could not find any devices. To do this it requires to enable phone location access....
As soon as I enabled location access the scan found the device.
The program allows you to configure the custom device by assigning UUIDs and now it works correctly
thanks again for the support

Who is online

Users browsing this forum: No registered users and 213 guests