-
Notifications
You must be signed in to change notification settings - Fork 2k
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
stm32/l152: ztimer Crash after initial flashing #21010
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When programming the
tests/periph/adc
test program to the NUCLEO-L152RE board withmake flash
, the program crashes on the first call ofztimer_set
. After a power cycle, the program runs without any issues. Likewise, when the program is flashed using the builtin mass storage driver of the ST-Link, the program will start without any issues.Programming the chip with the STM32CubeProgrammer leads to the same result as OpenOCD.
Steps to reproduce the issue
The program I used for testing is
tests/periph/adc
, maybe it can be reproduced with others well. Optionally you can apply the change described in #20780 (comment), but the unmodified master version works just as well.First the ISR stacksize has to be increased, otherwise the
printf
in the Hard Fault handler won't print out anything. Just addCFLAGS += -DISR_STACKSIZE=1024
totests/periph/adc/Makefile
.BOARD=nucleo-l152re make flash term
Usually the output won't be complete, so hit the reset button:
With the ztimer ENABLE_DEBUG flag enabled in
sys/ztimer/core.c
, the output becomes the following:After a power cycle, this is the resulting output:
It looks like the program crashes either in
_add_entry_to_list()
or in theztimer_handler()
function.Maybe someone a bit more familiar with ztimer can have a look at this issue. My theory is that some register is not properly reset.
I don't know which hardware timer
ztimer
uses on the STM32L152ZE, but there is a remark in the reference manual [1] on page 165, section 6.3.14:Does ztimer use the RTC or relies on the LSE-registers? Trying to access the write protected RTC registers would surely lead to a Hard Fault?
Expected results
Regardless of the flashing method, the program should not crash when using ztimer.
Actual results
The program crashes.
Versions
Note: I updated OpenOCD to see if that was the cause of the issue, but the same happens with OpenOCD 0.11 and 0.12.
[1] https://www.st.com/resource/en/reference_manual/cd00240193-stm32l100xx-stm32l151xx-stm32l152xx-and-stm32l162xx-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf
The text was updated successfully, but these errors were encountered: