We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b93dca commit 9635d3fCopy full SHA for 9635d3f
targets/TARGET_STM/lp_ticker.c
@@ -179,7 +179,12 @@ static void LPTIM1_IRQHandler(void)
179
uint32_t lp_ticker_read(void)
180
{
181
uint32_t lp_time = LPTIM1->CNT;
182
- return lp_time;
+ /* Reading the LPTIM_CNT register may return unreliable values.
183
+ It is necessary to perform two consecutive read accesses and verify that the two returned values are identical */
184
+ while (lp_time != LPTIM1->CNT) {
185
+ lp_time = LPTIM1->CNT;
186
+ }
187
+ return lp_time;
188
}
189
190
void lp_ticker_set_interrupt(timestamp_t timestamp)
0 commit comments