From 5e2d9eb721565cee162fb5db50859f6109950339 Mon Sep 17 00:00:00 2001 From: Krzysztof Taborowski Date: Tue, 30 Apr 2024 16:43:32 +0200 Subject: [PATCH] pal: workaround: never disable ble on nrf53 [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 --- subsys/sal/sid_pal/src/sid_ble_adapter.c | 11 +++++++++++ subsys/sal/sid_pal/src/sid_common.c | 4 ---- utils/src/nordic_dfu.c | 8 +++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/subsys/sal/sid_pal/src/sid_ble_adapter.c b/subsys/sal/sid_pal/src/sid_ble_adapter.c index 6dd06e22b7..677611f0a1 100644 --- a/subsys/sal/sid_pal/src/sid_ble_adapter.c +++ b/subsys/sal/sid_pal/src/sid_ble_adapter.c @@ -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) { @@ -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) { diff --git a/subsys/sal/sid_pal/src/sid_common.c b/subsys/sal/sid_pal/src/sid_common.c index f58729ae60..aed4ae6f4d 100644 --- a/subsys/sal/sid_pal/src/sid_common.c +++ b/subsys/sal/sid_pal/src/sid_common.c @@ -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) diff --git a/utils/src/nordic_dfu.c b/utils/src/nordic_dfu.c index 992d7b5591..b6dcb495e5 100644 --- a/utils/src/nordic_dfu.c +++ b/utils/src/nordic_dfu.c @@ -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); @@ -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");