Problem with BLE implementation under ESP-IDF (ESP32-S3)
Posted: Tue Jan 17, 2023 4:27 pm
Good afternoon,
I am working with an ESP32-S3-DevKitC-1 EVM and I would like to implement BLE stack.
I am working with C++, so I have created a Bluetooth Task which should enable the BLE.
However, I get problems using the Bluedroid BLE Stack :
At beginning I just wanted my device to advertise.
1) I have activated the Bluetooth using sdkconfig file.
2) In My TaskBluetooth.hpp file, I have included the following files :
#include "nvs_flash.h"
#include "esp_bt.h"
#include "esp_gap_ble_api.h"
#include "esp_gattc_api.h"
#include "esp_gatt_defs.h"
#include "esp_bt_main.h"
#include "esp_bt_defs.h"
3) In my TaskBluetooth.cpp file, in the main code of the TaskBluetooth, I have written the following lines :
ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
// Initialisation du contrôleur BT : */
ret = esp_bt_controller_init(&bt_cfg);
if (ret) {
printf("TaskBluetooth : Fail to initialise controller.\n");
}
// Choix du Mode BLE au niveau du contrôleur BT : */
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
if (ret) {
printf("TaskBluetooth : Fail to enable controller.\n");
}
/* Initialisation de Bluedroid : */
ret = esp_bluedroid_init();
if (ret) {
printf("TaskBluetooth : Fail to initialise Bluedroid.\n");
}
/* Activation de Bluedroid : */
ret = esp_bluedroid_enable();
if (ret) {
printf("TaskBluetooth : Fail to enable Bluedroid.\n");
}
When I compile the program, I get the following errors and I don't know why.
I know that i need to register a callback after that I start the advertising but my program does not work at the moment.
DO you have any idea please?
undefined reference to `gl_bta_adv_data_ptr' ProtoFS22 line 0, external location: c:\espressif\tools\xtensa-esp32s3-elf\esp-2022r1-11.2.0\xtensa-esp32s3-elf\xtensa-esp32s3-elf\bin\ld.exe: esp-idf\bt\libbt.a(btc_task.c.obj) C/C++ Problem
undefined reference to `gl_bta_scan_rsp_data_ptr' ProtoFS22 line 0, external location: c:\espressif\tools\xtensa-esp32s3-elf\esp-2022r1-11.2.0\xtensa-esp32s3-elf\xtensa-esp32s3-elf\bin\ld.exe: esp-idf\bt\libbt.a(btc_task.c.obj) C/C++ Problem
I am working with an ESP32-S3-DevKitC-1 EVM and I would like to implement BLE stack.
I am working with C++, so I have created a Bluetooth Task which should enable the BLE.
However, I get problems using the Bluedroid BLE Stack :
At beginning I just wanted my device to advertise.
1) I have activated the Bluetooth using sdkconfig file.
2) In My TaskBluetooth.hpp file, I have included the following files :
#include "nvs_flash.h"
#include "esp_bt.h"
#include "esp_gap_ble_api.h"
#include "esp_gattc_api.h"
#include "esp_gatt_defs.h"
#include "esp_bt_main.h"
#include "esp_bt_defs.h"
3) In my TaskBluetooth.cpp file, in the main code of the TaskBluetooth, I have written the following lines :
ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
// Initialisation du contrôleur BT : */
ret = esp_bt_controller_init(&bt_cfg);
if (ret) {
printf("TaskBluetooth : Fail to initialise controller.\n");
}
// Choix du Mode BLE au niveau du contrôleur BT : */
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
if (ret) {
printf("TaskBluetooth : Fail to enable controller.\n");
}
/* Initialisation de Bluedroid : */
ret = esp_bluedroid_init();
if (ret) {
printf("TaskBluetooth : Fail to initialise Bluedroid.\n");
}
/* Activation de Bluedroid : */
ret = esp_bluedroid_enable();
if (ret) {
printf("TaskBluetooth : Fail to enable Bluedroid.\n");
}
When I compile the program, I get the following errors and I don't know why.
I know that i need to register a callback after that I start the advertising but my program does not work at the moment.
DO you have any idea please?
undefined reference to `gl_bta_adv_data_ptr' ProtoFS22 line 0, external location: c:\espressif\tools\xtensa-esp32s3-elf\esp-2022r1-11.2.0\xtensa-esp32s3-elf\xtensa-esp32s3-elf\bin\ld.exe: esp-idf\bt\libbt.a(btc_task.c.obj) C/C++ Problem
undefined reference to `gl_bta_scan_rsp_data_ptr' ProtoFS22 line 0, external location: c:\espressif\tools\xtensa-esp32s3-elf\esp-2022r1-11.2.0\xtensa-esp32s3-elf\xtensa-esp32s3-elf\bin\ld.exe: esp-idf\bt\libbt.a(btc_task.c.obj) C/C++ Problem