-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with clock speed for STM32 16 bits targets #7316
Comments
ARM Internal Ref: MBOTRIAGE-907 |
I made this trial: I have replaced this:
with this:
And all RTC tests are PASS again on NUCLEO_F103RB (use a 16-bit timer). Unfortunately we can't do this as the HAL_GetTick function is called in the ST HAL driver for calculating timeouts. The main thing is that I don't understand what happens in here ?... |
Hi @bcostm I took a more detailed look into this and it appears to be caused by HAL_InitTick resetting the ticker interrupt enable register - specifically TIM4_DIER from 0x2 to 0x0 on the stm32f103. This disables the interrupt that The reason the first call to us_ticker_set_interrupt() causes problems is because this is where the overflow handling is setup. If this is called after HAL_InitTick has been called then everything works normally. Since your code calls it before the second HAL_InitTick the interrupt it sets is turned off. For reference this is the callstack for where the overflow interrupt is initially set:
To fix this there are a couple of options I can think of:
|
Thanks for your analysis and proposals. Unfortunately I have checked all of them but there are always one or more RTC tests which fail... It's maybe because I didn't write it correctly or there are other things. |
Update: the proposal 3 is working fine (the RTC tests are PASS and the HAL_Delay is OK). So, I'll send a PR with this fix. Thanks again ! |
Description
Since #7106, some RTC tests are now FAILED with targets supporting only 16 bits systick timer.
tests-mbed_hal-rtc | RTC - persist | 0 | 1 | FAIL | 8.08
First analysis:
During test, the "wait(4)" is expiring after 8 seconds
Currently, we don't understand the impact of this #7106 ,
but maybe the wait function have some issue with us_ticker using 16 bits counter ?
@c1728p9 @geky @bulislaw
Thx
Issue request type
The text was updated successfully, but these errors were encountered: