关于ble应用 E (2429) BT_APPL: service not created
-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
关于ble应用 E (2429) BT_APPL: service not created
在做ble应用时从example中移植了gatts的代码 ,但是运行时报错(demo是可以的)
E (2429) BT_APPL: service not created
LOG:
I (1859) BTDM_INIT: BT controller compile version [21812e3]
I (1879) system_api: Base MAC address is not set
I (1879) system_api: read default base MAC address from EFUSE
I (1889) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (2229) BT_GATT: GATT_Register
I (2239) BT_GATT: allocated gatt_if=1
I (2239) BT_GATT: GATT_StartIf gatt_if=1
I (2239) BT_GATT: GATTS_CreateService
I (2249) BT_GATT: GATTS_StartService
I (2249) BT_GATT: GATT_Register
I (2249) BT_GATT: allocated gatt_if=2
I (2259) BT_GATT: GATT_StartIf gatt_if=2
I (2259) BT_GATT: GATTS_CreateService
I (2269) BT_GATT: GATTS_StartService
I (2339) Thread: enter normal mode!
I (2349) BT_GATT: GATT_Register
I (2349) Ui: this is ui !
I (2349) BT_GATT: allocated gatt_if=3
I (2349) Thread: [APP]**************************************************
I (2359) BT_GATT: GATT_StartIf gatt_if=3
I (2359) BLE: REGISTER_APP_EVT, status 0, app_id 0
I (2359) Thread: [APP] Free memory: 4323107 bytes
I (2369) Thread: [APP] IDF version: v4.4-dev-3675-g35b20cadce-dirty
I (2379) BT_GATT: GATTS_CreateService
I (2389) BLE: CREATE_SERVICE_EVT, status 0, service_handle 40
I (2399) BT_GATT: GATTS_StartService
I (2399) BLE: SERVICE_START_EVT, status 0, service_handle 40
I (2409) BLE: ADD_CHAR_EVT, status 0, attr_handle 42, service_handle 40
I (2419) BLE: the gatts demo char length = 3
I (2419) BLE: prf_char[0] =11
I (2419) BLE: prf_char[1] =22
I (2429) BLE: prf_char[2] =33
E (2429) BT_APPL: service not created
E (2429) BT_APPL: service not created
LOG:
I (1859) BTDM_INIT: BT controller compile version [21812e3]
I (1879) system_api: Base MAC address is not set
I (1879) system_api: read default base MAC address from EFUSE
I (1889) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (2229) BT_GATT: GATT_Register
I (2239) BT_GATT: allocated gatt_if=1
I (2239) BT_GATT: GATT_StartIf gatt_if=1
I (2239) BT_GATT: GATTS_CreateService
I (2249) BT_GATT: GATTS_StartService
I (2249) BT_GATT: GATT_Register
I (2249) BT_GATT: allocated gatt_if=2
I (2259) BT_GATT: GATT_StartIf gatt_if=2
I (2259) BT_GATT: GATTS_CreateService
I (2269) BT_GATT: GATTS_StartService
I (2339) Thread: enter normal mode!
I (2349) BT_GATT: GATT_Register
I (2349) Ui: this is ui !
I (2349) BT_GATT: allocated gatt_if=3
I (2349) Thread: [APP]**************************************************
I (2359) BT_GATT: GATT_StartIf gatt_if=3
I (2359) BLE: REGISTER_APP_EVT, status 0, app_id 0
I (2359) Thread: [APP] Free memory: 4323107 bytes
I (2369) Thread: [APP] IDF version: v4.4-dev-3675-g35b20cadce-dirty
I (2379) BT_GATT: GATTS_CreateService
I (2389) BLE: CREATE_SERVICE_EVT, status 0, service_handle 40
I (2399) BT_GATT: GATTS_StartService
I (2399) BLE: SERVICE_START_EVT, status 0, service_handle 40
I (2409) BLE: ADD_CHAR_EVT, status 0, attr_handle 42, service_handle 40
I (2419) BLE: the gatts demo char length = 3
I (2419) BLE: prf_char[0] =11
I (2419) BLE: prf_char[1] =22
I (2429) BLE: prf_char[2] =33
E (2429) BT_APPL: service not created
Re: 关于ble应用 E (2429) BT_APPL: service not created
你好,可以提供下你配置 gatt server 的这段相关代码吗 ,最好全面些,包括前面初始化和注册的 API
-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
Re: 关于ble应用 E (2429) BT_APPL: service not created
这个是该项目的仓库 :
https://gitee.com/chenyananee/sadwinner.git
其中sadwinner/ fw / esp32 / Src / APP / app_ble.cpp 为ble的初始化部分,请看一下
https://gitee.com/chenyananee/sadwinner.git
其中sadwinner/ fw / esp32 / Src / APP / app_ble.cpp 为ble的初始化部分,请看一下
-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
Re: 关于ble应用 E (2429) BT_APPL: service not created
void AppBLE::start()为 ble当前的整个部分 这部分都是demo中移植过来的
Re: 关于ble应用 E (2429) BT_APPL: service not created
下图中所标识的这段代码有问题
对应事件下不要使用其他事件的参数,这儿你打印下 param->reg.app_id ,并不是你想要的-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
Re: 关于ble应用 E (2429) BT_APPL: service not created
是的,我看了下idf的源码这个是一个联合体 里面的id并不是我要的东西,我把回调函数接口更改了增加一个参数这样就可以了。 但是我在硬件上初始化完成后 用手机搜索蓝牙设备并没有搜到。
log:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6724
load:0x40078000,len:14812
load:0x40080400,len:3792
entry 0x40080694
I (27) boot: ESP-IDF v4.4-dev-3703-gddc44956bf 2nd stage bootloader
I (27) boot: compile time 10:46:29
I (27) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00008000
I (76) boot: 1 otadata OTA data 01 00 00011000 00002000
I (84) boot: 2 phy_init RF data 01 01 00013000 00001000
I (91) boot: 3 nvs_key NVS keys 01 04 00014000 00002000
I (98) boot: 4 app_cfg WiFi data 01 02 00016000 00002800
I (106) boot: 5 appa OTA app 00 10 00020000 00200000
I (114) boot: End of partition table
I (118) boot_comm: chip revision: 1, min. application chip revision: 0
I (125) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=35540h (218432) map
I (213) esp_image: segment 1: paddr=00055568 vaddr=3ffbdb60 size=05688h ( 22152) load
I (221) esp_image: segment 2: paddr=0005abf8 vaddr=40080000 size=05420h ( 21536) load
I (231) esp_image: segment 3: paddr=00060020 vaddr=400d0020 size=e5284h (938628) map
I (570) esp_image: segment 4: paddr=001452ac vaddr=40085420 size=13fbch ( 81852) load
I (604) esp_image: segment 5: paddr=00159270 vaddr=50000000 size=00010h ( 16) load
I (617) boot: Loaded app from partition at offset 0x20000
I (617) boot: Disabling RNG early entropy source...
I (629) cpu_start: Pro cpu up.
I (629) cpu_start: Starting app cpu, entry point is 0x4008bc7c
I (0) cpu_start: App cpu up.
I (645) cpu_start: Pro cpu start user code
I (645) cpu_start: cpu freq: 160000000
I (645) cpu_start: Application information:
I (650) cpu_start: Project name: sadwinner
I (655) cpu_start: App version: 1
I (659) cpu_start: Compile time: Nov 29 2021 10:46:14
I (666) cpu_start: ELF file SHA256: d0b6ccbecdf9369e...
I (672) cpu_start: ESP-IDF: v4.4-dev-3703-gddc44956bf
I (678) heap_init: Initializing. RAM available for dynamic allocation:
I (685) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (691) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (697) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (704) heap_init: At 3FFCB018 len 00014FE8 (83 KiB): DRAM
I (710) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (716) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (723) heap_init: At 400993DC len 00006C24 (27 KiB): IRAM
I (730) spi_flash: detected chip: gd
I (733) spi_flash: flash io: dio
I (738) sleep: Configure to isolate all GPIO pins in sleep state
I (744) sleep: Enable automatic switching of GPIO sleep configuration
I (751) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (0) Thread: [APP] Startup..
I (20) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (20) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (40) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (40) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (120) BTDM_INIT: BT controller compile version [899ab01]
I (1036) system_api: Base MAC address is not set
I (1036) system_api: read default base MAC address from EFUSE
I (1046) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
sadwinner> I (1386) BT_GATT: GATT_Register
I (1386) BT_GATT: allocated gatt_if=1
I (1386) BT_GATT: GATT_StartIf gatt_if=1
I (1386) BT_GATT: GATTS_CreateService
I (1406) BT_GATT: GATTS_StartService
I (1406) BT_GATT: GATT_Register
I (1406) BT_GATT: allocated gatt_if=2
I (1416) BT_GATT: GATT_StartIf gatt_if=2
I (1416) BT_GATT: GATTS_CreateService
I (1416) BT_GATT: GATTS_StartService
I (1496) Thread: enter normal mode!
I (1496) BT_GATT: GATT_Register
I (1496) Thread: [APP]**************************************************
I (1496) BT_GATT: allocated gatt_if=3
I (1506) Thread: [APP] Free memory: 171612 bytes
I (1506) BT_GATT: GATT_Register
I (1516) BT_GATT: allocated gatt_if=4
I (1506) Thread: [APP] IDF version: v4.4-dev-3703-gddc44956bf
I (1526) BT_GATT: GATT_StartIf gatt_if=3
I (1536) BT_GATT: GATT_StartIf gatt_if=4
I (1506) BLE: REGISTER_APP_EVT, status 0, app_id 0
I (1546) BLE: set device name[ESP_GATTS_DEMO]
I (1546) BLE: REGISTER_APP_EVT, status 0, app_id 1
I (1566) BT_GATT: GATTS_CreateService
I (1566) BLE: CREATE_SERVICE_EVT, status 0, service_handle 40
I (1576) BT_GATT: GATTS_CreateService
I (1576) BT_GATT: GATTS_StartService
I (1576) BLE: CREATE_SERVICE_EVT, status 0, service_handle 44
I (1596) BLE: SERVICE_START_EVT, status 0, service_handle 40
I (1596) BLE: ADD_CHAR_EVT, status 0, attr_handle 42, service_handle 40
I (1606) BLE: the gatts demo char length = 3
I (1606) Thread: exit normal mode!
I (1606) BLE: prf_char[0] =11
I (1606) Thread: enter sleep mode!
I (1616) BLE: prf_char[1] =22
I (1616) BLE: prf_char[2] =33
I (1626) BT_GATT: GATTS_StartService
I (1636) BLE: SERVICE_START_EVT, status 0, service_handle 44
I (1636) BLE: ADD_CHAR_EVT, status 0, attr_handle 46, service_handle 44
I (1646) BLE: the gatts demo char length = 3
I (1646) BLE: prf_char[0] =11
I (1656) BLE: prf_char[1] =22
I (1656) BLE: prf_char[2] =33
I (1656) BLE: ADD_DESCR_EVT, status 0, attr_handle 43, service_handle 40
I (1666) BLE: ADD_DESCR_EVT, status 0, attr_handle 47, service_handle 44
sadwinner>
sadwinner>
sadwinner>
sadwinner>
log:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6724
load:0x40078000,len:14812
load:0x40080400,len:3792
entry 0x40080694
I (27) boot: ESP-IDF v4.4-dev-3703-gddc44956bf 2nd stage bootloader
I (27) boot: compile time 10:46:29
I (27) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00008000
I (76) boot: 1 otadata OTA data 01 00 00011000 00002000
I (84) boot: 2 phy_init RF data 01 01 00013000 00001000
I (91) boot: 3 nvs_key NVS keys 01 04 00014000 00002000
I (98) boot: 4 app_cfg WiFi data 01 02 00016000 00002800
I (106) boot: 5 appa OTA app 00 10 00020000 00200000
I (114) boot: End of partition table
I (118) boot_comm: chip revision: 1, min. application chip revision: 0
I (125) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=35540h (218432) map
I (213) esp_image: segment 1: paddr=00055568 vaddr=3ffbdb60 size=05688h ( 22152) load
I (221) esp_image: segment 2: paddr=0005abf8 vaddr=40080000 size=05420h ( 21536) load
I (231) esp_image: segment 3: paddr=00060020 vaddr=400d0020 size=e5284h (938628) map
I (570) esp_image: segment 4: paddr=001452ac vaddr=40085420 size=13fbch ( 81852) load
I (604) esp_image: segment 5: paddr=00159270 vaddr=50000000 size=00010h ( 16) load
I (617) boot: Loaded app from partition at offset 0x20000
I (617) boot: Disabling RNG early entropy source...
I (629) cpu_start: Pro cpu up.
I (629) cpu_start: Starting app cpu, entry point is 0x4008bc7c
I (0) cpu_start: App cpu up.
I (645) cpu_start: Pro cpu start user code
I (645) cpu_start: cpu freq: 160000000
I (645) cpu_start: Application information:
I (650) cpu_start: Project name: sadwinner
I (655) cpu_start: App version: 1
I (659) cpu_start: Compile time: Nov 29 2021 10:46:14
I (666) cpu_start: ELF file SHA256: d0b6ccbecdf9369e...
I (672) cpu_start: ESP-IDF: v4.4-dev-3703-gddc44956bf
I (678) heap_init: Initializing. RAM available for dynamic allocation:
I (685) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (691) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (697) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (704) heap_init: At 3FFCB018 len 00014FE8 (83 KiB): DRAM
I (710) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (716) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (723) heap_init: At 400993DC len 00006C24 (27 KiB): IRAM
I (730) spi_flash: detected chip: gd
I (733) spi_flash: flash io: dio
I (738) sleep: Configure to isolate all GPIO pins in sleep state
I (744) sleep: Enable automatic switching of GPIO sleep configuration
I (751) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (0) Thread: [APP] Startup..
I (20) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (20) gpio: GPIO[2]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (40) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (40) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (120) BTDM_INIT: BT controller compile version [899ab01]
I (1036) system_api: Base MAC address is not set
I (1036) system_api: read default base MAC address from EFUSE
I (1046) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
sadwinner> I (1386) BT_GATT: GATT_Register
I (1386) BT_GATT: allocated gatt_if=1
I (1386) BT_GATT: GATT_StartIf gatt_if=1
I (1386) BT_GATT: GATTS_CreateService
I (1406) BT_GATT: GATTS_StartService
I (1406) BT_GATT: GATT_Register
I (1406) BT_GATT: allocated gatt_if=2
I (1416) BT_GATT: GATT_StartIf gatt_if=2
I (1416) BT_GATT: GATTS_CreateService
I (1416) BT_GATT: GATTS_StartService
I (1496) Thread: enter normal mode!
I (1496) BT_GATT: GATT_Register
I (1496) Thread: [APP]**************************************************
I (1496) BT_GATT: allocated gatt_if=3
I (1506) Thread: [APP] Free memory: 171612 bytes
I (1506) BT_GATT: GATT_Register
I (1516) BT_GATT: allocated gatt_if=4
I (1506) Thread: [APP] IDF version: v4.4-dev-3703-gddc44956bf
I (1526) BT_GATT: GATT_StartIf gatt_if=3
I (1536) BT_GATT: GATT_StartIf gatt_if=4
I (1506) BLE: REGISTER_APP_EVT, status 0, app_id 0
I (1546) BLE: set device name[ESP_GATTS_DEMO]
I (1546) BLE: REGISTER_APP_EVT, status 0, app_id 1
I (1566) BT_GATT: GATTS_CreateService
I (1566) BLE: CREATE_SERVICE_EVT, status 0, service_handle 40
I (1576) BT_GATT: GATTS_CreateService
I (1576) BT_GATT: GATTS_StartService
I (1576) BLE: CREATE_SERVICE_EVT, status 0, service_handle 44
I (1596) BLE: SERVICE_START_EVT, status 0, service_handle 40
I (1596) BLE: ADD_CHAR_EVT, status 0, attr_handle 42, service_handle 40
I (1606) BLE: the gatts demo char length = 3
I (1606) Thread: exit normal mode!
I (1606) BLE: prf_char[0] =11
I (1606) Thread: enter sleep mode!
I (1616) BLE: prf_char[1] =22
I (1616) BLE: prf_char[2] =33
I (1626) BT_GATT: GATTS_StartService
I (1636) BLE: SERVICE_START_EVT, status 0, service_handle 44
I (1636) BLE: ADD_CHAR_EVT, status 0, attr_handle 46, service_handle 44
I (1646) BLE: the gatts demo char length = 3
I (1646) BLE: prf_char[0] =11
I (1656) BLE: prf_char[1] =22
I (1656) BLE: prf_char[2] =33
I (1656) BLE: ADD_DESCR_EVT, status 0, attr_handle 43, service_handle 40
I (1666) BLE: ADD_DESCR_EVT, status 0, attr_handle 47, service_handle 44
sadwinner>
sadwinner>
sadwinner>
sadwinner>
Re: 关于ble应用 E (2429) BT_APPL: service not created
搜索不到蓝牙,应该是广播过程配置存在某些纰漏,广播中有设置广播参数、设置广播数据和开启广播三个步骤,分别对应代码中的三个 Api, 首先你应当增加 log 来查看每个步骤是否执行完成(执行完成都是相应的事件上来,打印下事件状态),如果三个步骤都按照顺序执行完成了,再进行检查设置的广播参数、广播数据是否存在问题,请与我们demo 的参数做下对比
-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
Re: 关于ble应用 E (2429) BT_APPL: service not created
可以了。
我连接后在日志中有一个警告:
W (33617) BT_L2CAP: l2cble_start_conn_update, the last connection update command still pending.
这个是什么东西。
我连接后在日志中有一个警告:
W (33617) BT_L2CAP: l2cble_start_conn_update, the last connection update command still pending.
这个是什么东西。
Re: 关于ble应用 E (2429) BT_APPL: service not created
就是字面上的意思,更新连接参数的命令挂起, 你看下应用层 esp_ble_gap_update_conn_params(&conn_params) 是不是调用了多次,
这两个 profile 的callback 一样的,我觉得你还是按照 gatt_server demo 中的进行区分开吧,两个同样行为的 profile 是不是没有必要呀
Code: Select all
static struct gatts_profile_inst ble_profile_tab[BLE_APP_ID_MX] = {
[BLE_APP_ID_A] = {
.gatts_cb = AppBLE::gatts_profile_event_handler,
.gatts_if = ESP_GATT_IF_NONE, /* Not get the gatt_if, so initial is ESP_GATT_IF_NONE */
.num_handle = 4,
},
[BLE_APP_ID_B] = {
.gatts_cb = AppBLE::gatts_profile_event_handler,
.gatts_if = ESP_GATT_IF_NONE, /* Not get the gatt_if, so initial is ESP_GATT_IF_NONE */
.num_handle = 4,
},
};
-
- Posts: 30
- Joined: Sun Mar 21, 2021 9:35 am
Re: 关于ble应用 E (2429) BT_APPL: service not created
是这样的,应为回调里做的大部分东西都是重复的,如果做两个回调含函数那么会有许多不必要的重复代码,我在读写事件中区分两个业务做不同的处理。所以我还是希望注册同一个回调接口。
这个demo中的回调也是通过一个for循环轮询处理的应该不存在重入或者资源抢占的情况。所以这个感觉很奇怪,不知道是哪个case引发的。
这个demo中的回调也是通过一个for循环轮询处理的应该不存在重入或者资源抢占的情况。所以这个感觉很奇怪,不知道是哪个case引发的。
Who is online
Users browsing this forum: Google [Bot] and 106 guests