Wiki > Main > RTCModH1x0 (compare)
Difference: RTCModH1x0 (r35 vs. r34)
The lack of a real time clock on my h140 always bothered me (and many other rockbox users), so I was looking for way to add this functionality with a minimum of effort (and little chance of breaking the player in the process). Checking out the other rockbox targets, the RTC is usually connected via the I2C? bus and the software architecture would allow to easily enable the RTC functionality by adding an appropriate low level driver and setting a define. I2C? allows the connection of additional devices, so it would be possible to re-use an existing hardware interface.
There are a large number of RTC chips out there which makes it hard to pick one. I chose the DS1339c for the following reasons:
The data sheet can be found here: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3470 and they even offer free samples. Make sure you get the 3.3V version with integrated crystal. (DS1339C?-33)
The first prototype with the DS1339 had a number of issues which were overcome by using a different chip, the DS3221 by the same company. It is a more advanced chip with higher precision and additional features (which are currently not used by the driver). It is not pin-compatible, but software compatible as far as the common features are concerned. jimdearras pioneered a version of the MOD with the new chip which is now the recommended one.
The data sheet can be found here: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4627 and free samples are also available.
The standardised i2c bus and the integration of the crystal makes for a relatively easy connection. The chip can be piggybacked onto the eeprom chip.
Many tutorials on how to open the h1x0 exist already, so I don't need to repeat them.
There is a convenient free space near the eeprom. The following image contains the location of the RTC chip in the PCB and the points to connect the RTC's pins to. Instead of wiring the GND to the eeprom chip, I used the pinhole from the rs232 connector as it is easier (and less risky) to solder.
The backup voltage I took directly from the connector on the other side of the motherboard.
Initially I planned to glue the RTC chip onto the board (pins up) and run the wires from there, but my super glue had gone off and so I soldered the wires onto the loose chip. This is not so good, as the wires will put quite a strain onto the pins and in fact I broke one off at the first attempt. I used stranded wire with maybe 6 very thin strands (ripped from an old mouse cable). But still the wire really needs to be kept in a fixed position without any tension once attached. I made little 90 degree bends, and placed the wire on the chip (legs up) with the wire tip pointing outwards above the pin. While pressing the wire onto the chip and holding it in position with one hand I use the other to dip the prepared soldering iron onto the wire tip to make the bond. Once I had connected all the wires, I packed the chip up with tape for insulation and strain relief.
There are two additional wires in the picture. One for the alarm interrupt (used for the Alarm mod - see below) and one from the n/c pins of the RTC which are meant to be connected to GND (doesn't seem to be essential).
This handy package was then connected up as described above and I added some more tape to hold the wires in place.
The DS1339c has a SQW/INT pin that can be programmed to go low when the Alarm time is reached and even works with only backup power supplied (standby mode). This needs to be connected to the power-on logic (essentially in parallel to the "on" button). The problem is that the low-active output pin can only drive 3mA which may not be enough. I have measured a current of 2mA (with a crappy multimeter) when short-circuiting the button and decided to risk it. The best spot to attach the wire is the little test pad which is conveniently labelled "PLAY".
One could use a resistor (not a diode) in series to reduce the voltage on the IC or use an alternative powersource (a capacitor or a rechargeable battery); the RTC chip can even trickle charge them
I am inclined to believe that this is an error/omission in the data sheet, as other similar RTC chips by the same company (such as the DS1340 - an alternative if you don't need the alarm) have an extra clause: "VBACKUP can be as high as 5.5V on the 3.3V device.". It makes more sense to me that VCC and VBACKUP have the same limits. Both of my modded players are working fine with a direct connection.
Rockbox will initialise the chip such that the square wave is disabled, so it needs to run at least once, before the original iriver firmware can be used. This does not need to be repeated unless VBACKUP power is lost.
(transcription from jimdearras' forum post)
Here's the wiring (DS3231 shown upside down, as installed):
Here's the VBat connection point, from a recommendation:
This point is not directly connected to the battery, there is a RC curcuit in the path of unknown value, that causes this point to rise to vBat (no diode drops) over a few seconds after initial battery connection.
Here's the play pad, for the Alarm part of the mod:
I prepared the chip for mounting upside down with superglue by flatening and shortening the leads as below:
(Now that I am writing this, I realize there is no good reason to mount the chip upside down, after bending the leads flat like this! Hindsight is 20/20! )
Here's where I super glued the chip:
The drivers for the RTC (including alarm mod) are in SVN, but not enabled by default. There was talk that a separate build should be created, but bagder is not here to do it. Until this happens you will need to compile rockbox yourself. Select (A)dvanced build and then (R)tc functions as follows:
$ ../tools/configure Enter target platform: ==Archos== ==iriver== ==Apple iPod== 0) Player/Studio 10) H120/H140 20) Color/Photo 1) Recorder 11) H320/H340 21) Nano 2) FM Recorder 12) iHP-100/110/115 22) Video 3) Recorder v2 13) iFP-790 23) 3G 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G 6) AV300 26) Mini 2G 27) 1G, 2G ==iAudio== ==Toshiba== ==SanDisk== 30) X5/X5V/X5L 40) Gigabeat F 50) Sansa e200 31) M5/M5L 41) Gigabeat S 51) Sansa e200R 32) 7 52) Sansa c200 33) Cowon D2 ==Tatung== ==Olympus== ==Logik== 60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB 71) M:Robe 100 ==Creative== 90) Zen Vision:M 10 Platform set to h120 Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, (M)anual, (V)oice? (N) a Advanced build selected Enter your developer options (press enter when done) (D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (R)TC MOD r RTC functions enabled (DS1339/DS3231) done Using source code root directory: /home/robert/rockbox Using m68k-elf-gcc 3.4.5 (304) Found and uses ccache (/usr/bin/ccache) Created Makefile
Here is a list of people who I know have done the mod. The table also includes the number of units modded and what RTC chip was used. It has comments by the modders that might be useful for others.
r36 - 05 Feb 2011 - 07:32:49 - JayJechRevision r35 - 03 Mar 2008 - 03:31 - RobertMenes
Revision r34 - 03 Mar 2008 - 03:06 - DavideGentile
Copyright © by the contributing authors.