# SAM3N RTC

## Real-time Clock (RTC) User Interface

### Registers

Register Mapping
Address | Register | Name | Access | Reset
--- | --- | --- | --- | ---
0x400E1460 | Control Register | RTC_CR | read-write | 0x00000000
0x400E1464 | Mode Register | RTC_MR | read-write | 0x00000000
0x400E1468 | Time Register | RTC_TIMR | read-write | 0x00000000
0x400E146C | Calendar Register | RTC_CALR | read-write | 0x01210720
0x400E1470 | Time Alarm Register | RTC_TIMALR | read-write | 0x00000000
0x400E1474 | Calendar Alarm Register | RTC_CALALR | read-write | 0x01010000
0x400E1478 | Status Register | RTC_SR | read-only | 0x00000000
0x400E147C | Status Clear Command Register | RTC_SCCR | write-only | -
0x400E1480 | Interrupt Enable Register | RTC_IER | write-only | -
0x400E1484 | Interrupt Disable Register | RTC_IDR | write-only | -
0x400E1488 | Interrupt Mask Register | RTC_IMR | read-only | 0x00000000
0x400E148C | Valid Entry Register | RTC_VER | read-only | 0x00000000
0x400E1544 | Write Protect Mode Register | RTC_WPMR | read-write | 0x00000000

### Register Fields

#### RTC Control Register

Name: RTC_CR

Access: read-write

Address: 0x400E1460

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | CALEVSEL
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | TIMEVSEL
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | UPDCAL | UPDTIM

- UPDTIM: Update Request Time Register

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Stops the RTC time counting.

- UPDCAL: Update Request Calendar Register

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Stops the RTC calendar counting.

- TIMEVSEL: Time Event Selection

  Value | Name | Description
  --- | --- | ---
  0x0 | MINUTE | Minute change
  0x1 | HOUR | Hour change
  0x2 | MIDNIGHT | Every day at midnight
  0x3 | NOON | Every day at noon

- CALEVSEL: Calendar Event Selection

  Value | Name | Description
  --- | --- | ---
  0x0 | WEEK | Week change (every Monday at time 00:00:00)
  0x1 | MONTH | Month change (every 01 of each month at time 00:00:00)
  0x2 | YEAR | Year change (every January 1 at time 00:00:00)

#### RTC Mode Register

Name: RTC_MR

Access: read-write

Address: 0x400E1464

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | HRMOD

- HRMOD: 12-/24-hour Mode

  Value | Name | Description
  --- | --- | ---
  0 | - | 24-hour mode is selected.
  1 | - | 12-hour mode is selected.

#### RTC Time Register

Name: RTC_TIMR

Access: read-write

Address: 0x400E1468

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | AMPM | HOUR
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | MIN
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | SEC

- SEC: Current Second

-

- MIN: Current Minute

-

- HOUR: Current Hour

-

- AMPM: Ante Meridiem Post Meridiem Indicator

  Value | Name | Description
  --- | --- | ---
  0 | - | AM.
  1 | - | PM.

#### RTC Calendar Register

Name: RTC_CALR

Access: read-write

Address: 0x400E146C

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | DATE
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
DAY | MONTH
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
YEAR
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | CENT

- CENT: Current Century

-

- YEAR: Current Year

-

- MONTH: Current Month

-

- DAY: Current Day in Current Week

-

- DATE: Current Day in Current Month

-

#### RTC Time Alarm Register

Name: RTC_TIMALR

Access: read-write

Address: 0x400E1470

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
HOUREN | AMPM | HOUR
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
MINEN | MIN
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
SECEN | SEC

- SEC: Second Alarm

-

- SECEN: Second Alarm Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | The second-matching alarm is disabled.
  1 | - | The second-matching alarm is enabled.

- MIN: Minute Alarm

-

- MINEN: Minute Alarm Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | The minute-matching alarm is disabled.
  1 | - | The minute-matching alarm is enabled.

- HOUR: Hour Alarm

-

- AMPM: AM/PM Indicator

-

- HOUREN: Hour Alarm Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | The hour-matching alarm is disabled.
  1 | - | The hour-matching alarm is enabled.

#### RTC Calendar Alarm Register

Name: RTC_CALALR

Access: read-write

Address: 0x400E1474

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
DATEEN | - | DATE
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
MTHEN | - | - | MONTH
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | -

- MONTH: Month Alarm

-

- MTHEN: Month Alarm Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | The month-matching alarm is disabled.
  1 | - | The month-matching alarm is enabled.

- DATE: Date Alarm

-

- DATEEN: Date Alarm Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | The date-matching alarm is disabled.
  1 | - | The date-matching alarm is enabled.

#### RTC Status Register

Name: RTC_SR

Access: read-only

Address: 0x400E1478

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | CALEV | TIMEV | SEC | ALARM | ACKUPD

- ACKUPD: Acknowledge for Update

  Value | Name | Description
  --- | --- | ---
  0 | - | Time and calendar registers cannot be updated.
  1 | - | Time and calendar registers can be updated.

- ALARM: Alarm Flag

  Value | Name | Description
  --- | --- | ---
  0 | - | No alarm matching condition occurred.
  1 | - | An alarm matching condition has occurred.

- SEC: Second Event

  Value | Name | Description
  --- | --- | ---
  0 | - | No second event has occurred since the last clear.
  1 | - | At least one second event has occurred since the last clear.

- TIMEV: Time Event

  Value | Name | Description
  --- | --- | ---
  0 | - | No time event has occurred since the last clear.
  1 | - | At least one time event has occurred since the last clear.

