Skip to main content
LBier.1
Associate II
January 21, 2026
Solved

Problem with RTC wakeup on STM8L151 from HALT

  • January 21, 2026
  • 1 reply
  • 245 views

I am trying to get wake-up from HALT mode working on the STM8L151 using the RTC, but without success. I tried two approaches:

  • using the RTC wake-up counter to wake the device after 10 seconds and
  • using the RTC alarm to wake it up every minute.

Neither approach was successful — once the MCU enters sleep, it no longer wakes up. I have the feeling that the issue is not so much directly in main and in the CLK + RTC configuration, but rather in the ISR, IQR handling setup. At this point, however, I’m not sure what to add, what to check, or in which files (stm8_interrupt_vector.c, stm8l15x_itc.c,....).
I would be very grateful if someone could advise me on what belongs where, so that I can understand the entire interrupt chain and which additional files in the Inc directory need to be adjusted. In parallel, I also have several related follow-up questions:

I am using STM8L15x_StdPeriph_Driver (downloaded from ST as STSW-STM8016 version 1.6.2) — is this version up to date?

In the examples, there are some related to this topic, but they contain the files stm8l15x_it.h and stm8l15x_it.c. However, I don’t see these files in my basic Inc directory, nor do I see them being included in the main file of the example. So the example didn’t really help me…

My goal is to achieve a setup where the device wakes up regularly every minute. With regard to further development, I would prefer a solution based on the RTC Alarm, where I would also have the current time available, but this is not a strict requirement.

I am using STVD and the latest Cosmic compiler.

Thank you very much for your help. Petr

    Best answer by LBier.1

    Thank you for the tips. The problem turned out to be a single unset bit. It is necessary to connect the RTC to the internal EXTI pin dedicated to the RTC. If it is not connected, the RTC will not physically wake up the MCU from halt().

    1 reply

    AA1
    Senior III
    January 22, 2026

    You should read the RM and verify if you follow all the steps.

    You have this in your code:

     RTC_WriteProtectionCmd(ENABLE);	// this write protects register in line below. So line below have no effect.
    
     RTC_WakeUpCmd(ENABLE);
    LBier.1
    LBier.1AuthorBest answer
    Associate II
    February 3, 2026

    Thank you for the tips. The problem turned out to be a single unset bit. It is necessary to connect the RTC to the internal EXTI pin dedicated to the RTC. If it is not connected, the RTC will not physically wake up the MCU from halt().