How to configure Atmel Start to use RTC with external 32 kHz crystal on SAME54 Xplained Pro?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Hi everyone,

 

I'm trying to configure Atmel Start to use the 32 kHz external crystal as the clock source for the RTC (in calendar mode) on the SAME54 Xplained Pro. I'm using a 1 ms SysTick as the source for a software RTC and reporting the date & time (YY-MM-DD HH:MM:SS) of both once a minute:

 

SW RTC: 00-01-01 00:01:00

HW RTC: 00-01-23 18:08:23



SW RTC: 00-01-01 00:02:00

HW RTC: 00-02-15 12:16:59



SW RTC: 00-01-01 00:03:00

HW RTC: 00-03-09 06:25:39

 

As you can see the RTC peripheral using 32 kHz crystal is running WAY too fast.

 

Here is my project configuration:

 

And here is my clock configuration:

 

I have attached the Atmel Start project (sam_e54_rtc_test_atstart.zip) and Atmel Studio solution with source code (sam_e54_rtc_test_project.zip) for reference.

 

Any hints / tips would be much appreciated!

 

Thanks in advance,

Pieter

https://piconomix.com

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The selected clock source and RTC prescaler must be configured to provide a 1Hz clock to the counter for correct operation in this mode.

if this really is the calendar mode (mode 2) in the RTC.

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually, from looking at a SAMC21 example project, this driver will not be using mode 2 in the RTC but it still requires 1Hz so configure that using the prescaler.

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Hi @Lajon,

 

Thanks for your kind help! It worked :)

 

For the rest reading this thread, here is the solution in pictures...

 

Clock configuration overview:

 

 

Tick "Enable 1kHz Output Enable"

 

 

Tick "Use 1 kHz output":

 

Use RTC source:

 

Set Prescaler configuration to "Peripheral clock divided by 1024":

 

Regards,

Pieter

https://piconomix.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there really no way to describe what you've done in s Start project other than posting pictures of the GUI?

(maybe something that pares the .atstart "saved configuration" down to only the things that have been changed from the defaults?)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi @westfw,

 

You sir are a legend :)

 

I'm not completely sure what you mean and want to check first. Do you want me to document the Atmel Start steps to enable XOSCK32K, create an RTC Source, add the CALENDAR component and configure it all correctly as an RTC that tracks date & time?

 

I did point out the important changes that I had to make compared to my original Atmel Start project. Attached is the updated Atmel Start project that works.

 

The most important info is that the 32 kHz clock must be divided down to 1 kHz and then the prescaler must divide it by 1024 so that the CALENDAR module is fed with a 1 Hz clock.

 

Kind regards,

Pieter

https://piconomix.com

Attachment(s):