Stop microsecond TIM clock when CPU is halted by debuger

To avoid "gap in time" error during debug
This commit is contained in:
Andrey Gusakov 2024-02-24 15:49:06 +03:00 committed by rusefillc
parent 200752981e
commit 2644147655
1 changed files with 6 additions and 0 deletions

View File

@ -61,6 +61,12 @@ void portInitMicrosecondTimer() {
// (which would take 358 seconds at 12mhz timer speed), so we have to use normal upcounting
// output compare mode instead.
SCHEDULER_TIMER_DEVICE->CCMR1 = STM32_TIM_CCMR1_OC1M(1);
/* TODO: implement for all possible TIMs */
if (SCHEDULER_TIMER_DEVICE == TIM5) {
/* stop timers clock when core is halted */
DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM5_STOP;
}
}
uint32_t getTimeNowLowerNt() {