release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > Main > RTCModH1x0

RTC Mod for H1x0 series

Introduction

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:

  • integrated crystal (no additional components required)
  • reasonable size (big enough to handle, small enough to fit)
  • built in alarm function
  • backup Voltage pin so it will work while DAP is turned off
  • reading and setting mechanism similar to other RTCs that rockbox supports
  • availability

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.

Original Version (DS1339c)

Required connections

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.

connections.png

Assembly (fitting and soldering connections for the 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.

location.png

The backup voltage I took directly from the connector on the other side of the motherboard.

vbackup.png

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.

soldered_packaged.png

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.

all_in_place.jpg

ALARM mod

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".

sqw-int.png

Some issues and potential solutions

  • Vbackup is specified with a max of 3.7V in the DS1339 data sheet - the iriver battery can be over 4.2V when fully charged

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.

  • SQW/INT by default (power on or not explicitly programmed not to) will supply a square wave which will result in constant 'on' signals with the alarm mod

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.

RTC in action

  • set time:
    set_time.jpg

  • clock plugin:
    clock_plugin.jpg

Recommended Version (DS3231)

(transcription from jimdearras' forum post)

Required connections

Here's the wiring (DS3231 shown upside down, as installed):

ClockConnections.png

Assembly (fitting and soldering connections for the chip)

Here's the VBat connection point, from a recommendation:

Bat.png

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 Ground:

GND.png

Here's the play pad, for the Alarm part of the mod:

Play.png

I prepared the chip for mounting upside down with superglue by flatening and shortening the leads as below:

ClockChip.png

(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:

Place.png

Chip installed:

ClockPlace.png

Final product

ClockWires.png

Software

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

User Experiences

The table below contains a list of people who have completed this mod, including the number of units modded and which RTC chip was used. Comments are left by the modders which may be useful to others.

# who DS1339c DS3231 comment
01 roolku 2 -  
02 Peter200lx 1 1  
03 IpaqMan 1 - The bottom right of the mainboard (oriented with the headphone jack on top) has two square solder coated objects. The rightmost of the two has a 4.1 volt reading, so I decided to use that solder point.
04 jimdearras 1 4  
05 Software_Samurai - 1 Use 30 gauge wire! Anything bigger and it will put too much stress on the little pins on the chip when you're trying to bend the wires around.
06 TaperChuck - 1  
07 Bedlore - 1 go very easy with your solder and try not to use too much
08 pilot000 - 1  
09 DavideGentile (Davide-NYC) - 2  
10 x1jmp 1 - forgot to take the remote with me. It ended up in switching the hold switch off, pressing a button and switching it on again very fast hoping there's no signal from the RTC chip. After some minutes I finally managed to get into settings menu for setting an alarm.
11 luminol - 1  
12 syrou - 1 use AWG30 wrapping wire to solder connections between chip and motherboard
13 crypt@ - 1 24AWG wires are still unmanagable on these weak SOIC legs.
14 bpfiguer - 1  
15 bluebrother - 1 I used solderable wire (Order-No. 146184 at farnell.com) which made handling quite easy. No nicely placed wires though.
16 Heriver - 1 I have mounted the first RTC-chip (still more to go..) topside-up. I've bend a bit the pin's up so they are free from the PCB, but they are not flat! At the location i used insulation tape and glued the chip on. I've used Wire-Wrapping wire and pre-solder it first then soldered at the desired pin locations.
17 KevinFerrare - 1 Fixed the chip to the board with a double sided tape, and wrapped it into a tape to avoid stress on the pin's solders while bending the wires. If you plan to remove the battery from the board before proceeding, be very careful : the connector is crappy and fragile ; the best way to disconnect it is to introduce a screwdriver in the side split between the 2 parts of the connector, don't try to remove it from the top or it'll broke ... Here are some pictures i took during the operation : http://nekowanyanyanya.free.fr/blog/index.php?gallery/General/rtc-sur-le-iriver/
18 JayJech - 1 30 AWG wire; cut each wire to size and soldered to its pin first (away from the board.) Mounted chip right-side up on a piece of Kapton tape; once the wires are soldered to their connection points on the board the chip is very stable. Followed this thread very closely, quite helpful (especially the image.)

r37 - 02 Apr 2021 - 20:46:07 - UnknownUser

Copyright © by the contributing authors.