Hardware Reference
In-Depth Information
The DS1338 RTC
The RTC you will use will be a little different from the old MC146818. It's made by Maxim and is called DS1338Z-33
and has fewer pins (only 8, as opposed to 24 on the MC146818). It's also a lot smaller and is no longer a DIP package.
What you're looking at is called the SO-8 or SOIC-8. SOIC, or SO for short, is small outline integrated circuit and the 8
simply means how many pads the package comes with. You may notice I said pads and not pins; that's because an SO
package is designed to be surface mounted to the PCB. The surface mount components are also quite small and fairly
easy to lose if you drop them on the floor.
I will show you how to work with the SO-8 package a little later on. If you have not read the data sheet by now
your first question would be how can only eight pads drive all the registers that are needed? Well, I suggest you read
the data sheet first.
The DS1338Z-33 is actually an I2C device. All access to the date and time registers will be done with the I2C
protocol. If you recall, you used the I2C bus in Chapter 4 and as such I won't be going over how it works. It's now time
to show you what each of the pads are used for on this little device. See Table 8-1 for the pad out descriptions, but as
always refer back to your data sheet.
Table 8-1. The pads on the DS1338Z-33
Pad Number
Name
Function
1
X1
External oscillating crystal connection
2
X2
External oscillating crystal connection
3
Vbat
Battery backup power source
4
GND
Ground
5
SDA
I2C SDA line
6
SDL
I2C SDL line
7
SQW/OUT
Square wave output, if enabled
8
Vcc
Primary voltage source
There are some good reasons for why the DS1338Z-33 is a good fit for the Raspberry Pi:
It's a 3.3-V logic device.
It's supported by the Linux kernel.
The downside of the DS1338Z-33 is that it's an SO-8 package with the problems I mentioned above (surface
mounting and small size). I will use a small bridge board to allow you to easily plug in the RTC into your breadboards
or into jumper cables to get around the surface-mount difficulties. The key issues with surface-mount components are
their size. They will be a lot smaller. If you think of the size difference between an SD card and a micro SD card, then
you will start to understand the difference. For you this means the pads will be a lot closer together, meaning it will be
a little harder to solder. Also because it's smaller they heat up quicker, so you need to solder a bit quicker so you don't
damage the chip.
The Crystal
The next important component is the crystal. The most common crystals are made from synthetic quartz. The material
that the crystal is made from plays a big part in how the crystal works; there are other materials that could be used
but quartz is the least sensitive to outside interference. Quartz by nature is a piezoelectric material. A piezoelectric
 
 
Search WWH ::




Custom Search