rtc resets at powerup

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rtc resets at powerup

Jump to solution
645 Views
randenewberry
Contributor IV

Our project has an MK22FX512VLH12. Trying to use the RTC. Every time the device is powered up the clock starts and runs from the time configured in the processor expert property panel.

How can we get it to not reset to this specific time upon power up?

0 Kudos
Reply
1 Solution
474 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

I suppose you are using RTC_LDD component. This component provide selection of initialization mode. There is Initialization//Autoinitialization/Auti init. mode property that must be set to Soft init. This settings provides initialization that does not set date and time into RTC registers, see the screenshot below:

RTC_LDD_soft_init.png

If you don't use the autoinitialization and you are calling the RTC1_Init in your application code you must use the same value of the SoftInit parameter (TRUE). Otherwise all date and time registers are set to values that are defined in the component properties.

See also the description of the Init method:

Initializes the device. There are two modes of initialization.

1) RTC device is NOT battery backed up. (SoftInit = FALSE)

All registers (interrupts, counters, clock routing …) that influence RTC behavior are initialized.

Note: This initialization mode doesn't preserve time and date settings.

2) RTC device IS battery backed up.

(SoftInit = TRUE). Only registers that are not backed up are initialized (Interrupt priority …). RTC device is running, time and date a preserved, RTC interrupts (events) are preserved too.

Allocates memory for the device data structure.

This method can be called only once. Before the second call of Init() the Deinit() must be called first.

LDD_TDeviceData * RTC1_Init(LDD_TUserData *UserDataPtr, bool SoftInit);

-Return value: Pointer to the dynamically allocated private structure or NULL if there was an error.

-1. parameter: Pointer to the user or RTOS specific data. This pointer will be passed as an event or callback parameter.

-2. parameter: If set to "true" only registers that are not battery backup are initialized (E.g. Interrupt priority in interrupt controller … )

If set to "false" all registers are initialized.

Please note, that in case of the SoftInit=TRUE you must have a RTC battery backup on your target board.

Best Regards,

Marek Neuzil

View solution in original post

0 Kudos
Reply
1 Reply
475 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

I suppose you are using RTC_LDD component. This component provide selection of initialization mode. There is Initialization//Autoinitialization/Auti init. mode property that must be set to Soft init. This settings provides initialization that does not set date and time into RTC registers, see the screenshot below:

RTC_LDD_soft_init.png

If you don't use the autoinitialization and you are calling the RTC1_Init in your application code you must use the same value of the SoftInit parameter (TRUE). Otherwise all date and time registers are set to values that are defined in the component properties.

See also the description of the Init method:

Initializes the device. There are two modes of initialization.

1) RTC device is NOT battery backed up. (SoftInit = FALSE)

All registers (interrupts, counters, clock routing …) that influence RTC behavior are initialized.

Note: This initialization mode doesn't preserve time and date settings.

2) RTC device IS battery backed up.

(SoftInit = TRUE). Only registers that are not backed up are initialized (Interrupt priority …). RTC device is running, time and date a preserved, RTC interrupts (events) are preserved too.

Allocates memory for the device data structure.

This method can be called only once. Before the second call of Init() the Deinit() must be called first.

LDD_TDeviceData * RTC1_Init(LDD_TUserData *UserDataPtr, bool SoftInit);

-Return value: Pointer to the dynamically allocated private structure or NULL if there was an error.

-1. parameter: Pointer to the user or RTOS specific data. This pointer will be passed as an event or callback parameter.

-2. parameter: If set to "true" only registers that are not battery backup are initialized (E.g. Interrupt priority in interrupt controller … )

If set to "false" all registers are initialized.

Please note, that in case of the SoftInit=TRUE you must have a RTC battery backup on your target board.

Best Regards,

Marek Neuzil

0 Kudos
Reply