cancel
Showing results for 
Search instead for 
Did you mean: 

COMP1 HW or SW problem recovering from STOP2 mode

NAndreadakis
Associate III

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

4 REPLIES 4
Benoit MARCHAND
Associate III

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

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*/

The problem fixed!!! The DAC initialization were wrong on STOP2 exit.

If the HAL_DBGMCU_EnableDBGStopMode() is used the register map is always retained for debugging propose, be careful with that.

Benoit MARCHAND
Associate III

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