2020-06-23 09:35 PM
i'm using STM32L072,how to trigger the LSECSS interrupt?
i've got HAL_RCCEx_EnableLSECSS(),HAL_RCCEx_EnableLSECSS_IT(), but the flag RCC_IT_LSECSS never set when LSE error comes up.
plz give a clue or the flow of LSECSS
2020-06-24 01:48 PM
Read out and check/post content of relevant RCC registers.
JW
2020-06-28 12:30 AM
hi JW,
thank you for reply,
i try to check RCC->CSR ,firstly the value is 0x1c052303.the register value changed into 0x1c054303 when LSE error occured.
back to the normal , there is not effect to set CSSLSEON bit. it's alway keep this value 0x1c054303 .
what's wrong with it?
2020-06-28 12:51 AM
I don't have a 'L0 at hand to try now.
From description in RM in LSE Clock Security System subchapter of RCC chapter:
The software MUST then reset the CSSLSEON bit and stop the defective 32 kHz oscillator
by resetting LSEON bit.
So, try to write 0 into CSSLSEON bit, ignoring that it's 0 already, then write 0 to LSEON.
Also, your original complaint was, that there's no interrupt - have you had a look at the RCC_CIFR.CSSLSEF and is RCC_CIER.CSSLSE set and is EXTI19 configured in EXTI, and the interrupt from it is enabled in NVIC and the address of ISR set at 0x0000_0048 in the interrupt vector table?
JW
2020-06-28 01:28 AM
thanks for your reply,
i try to CLEAR_BIT(RCC->CSR, RCC_CSR_LSECSSON)
CLEAR_BIT(RCC->CSR, RCC_CSR_LSEON) ,
but the LSEON seems to be locked. no effects.
about the interrupt ,
This function handles RTC global interrupt through EXTI lines 17, 19 and 20 and LSE CSS interrupt through EXTI line 19
so i just only enable HAL_NVIC_EnableIRQ(RTC_IRQn);
2020-06-28 02:01 AM
> but the LSEON seems to be locked. no effects.
RTC reset should work (RCC_CSR.RTCRST).
JW
2020-06-28 04:03 AM
hi JW
yeah, RCCRST it 's work to clear the flag.
about the interrupt , i try to
CLEAR_BIT(RCC->CIFR,RCC_CIFR_CSSLSEF),
SET_BIT(RCC->CIER, RCC_CICR_LSECSSC);
enable the interrupt RCC_EXTI_LINE_LSECSS(EXTI_IMR_IM19)
and HAL_NVIC_EnableIRQ(RTC_IRQn)
then the interrupt could't trigger when LSE error
2020-06-28 07:16 PM
hi, JW
i 've triggered the LSE CSS interrupt.but the error trigger not very effective .
thank you for your help:smiling_face_with_smiling_eyes: