2017-01-09 02:41 AM
Hi,
I have found a bug for STM32L071xx series in using the comperators with vrefint in the actual Reference Manual V7.0 and the actual HAL STMCubeL0 V.1.7.0:
When selecting the the vrefint for the comperator minus input the comperator is not working as expected and triggers at random values.
In the Reference Manual is said (Page 325):Note: If VREFINT or a fraction of VREFINT (using the scaler) is selected, then EN_VREFINT
bit must be set in the SYSCFG_CFGR3 register (see
Section 9.2.3: Reference control
and status register (SYSCFG_CFGR3)
).
But the EN_VREFINT is not set by the HAL in the function HAL_COMP_Init.
Further in the Reference Manual (Page 235):
Note: It is forbidden to configure both EN_VREFINT and ULP to 1 if the device is in Stop
mode or in Sleep/Low-power sleep mode (refer to
Section 6.4.1: PWR power control
register (PWR_CR)
for a description of the ULP bit). If the device is not in low-power
mode, VREFINT is always enabled whatever the state of EN_VREFINT and ULP.
This is not correct. In my test the VREFINT is not enabled for the comperator when the MCU is in RUN Mode.
As a workaround I enabled the the EN_VREFINT bit manually with:
SET_BIT(SYSCFG->CFGR3, 1);
Now the comperator is working as expected with VREFINT as minus input (only tested COMP2).
Additionally the bit 29 in SYSCFG_CFGR3 is set to 1. But don't now what it means because the bit name is 'Res.'.Be aware that you reset the EN_VREFINT bit before entering stop mode otherwise the power consumption in stop mode is much higher. Setting the ULP bit in PWR_CR Register is not working for me. But it has to be set to get the a low power consumption in stop mode.
Please check this and confirm.Best regards,
Tobias Wedell
#vrefint #bug #reference-manual-error #hal-bug #stm32l0712017-01-13 03:11 AM
Dear
Wedell.Tobias
,Thank you for posting this issue and how you fixed it.
This reported problem isconfirmed and will be fixed in next releases of HAL driver.
We apologize for any inconvenience this may cause and thank you for your understanding.
Regards
ImenD
2017-01-13 04:25 AM
And what about the issue with the reference manual Tobias mentioned in the second part of his post?
Documentation first, please.
JW
2017-01-23 04:13 AM
Hi,
is this issue fixed in the new STMCubeL0 V1.8.0 release?
Regards
Tobias Wedell
2017-01-30 06:18 AM
Hi
Wedell.Tobias
,This issue is reported after release of the STM32CubeL0 V1.8.0 (25 November 2016).
It will be fixed in the coming version of L0 HAL driver.
Regards
Imen
2017-03-16 09:36 PM
I just burnt a whole lot of time on this issue! I also found that setting bit 0 in SYSCFG->CFGR3 enabled the regulator. Can someone please clarify for me if this bit can or cannot be left set in stop mode? I want the reference enabled in stop mode so I can use the comparator to wake up.
Thanks
Ashley
2017-09-21 07:50 AM
This Bug has just cost us one full day of engineering hours. We are using the latest HAL V1.10 and still nothing is fixed. thank you ST.
2017-09-21 10:31 AM
,
,
https://community.st.com/0D70X000006SsXtSAK
,2018-01-08 07:27 AM
Hi Imen,
do you have any plan when the issue will be fixed? I'm waiting for it to upgrade my project to the latest firmware.
Best regards
2018-01-09 06:52 AM
Hello,
After check with the development team, we would inform you that EN_VREFINT bit will be reintroduced in SYSCFG_CFGR3 register in the next release of STM32L0 Firmware package.
Just keep an eye out for the next update!
Best Regards,
Imen