[
https://issues.apache.org/jira/browse/MYNEWT-862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16247996#comment-16247996
]
ASF GitHub Bot commented on MYNEWT-862:
---------------------------------------
wes3 closed pull request #647: net/nimble: MYNEWT-862 HFXO not always turning
off
URL: https://github.com/apache/mynewt-core/pull/647
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/net/nimble/controller/src/ble_ll_adv.c
b/net/nimble/controller/src/ble_ll_adv.c
index 99bb24704..e51a322cf 100644
--- a/net/nimble/controller/src/ble_ll_adv.c
+++ b/net/nimble/controller/src/ble_ll_adv.c
@@ -1314,9 +1314,6 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
ble_ll_state_set(BLE_LL_STATE_STANDBY);
g_ble_ll_cur_adv_sm = NULL;
ble_ll_scan_chk_resume();
-#ifdef BLE_XCVR_RFCLK
- ble_ll_sched_rfclk_chk_restart();
-#endif
}
#else
if (ble_ll_state_get() == BLE_LL_STATE_ADV) {
@@ -1325,11 +1322,11 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
ble_ll_state_set(BLE_LL_STATE_STANDBY);
g_ble_ll_cur_adv_sm = NULL;
ble_ll_scan_chk_resume();
-#ifdef BLE_XCVR_RFCLK
- ble_ll_sched_rfclk_chk_restart();
-#endif
}
#endif
+#ifdef BLE_XCVR_RFCLK
+ ble_ll_sched_rfclk_chk_restart();
+#endif
OS_EXIT_CRITICAL(sr);
os_eventq_remove(&g_ble_ll_data.ll_evq, &advsm->adv_txdone_ev);
diff --git a/net/nimble/controller/src/ble_ll_sched.c
b/net/nimble/controller/src/ble_ll_sched.c
index 5ec3a9dee..8db9ced02 100644
--- a/net/nimble/controller/src/ble_ll_sched.c
+++ b/net/nimble/controller/src/ble_ll_sched.c
@@ -1240,13 +1240,11 @@ ble_ll_sched_next_time(uint32_t *next_event_time)
void
ble_ll_sched_rfclk_chk_restart(void)
{
- int stop;
os_sr_t sr;
uint8_t ll_state;
int32_t time_till_next;
uint32_t next_time;
- stop = 0;
OS_ENTER_CRITICAL(sr);
ll_state = ble_ll_state_get();
if (ble_ll_sched_next_time(&next_time)) {
@@ -1256,19 +1254,24 @@ ble_ll_sched_rfclk_chk_restart(void)
*/
time_till_next = (int32_t)(next_time - os_cputime_get32());
if (time_till_next > g_ble_ll_data.ll_xtal_ticks) {
- /* Stop the clock */
- stop = 1;
+ /* Restart the rfclk timer based on the next scheduled time */
ble_ll_xcvr_rfclk_timer_start(next_time);
+
+ /* Only disable the rfclk if doing nothing */
+ if (ll_state == BLE_LL_STATE_STANDBY) {
+ ble_ll_log(BLE_LL_LOG_ID_RFCLK_SCHED_DIS,
g_ble_ll_data.ll_rfclk_state,
+ 0, 0);
+ ble_ll_xcvr_rfclk_disable();
+ }
}
} else {
- stop = 1;
- }
-
- /* Only disable the rfclk if doing nothing */
- if (stop && (ll_state == BLE_LL_STATE_STANDBY)) {
- ble_ll_log(BLE_LL_LOG_ID_RFCLK_SCHED_DIS, g_ble_ll_data.ll_rfclk_state,
- 0, 0);
- ble_ll_xcvr_rfclk_disable();
+ /*
+ * Only stop the timer and rfclk if doing nothing currently. If
+ * in some other state, that state will handle the timer and rfclk
+ */
+ if (ll_state == BLE_LL_STATE_STANDBY) {
+ ble_ll_xcvr_rfclk_stop();
+ }
}
OS_EXIT_CRITICAL(sr);
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> HFXO on nrf platforms not being turned off in all cases
> -------------------------------------------------------
>
> Key: MYNEWT-862
> URL: https://issues.apache.org/jira/browse/MYNEWT-862
> Project: Mynewt
> Issue Type: Bug
> Security Level: Public(Viewable by anyone)
> Components: Nimble
> Affects Versions: v1_2_0_rel
> Reporter: William San Filippo
> Assignee: William San Filippo
> Fix For: v1_3_0_rel
>
>
> The HFXO, which is required for radio operation and draws a fair amount of
> current, should only be turned on when needed for radio operations. There was
> a bug in the code that would prevent the HFXO from being turned off when the
> device stopped advertising. The most common case for this bug was when the
> device was advertising and doing nothing else, and then advertising was
> stopped.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)