File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,10 @@ void lp_ticker_init(void)
151
151
HAL_LPTIM_Counter_Start (& LptimHandle , 0xFFFF );
152
152
153
153
/* Need to write a compare value in order to get LPTIM_FLAG_CMPOK in set_interrupt */
154
+ __HAL_LPTIM_CLEAR_FLAG (& LptimHandle , LPTIM_FLAG_CMPOK );
154
155
__HAL_LPTIM_COMPARE_SET (& LptimHandle , 0 );
156
+ while (__HAL_LPTIM_GET_FLAG (& LptimHandle , LPTIM_FLAG_CMPOK ) == RESET ) {
157
+ }
155
158
}
156
159
157
160
static void LPTIM1_IRQHandler (void )
@@ -200,10 +203,8 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
200
203
201
204
/* CMPOK is set by hardware to inform application that the APB bus write operation to the LPTIM_CMP register has been successfully completed */
202
205
/* Any successive write before the CMPOK flag be set, will lead to unpredictable results */
203
- if (__HAL_LPTIM_GET_FLAG (& LptimHandle , LPTIM_FLAG_CMPOK ) == RESET ) {
204
- return ;
205
- }
206
-
206
+ /* LPTICKER_DELAY_TICKS value prevents OS to call this set interrupt function before CMPOK */
207
+ MBED_ASSERT (__HAL_LPTIM_GET_FLAG (& LptimHandle , LPTIM_FLAG_CMPOK ) == SET );
207
208
__HAL_LPTIM_CLEAR_FLAG (& LptimHandle , LPTIM_FLAG_CMPOK );
208
209
__HAL_LPTIM_COMPARE_SET (& LptimHandle , timestamp );
209
210
You can’t perform that action at this time.
0 commit comments