Skip to main content
NAndreadakis
Associate II
Jun 3, 2022 6:45 AM UTC
Question

COMP1 HW or SW problem recovering from STOP2 mode

Hello everyone,

​

I discovered a problem with the STM32WLE5CCU6 using the comp1 on stop2 mode.

​

More specifically, when the debug is enabled on stop2 mode using the command HAL_DBGMCU_EnableDBGStopMode() the comp1 is working and I get all the peaks of the oscillation (see image 1). But when I make a single change, and disable the debug on stop2 mode, with the command HAL_DBGMCU_DisableDBGStopMode() the comp1 stops counting all the oscillation peaks (see image 2).

​

The yellow is the oscillation and the green is the external gpio output of the comparator (see Image 3)

​

I'm not sure if this is a hardware problem or software. Please make your tests and report back.

In the datasheet it isn't clear if on stop2 mode the comp1 data registers are retained, but from the results it seems that they do. Also I have tried to reinitialize the comp during stop2 exit but i get the same results.

​

0693W00000Nr9LfQAJ.pngImage 1

​

0693W00000Nr9LpQAJ.pngImage 2

​

0693W00000Nr9NlQAJ.pngImage 3

This topic has been closed for replies.

4 replies

Benoit MARCHAND
ST Employee
Jun 3, 2022 8:49 AM UTC

Hello,

If you refer to RM0461, Table 37, you can see that COMP1/2 is one of the peripheral which will continue to operate normally even in STOP2 mode. This means that :

  • retention is not applicable, as the block operates normally
  • behavior is the same in DBG_STOP = 0 or DBG_STOP = 1

Can you precise which GPIO you use for you input (yellow) and for your output (green) ?

Thanks,

Benoit

NAndreadakis
Associate II
Jun 3, 2022 9:17 AM UTC

Hi,

I'm using the STOP2 mode.

GPIO PB4 for COMP1 input. (yellow).

GPIO PA0 for COMP1 External output (green).

In the STOP2 mode the DAC that i'm using is not retained. If the DAC OUT1 Mode lost then the comparator use false values on Input [-]

But the DAC looks ok.

Part of DAC initialization code on STOP2 exit:

/*Init DAC start*/

hdac.State = HAL_DAC_STATE_BUSY; /* Change DAC state */

__HAL_DAC_ENABLE(&hdac, DAC_CHANNEL_1); /* Enable the Peripheral */

hdac.State = HAL_DAC_STATE_READY; /* Change DAC state */

// /*Set the DAC_ConnectOnChipPeripheral*/

DAC->MCR &= 1<<0;

// /*DAC Set output voltage*/

__IO uint32_t tmp = 0;

tmp = (uint32_t)hdac.Instance;

tmp += DAC_DHR12R1_ALIGNMENT(DAC_ALIGN_12B_R);

*(__IO uint32_t *) tmp = 2100; /*Set DAC to 1/2 VCC*/

/*Init DAC END*/

Benoit MARCHAND
ST Employee
Jun 3, 2022 11:31 AM UTC

Hello,

Concerning your point on retention. Note that in HAL_DBGMCU_EnableDBGStopMode(), voltage and clocks are maintained on all peripherals. Then all registers of all of them are retained.

BR,

Benoit