Not being able to turn on the bluetooth
Posted: Wed Jul 26, 2017 12:27 pm
I am advertising data using bluetooth on ESP32. I am using this project as a reference - https://github.com/pcbreflux/espressif/ ... pp_ibeacon . This is my app_main() code:
The code works just fine on IDF. Since my whole project is made on Arduino I copied this code and libraries associated with it to my Arduino code. I made some changes like calling the app_main() in the setup() fucntion. The code is getting uploaded but the line
is returning 0/false in this case. Even after turning the bluetooth on in "make menuconfig" menu, I am still stuck at "app_main enable controller failed".
Code: Select all
int app_main()
{
esp_err_t ret;
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ret = esp_bt_controller_init(&bt_cfg);
if (ret) {
ESP_LOGE(GATTS_TAG, "%s initialize controller failed\n", __func__);
return 1;
}
ret = esp_bt_controller_enable(ESP_BT_MODE_BTDM);
if (ret) {
ESP_LOGE(GATTS_TAG, "%s enable controller failed\n", __func__);
return 1;
}
xTaskCreatePinnedToCore(&bleAdvtTask, "bleAdvtTask", 2048, NULL, 5, NULL, 0);
return 0;
}
Code: Select all
esp_bt_controller_enable(ESP_BT_MODE_BTDM)