Skip to content

Commit

Permalink
pal: workaround: never disable ble on nrf53
Browse files Browse the repository at this point in the history
[NCSDK-27294]
The last zephyr upmerge causes ble to fail disable
The simple stupid workaround for the issue
may impact sidewalk perfromacne and current consumption

Signed-off-by: Krzysztof Taborowski <[email protected]>
  • Loading branch information
ktaborowski committed Apr 30, 2024
1 parent 2f8856f commit 5e2d9eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
11 changes: 11 additions & 0 deletions subsys/sal/sid_pal/src/sid_ble_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ static sid_error_t ble_adapter_init(const sid_ble_config_t *cfg)
bt_ctlr_set_public_addr(pub_addr.val);
#endif /* CONFIG_MAC_ADDRESS_TYPE_PUBLIC */

#if defined(CONFIG_SOC_SERIES_NRF53X)
static bool bt_enabled;
if (!bt_enabled) {
bt_enabled = true;
}
#endif /* CONFIG_SOC_SERIES_NRF53X */
int err_code;
err_code = bt_enable(NULL);
switch (err_code) {
Expand Down Expand Up @@ -266,6 +272,11 @@ static sid_error_t ble_adapter_deinit(void)
LOG_DBG("Sidewalk -> BLE");
sid_ble_conn_deinit();

#if defined(CONFIG_SOC_SERIES_NRF53X)
return SID_ERROR_NONE;
#endif /* CONFIG_SOC_SERIES_NRF53X */


int err = bt_disable();

if (err) {
Expand Down
4 changes: 0 additions & 4 deletions subsys/sal/sid_pal/src/sid_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ sid_error_t sid_pal_common_init(const platform_specific_init_parameters_t *platf
}
#if defined(CONFIG_SIDEWALK_SUBGHZ_SUPPORT)
set_radio_sx126x_device_config(platform_init_parameters->radio_cfg);
#if defined(CONFIG_SOC_SERIES_NRF53X)
(void)bt_enable(NULL);
(void)bt_disable();
#endif /* defined(CONFIG_SOC_SERIES_NRF53X) */
#endif /* defined(CONFIG_SIDEWALK_SUBGHZ_SUPPORT) */

#if defined(CONFIG_SIDEWALK_TEMPERATURE)
Expand Down
8 changes: 7 additions & 1 deletion utils/src/nordic_dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,15 @@ int nordic_dfu_ble_start(void)
application_state_dfu(&global_state_notifier, true);
dk_leds_init();

int err = bt_enable(NULL);
int err = 0;

#if !defined(CONFIG_SOC_SERIES_NRF53X)
err = bt_enable(NULL);
if (err && err != -EALREADY) {
LOG_ERR("Bluetooth enable failed (err %d)", err);
return err;
}
#endif /* CONFIG_SOC_SERIES_NRF53X */

mgmt_callback_register(&dfu_mode_mgmt_cb);

Expand Down Expand Up @@ -153,11 +157,13 @@ int nordic_dfu_ble_stop(void)
return err;
}

#if !defined(CONFIG_SOC_SERIES_NRF53X)
err = bt_disable();
if (err) {
LOG_ERR("Bluetooth disable failed (err %d)", err);
return err;
}
#endif /* CONFIG_SOC_SERIES_NRF53X */

LOG_INF("Advertising successfully stoped");

Expand Down

0 comments on commit 5e2d9eb

Please sign in to comment.