- CALEV: Calendar Event

  Value | Name | Description
  --- | --- | ---
  0 | - | No calendar event has occurred since the last clear.
  1 | - | At least one calendar event has occurred since the last clear.

#### RTC Status Clear Command Register

Name: RTC_SCCR

Access: write-only

Address: 0x400E147C

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | CALCLR | TIMCLR | SECCLR | ALRCLR | ACKCLR

- ACKCLR: Acknowledge Clear

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Clears corresponding status flag in the Status Register (RTC_SR).

- ALRCLR: Alarm Clear

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Clears corresponding status flag in the Status Register (RTC_SR).

- SECCLR: Second Clear

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Clears corresponding status flag in the Status Register (RTC_SR).

- TIMCLR: Time Clear

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Clears corresponding status flag in the Status Register (RTC_SR).

- CALCLR: Calendar Clear

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | Clears corresponding status flag in the Status Register (RTC_SR).

#### RTC Interrupt Enable Register

Name: RTC_IER

Access: write-only

Address: 0x400E1480

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | CALEN | TIMEN | SECEN | ALREN | ACKEN

- ACKEN: Acknowledge Update Interrupt Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The acknowledge for update interrupt is enabled.

- ALREN: Alarm Interrupt Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The alarm interrupt is enabled.

- SECEN: Second Event Interrupt Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The second periodic interrupt is enabled.

- TIMEN: Time Event Interrupt Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The selected time event interrupt is enabled.

- CALEN: Calendar Event Interrupt Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.

#### RTC Interrupt Disable Register

Name: RTC_IDR

Access: write-only

Address: 0x400E1484

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | CALDIS | TIMDIS | SECDIS | ALRDIS | ACKDIS

- ACKDIS: Acknowledge Update Interrupt Disable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The acknowledge for update interrupt is disabled.

- ALRDIS: Alarm Interrupt Disable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The alarm interrupt is disabled.

- SECDIS: Second Event Interrupt Disable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The second periodic interrupt is disabled.

- TIMDIS: Time Event Interrupt Disable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The selected time event interrupt is disabled.

- CALDIS: Calendar Event Interrupt Disable

  Value | Name | Description
  --- | --- | ---
  0 | - | No effect.
  1 | - | The selected calendar event interrupt is disabled.

#### RTC Interrupt Mask Register

Name: RTC_IMR

Access: read-only

Address: 0x400E1488

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | CAL | TIM | SEC | ALR | ACK

- ACK: Acknowledge Update Interrupt Mask

  Value | Name | Description
  --- | --- | ---
  0 | - | The acknowledge for update interrupt is disabled.
  1 | - | The acknowledge for update interrupt is enabled.

- ALR: Alarm Interrupt Mask

  Value | Name | Description
  --- | --- | ---
  0 | - | The alarm interrupt is disabled.
  1 | - | The alarm interrupt is enabled.

- SEC: Second Event Interrupt Mask

  Value | Name | Description
  --- | --- | ---
  0 | - | The second periodic interrupt is disabled.
  1 | - | The second periodic interrupt is enabled.

- TIM: Time Event Interrupt Mask

  Value | Name | Description
  --- | --- | ---
  0 | - | The selected time event interrupt is disabled.
  1 | - | The selected time event interrupt is enabled.

- CAL: Calendar Event Interrupt Mask

  Value | Name | Description
  --- | --- | ---
  0 | - | The selected calendar event interrupt is disabled.
  1 | - | The selected calendar event interrupt is enabled.

#### RTC Valid Entry Register

Name: RTC_VER

Access: read-only

Address: 0x400E148C

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
- | - | - | - | - | - | - | -
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
- | - | - | - | - | - | - | -
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
- | - | - | - | - | - | - | -
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | NVCALALR | NVTIMALR | NVCAL | NVTIM

- NVTIM: Non-valid Time

  Value | Name | Description
  --- | --- | ---
  0 | - | No invalid data has been detected in RTC_TIMR (Time Register).
  1 | - | RTC_TIMR has contained invalid data since it was last programmed.

- NVCAL: Non-valid Calendar

  Value | Name | Description
  --- | --- | ---
  0 | - | No invalid data has been detected in RTC_CALR (Calendar Register).
  1 | - | RTC_CALR has contained invalid data since it was last programmed.

- NVTIMALR: Non-valid Time Alarm

  Value | Name | Description
  --- | --- | ---
  0 | - | No invalid data has been detected in RTC_TIMALR (Time Alarm Register).
  1 | - | RTC_TIMALR has contained invalid data since it was last programmed.

- NVCALALR: Non-valid Calendar Alarm

  Value | Name | Description
  --- | --- | ---
  0 | - | No invalid data has been detected in RTC_CALALR (Calendar Alarm Register).
  1 | - | RTC_CALALR has contained invalid data since it was last programmed.

#### RTC Write Protect Mode Register

Name: RTC_WPMR

Access: read-write

Address: 0x400E1544

31 | 30 | 29 | 28 | 27 | 26 | 25 | 24
WPKEY
23 | 22 | 21 | 20 | 19 | 18 | 17 | 16
WPKEY
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8
WPKEY
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
- | - | - | - | - | - | - | WPEN

- WPEN: Write Protect Enable

  Value | Name | Description
  --- | --- | ---
  0 | - | Disables the Write Protect if WPKEY corresponds to 0x525443 ("RTC" in ASCII).
  1 | - | Enables the Write Protect if WPKEY corresponds to 0x525443 ("RTC" in ASCII).

- WPKEY

-