Nimble BLE Server

Alberk
Posts: 50
Joined: Sat Jun 19, 2021 1:49 am

Nimble BLE Server

Postby Alberk » Sun Jul 24, 2022 11:18 am

I am looking for a way to pause the BLE advertisement. What is the best way to go about doing this? Is it a good practice to do it via ble_gap_adv_stop and ble_gap_adv_start ?

Alberk
Posts: 50
Joined: Sat Jun 19, 2021 1:49 am

Re: Nimble BLE Server

Postby Alberk » Tue Jul 26, 2022 1:13 am

Hi,

I am still not able to reinitialize

Code: Select all

nimble_port_freertos_init(ble_host_task)
for a second time even when all the teardown was done properly. I am getting a system panic when this is called a second time. Can someone confirm this? Thank you.

Alberk
Posts: 50
Joined: Sat Jun 19, 2021 1:49 am

Re: Nimble BLE Server

Postby Alberk » Sun Jul 31, 2022 3:47 am

Hi,

I am reading the ESP documentation [esp_bt_controller_deinit][https://docs.espressif.com/projects/esp ... ler_deinit] and it says that it can only be called once.

Does that mean that calling [esp_nimble_hci_and_controller_deinit()][https://github.com/espressif/esp-idf/bl ... hci.c#L517] will disallow further calls to esp_nimble_hci_and_controller_init() ?

irahul
Posts: 36
Joined: Fri Jun 18, 2021 10:07 am

Re: Nimble BLE Server

Postby irahul » Tue Aug 16, 2022 6:20 am

Hi @Alberk
Alberk wrote:
Sun Jul 24, 2022 11:18 am
I am looking for a way to pause the BLE advertisement. What is the best way to go about doing this? Is it a good practice to do it via ble_gap_adv_stop and ble_gap_adv_start ?
Yes. Before starting adv, need to ensure the correct fields are set . So invoking ble_gap_adv_set_fields and ble_gap_adv_rsp_set_fields before ble_gap_adv_start is a good practice.
for a second time even when all the teardown was done properly. I am getting a system panic when this is called a second time. Can someone confirm this? Thank you.
Please see attached sample application which does init / deinit in a loop. Hope this helps.
Attachments
patch_4.4.zip
(987 Bytes) Downloaded 317 times

Alberk
Posts: 50
Joined: Sat Jun 19, 2021 1:49 am

Re: Nimble BLE Server

Postby Alberk » Tue Aug 16, 2022 9:36 am

I think the problem is resolved now but more testing needed. The system panic after the second time the `nimble_port_freertos_init(ble_host_task)` is called was caused by double release of a pointer.

irahul
Posts: 36
Joined: Fri Jun 18, 2021 10:07 am

Re: Nimble BLE Server

Postby irahul » Tue Aug 16, 2022 9:56 am

Alberk wrote: I think the problem is resolved now but more testing needed. The system panic after the second time the `nimble_port_freertos_init(ble_host_task)` is called was caused by double release of a pointer.
Hi Alberk,
Is this Nimble code which is causing double release of a pointer or FreeRTOS code ?

Alberk
Posts: 50
Joined: Sat Jun 19, 2021 1:49 am

Re: Nimble BLE Server

Postby Alberk » Wed Aug 17, 2022 9:57 am

The double release of the pointer is in custom code, not in IDF or Nimble.

Who is online

Users browsing this forum: No registered users and 111 guests