Hi Jemmie
It is not possible to adapt the firmware to the LPC55S16-EVK board because it has pins 49 50 and 51 connected together contrary to my hw which has pin 51 connected to the battery while 49 and 50 are connected to the main power supply... the behavior is different and the absorptions are also different.
now I will describe to you step by step what happens to me here.
1) I feed the card with the two power supplies, Vmain and Vbatt.
2) the microcontroller executes the code, all lienes
static void RTC_init(void) //line 1
{
/* RTC initialization */
CLOCK_EnableClock(kCLOCK_Rtc); //line 2
if(RTC_PERIPHERAL->CTRL & RTC_CTRL_SWRESET_MASK) //line 3
{
if(!RTC_GetSecondsTimerCount(RTC_PERIPHERAL)) //line 4
{
RTC_Init(RTC_PERIPHERAL); //line 5
/* Stop RTC timer */
RTC_StopTimer(RTC_PERIPHERAL); //line 6
/* Date and time initialization */
RTC_SetDatetime(RTC_PERIPHERAL, &RTC_dateTimeStruct); //line 7
/* Start RTC timer */
RTC_StartTimer(RTC_PERIPHERAL); //line 8
}
}
}
after this function the clock of the microcontroller is set at 9:00 on May 5, 2022 because this is the time at which I have preset RTC_dateTimeStruct, in my firmware:
rtc_datetime_t RTC_dateTimeStruct = {
.year = 2022U,
.month = 5U,
.day = 5U,
.hour = 9U,
.minute = 0U,
.second = 0U
};
3) through messages implemented on a uart I can set and read the time of the RTC timer
4) I do it, now the microcontroller clock is set at 15:00 on May 16, 2022: everything is working.
5) I turn off the main power and leave only Vbatt
6) I wait 5 -10 seconds
7) I reconnect the main power supply and the microcontroller performs a reset (I would like the RTC not to reset too: Vbatt should keep it working)
at start the microcontroller executes the RTC_init (void) function that I have reported above.
9) I expect that on line 3 or at most on line 4 the microcontroller jumps at the end of the function without executing lines 5..8
10) I interrogate the microcontroller on the uart and read the time of its RTC. He answers me: 9:00 on May 5, 2022. evidently the RTC has reset itself :-(((
I don't know if I have explained myself better now,
thanks for your attention