This is the quickstart guide for the SAM RTC driver, with step-by-step instructions on how to configure and use the driver in a selection of use cases.
The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.
In this basic use case, the RTC module is using 32kHz external crystal and configured for 24-hour mode. It will read the current date and time.
Add to application C-file:
Enable the External 32K crystal :
Wait for 32K crystal ready:
Set default RTC configuration, 24-hour mode .
Add to, e.g., main loop in application C-file: