2024-10-28 12:24 AM - last edited on 2024-10-28 02:27 AM by Amel NASRI
Hi All
I am using STM32L053 board for a product development.
I am using RS485 communication Protocol. I am sending Data from Computer to the processor to get the response.
When I send the data, I get proper response. but out of 10 times say 1 time the processor Resets with the error number 19, that is POR(25)
This is reset due to CLASS B VAR FAIL.
CLASS B VAR error comes as a result of
Clock Status STL_Main Clock Test(void) function which is written in the file STm32fxx_STLclockRun.c file.
this function has one condition,
if (((PeriodValue ^ PeriodValueInv) == 0xFFFFFFFFuL)\
&& ((LSIPeriodFlag ^ LSIPeriodFlagInv) == 0xFFFFFFFFuL)\
&& (LSIPeriodFlag != 0u) )
in this condition, actually LSIPeriodFlag = 0 and also (LSIPeriodFlag ^ LSIPeriodFlagInv) are not exactly inverse of each other as LSIPeriodFlag = 0x00000000; LSIPeriodFlagInv = 0x55555555;
How to solve the problem?
Thanks in Advance
Regards
Ashwini
2024-11-15 05:35 AM
Hi @AshwiniKool ,
As you are using LSI as clock source, it is possible that you are facing similar issue as the one in STM32F4 MCU ST SelfTest Error(STL_MainClockTest).
Please refer to the answer from @Petr Sladecek there.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-12-03 05:15 AM
Hello,
if you inspect all available source files (stm32fxx_STLclockrun.c, stm32fxx_STLmain.c), you can find that during the library initialization and once the result of the clock measurement is checked, SW invalidates class B pair variable value by purpose via putting LSIPeriodFlag into zero. To repeat the clock test, SW then must wait next 8x LSI cycles at least to check result of a next clock cross check measurement cycle. Consistency of the flag (the variable pair) is renewed at TIM21_IRQHandler (stm32l0xx_it.c) raised by end of the measurement cycle when both its elements are set properly to signalize a new measurement result is ready to be checked:
/* Set Flag tested at main loop */
LSIPeriodFlag = 0xAAAAAAAAu;
LSIPeriodFlagInv = 0x55555555u;
Rgds,
Petr