Skip to main content
Visitor II
March 5, 2025
Question

STM32L5 Stop2 and Comparator

  • March 5, 2025
  • 1 reply
  • 532 views

Hello,

 

I'm trying to enable the stop2 mode and using the analog comparators on STM32L5.

It seems that no interrupt is fired when turning the voltage in input+ at a higher leveln than input-. The same code work fine, when entering stop1 instead of stop2.

There's also no problem when running the RTC or waking up via GPIO event if the compartor is not initilized.

Hardware:

  • Nucleo STM32L5 Nucleo-144 board (MB1361)
  • Current is measured on Header IDD

Software:

  • Clocks: LSI as source for RTC and MSI @ 1 MHz as system clock (MSI is also configured as wakup source clock)
  • GPIOs: All pins are configured as analog inputs without pull
  • Comparator is configured using PB2 as input+ and PB1 as input-

How can I use the comperator in stop2 mode?

Thanks for help,
Sven

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    March 11, 2025

    Hello @svenifax and welcome to the community;

     

    What are the plus and minus assignments of COMP inputs?

    I recommend you to read and check COMP1, EXTI and relevant GPIO registers content.

    Could you please try with this sequence:

    1. Enable COMPx and wait the associated startup times.
    2. Configure and enable the EXTI lines corresponding to the COMPx output event in interrupt mode and select the rising, falling or both edges sensitivity.
    1. Clear any possible pending flag for given EXTI lines.
    2. Configure and enable the NVIC IRQ channel mapped to the corresponding EXTI lines.

    Thank you.
    Kaouthar