Closed jonhunterking66 closed 4 years ago
You set the wrong param in the function esp_ble_gap_start_advertising(&adv_params);
of ble_task.
@gengyuchao ESP_BT_MODE_BLE is incorrect?
/**
* @brief This function is called to start advertising.
*
* @param[in] adv_params: pointer to User defined adv_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_gap_start_advertising (esp_ble_adv_params_t *adv_params);
You need to set the adv_params like that
static esp_ble_adv_params_t adv_params = {
.adv_int_min = 0x100,
.adv_int_max = 0x100,
.adv_type = ADV_TYPE_IND,
.own_addr_type = BLE_ADDR_TYPE_RANDOM,
.channel_map = ADV_CHNL_ALL,
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
};
@gengyuchao sorry, I did not include the full code. I do have adv_params initialized as such:
static esp_ble_adv_params_t adv_params = {
.adv_int_min = 0x20,
.adv_int_max = 0x40,
.adv_type = ADV_TYPE_IND,
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
//.peer_addr =
//.peer_addr_type =
.channel_map = ADV_CHNL_ALL,
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
};
So, Please change esp_ble_gap_start_advertising(ESP_BT_MODE_BLE);
to esp_ble_gap_start_advertising(&adv_params);
.That will resolve you problem.
Ahhh, okay, I will give it a try. Thank you!
@jonhunterking66 Thanks for reporting and updates. Feel free to reopen if the issue still happens. Thanks.
Environment
git describe --tags
to find it): v4.1-dev-1086-g93a8603c5xtensa-esp32-elf-gcc --version
to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0Problem Description
I have two tasks running initialized in my main. One is a "main task" that contains a switch statement. The various cases will eventually contain binary semaphores to trigger various task functions.
The other task is BLE task that initializes BLE then stops advertising after. In its while loop it waits for a semaphore then starts advertising when it receives one.
Expected Behavior
BLE will initialize properly then proceed to stop advertising. When the main task steps into the case that gives a binary semaphore, the BLE task waiting for the semaphore will trigger and start advertising.
Actual Behavior
BLE does initialize properly and successfully stops scanning. However, when the main task enters the case that gives the binary semaphore to the ble task and start advertising is called, I get a guru mediation error.
Code to reproduce this issue
** I am not putting in all the code to keep it less spamy. Let me know if you want something else!
MAIN CODE
BLE CODE
Debug Logs