Skip to main content
LMehm
Associate III
July 11, 2023
Question

Unable to get RTC interrupt with STM32L476.

  • July 11, 2023
  • 3 replies
  • 2609 views

Hello!

I am trying to get interrupt on each second using STM32L476 RTC module.

I am configuring RTC module using cubeMX.

RTC module interrupt is enabled, but there aren't any interrupts from RTC?!

Would you please advice!

    This topic has been closed for replies.

    3 replies

    KDJEM.1
    ST Technical Moderator
    July 13, 2023

    Hello @LMehm ,

    I recommend you, when you configure the RTC, to follow the steps shared in this FAQ: How to configure the RTC to wake up the STM32 periodically from Low Power modes. 

    In this article we will see how to configure the RTC peripheral of the STM32 to wake up the STM32 periodically from a low power mode like STOP2 mode which is one of the lowest power modes of the STM3L4.

    Also, I advise you to take a look to this wiki: Getting started with RTC.

    This article explains how to use the RTC. It provides code examples to use RTC Alarm with interrupt with NUCLEO-L476RG board.

    When your question is answered, please close this topic by choosing "Accept as Solution". This will help other users find that answer faster.

    Kaouthar

     

    To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
    Piranha
    Principal III
    July 13, 2023

    For the simplest example of a "once per second" alarm, the article presents the worst approach with an unreliable implementation - the code reconfigures the alarm every second and, if this code is interrupted for more than a second, then the alarm stops working at all.

    Similarly for UART those articles doesn't show an actually real life usable reception example, because with the flawed-by-design HAL it is almost impossible.

    And, of course, the all of the code examples in knowledge base articles are similarly full of bugs, issues and generally dumb code. Here is an example:

    https://community.st.com/t5/stm32-mcus/how-to-jump-to-system-bootloader-from-application-code-on-stm32/tac-p/568644/highlight/true#M475

    Tinnagit
    Senior II
    July 13, 2023

    if you just want to get interrupt every each second by RTC.
    you can use Alarm mode and enable all mask in alarm setting but this function require a calendar.

    but if you want it wakeup that you have to make sure it's in sleep mode.