Hi Q&A
Recently, the Bluetooth communication protocol (nrf52833) was added to the ESB, both can communicate normally, but there is a problem when switching between the two, the procedure is as follows:
static void ble_stack_init(void)
{
ret_code_t err_code;
err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code);
ASSERT(nrf_sdh_is_enabled());
uint32_t ram_start = 0;
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
APP_ERROR_CHECK(err_code);
err_code = nrf_sdh_ble_enable(&ram_start); //nrf_sdh_ble_enable
APP_ERROR_CHECK(err_code);
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}
for (;;)
{
if(running_mode != previous_mode){
previous_mode = running_mode;
if(running_mode == BLE_MODE) //Bluetooth mode
{
NRF_LOG_INFO("BLE mode");
nrf_drv_clock_lfclk_release();
err_code = nrf_esb_disable();
APP_ERROR_CHECK(err_code);
ble_stack_init();
ble_hrs_app_start();
app_sched_resume();
advertising_start(false);
}
else if(running_mode == PROPRIETARY_MODE) //2.4G mode
{
NRF_LOG_INFO("PROPRIETARY mode");
my_ble_stop_advitising();
ble_hrs_app_stop();
ble_stack_stop();
nrf_drv_clock_lfclk_request(NULL);
esb_initial();
}
}
}
When called [nrf_esb_write_payload(&tx_payload)] An error occurred when switching to Bluetooth after communication.
Without invoking it Bluetooth and ESB can be silky switched.
The trace found the error at this point in the nrf_sdh_disable_request() function.