dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: RE: rtc alarm on H300

RE: rtc alarm on H300

From: RaeNye <>
Date: Mon, 09 Apr 2007 17:35:09 +0300

>I want to resurrect the alarm plugin I started on last year. At that time a
>alarm system was being developed. Looking through the source I've found
alarm wake-up
>capabilities for the PCF50605 (used in the ipod) but not in the PCF50606
(used in the
>H300). As I understand it, these are just about the same chip? So should
copying the
>alarm code from rtc_pcf50605.c to rtc_pcf50606.c work? Are there any risks
in playing
>with this that might brick my player?

PCF50605 and PCF50606 are very similar, so the alarm code should be very
I didn't find the code for it, but the X5 OF does it like this:

1. set bit 7 of PCF50606 register INT1M (0x05) - mask alarm interrupt.
2. write date & time data to PCF50606 registers RTCSCA ... RTCYRA
(0x11-0x17), same format as in setting RTC time.
3. clear bit 7 of PCF50606 register INT1M - unmask interrupt.
4. write 0x70 to PCF50606 register OOCC1 (0x08).
Note that the OF uses PCF50606 interrupts and RB doesn't (IIRC).

Another important aspect to remember regarding X5 RTC wakeup (not relevant
to H300) is that the preloader tests whether the device woke up due to RTC
alarm and passes this information on to the firmware as a boolean flag at
0x30000000 (first DRAM int).

>I also noticed that the RTC read and write datetime functions for the
>50606 change the IRQ level before the operation (and restore afterwards),
but the
>funcs for the 50605 don't. Any ideas why? Would I need to do this for all
>on the 50606?

The X5 OF implements PCF50606 write w/o any IRQ level changes, just a I2C

>Where is an alarm handled if the player is already switched on when it
As I said, the PCF50606 triggers an interrupt line and the exact cause can
be read from its status reg.

>Also, the set/get alarm functions only set the hour and minute. I was
envisaging a
>more flexible system using an arbitrary datetime.
>Thoughts on changing this?

The chip supports year/month/day as well.
As I see it, there should be a list of arbitrary alarms with recurrences,
Each time, the RTC chip would be programmed to wake up for the nearest one
(so delta-times would be handled by the firmwares).
Received on 2007-04-09

Page was last modified "Jan 10 2012" The Rockbox Crew