A look inside the DS3231 real-time clock

Dallas Semiconductor, now owned by Maxim Integrated, is well known for making some excellent real-time clocks (RTCs). Take, for example, the DS1307: it’s simple, works with essentially any cheap 32,768 Hz watch crystal, is easily accessible over I2C, and is extremely power efficient (500nA current when running the oscillator on battery power).

As great as it is, the DS1307 has a major drawback: it relies on an external crystal and lacks any sort of temperature compensation. Thus, any change in temperature will cause the clock to drift. A 20ppm error in the frequency of the crystal adds up to about a minute of error per month. Not so great.

Fortunately, Maxim also offers the DS3231, which is advertised as an “Extremely Accurate I2C-Integrated RTC/TCXO/Crystal”. This chip has the 32kHz crystal integrated into the package itself and uses a built-in temperature sensor to periodically measure the temperature of the crystal and, by switching different internal capacitors in and out of the crystal circuit, can precisely adjust its frequency so it remains constant. It’s specified to keep time within 2ppm from 0°C to +40°C, and 3.5ppm from -40°C to +85°C, which means the clock would only drift 63 and 110 seconds per year, respectively. Very cool.

The one (very minor) downside is that it draws about twice the current, a bit less than 1 μA, than the DS1307. Still, a common 220mAh CR2032 battery could power the chip for at least a decade with no problem. Such a circuit would be mostly limited by the CR2032’s self-discharge rate anyway.

In my case, I wanted to use such RTCs on several of my Raspberry Pis that are not regularly (read: almost never) connected to the internet, and so cannot always get their time from NTP servers.

Some clever person designed a very simple board that fits on the Raspberry Pi’s pin headers for power, ground, and I2C and has the DS3231 chip, pull-up resistors for the I2C bus, and a decoupling capacitor. It even has pads for a backup battery (not included, but adding a battery holder and coin cell is straightforward). Chinese vendors on eBay sell the board for about $1.50, with free shipping. Perfect.

Here’s the board I’m using on one of my Pis, along with the backup battery and holder I added.

The RTC module installed on one of my Raspberry Pis.
The RTC module installed on one of my Raspberry Pis.

Considering that the DS3231 is not a cheap chip, costing ~$3.80 USD per chip in minimum quantities of 1000 from Digi-Key, it’s a bit surprising that complete board only costs $1.50 per board. Like Edward Mallon, I wondered if these were counterfeit chips that were pin and function compatible, QC rejects, or somehow otherwise illegitimate chips.

For science, I ordered a few extra boards and tested them over the last year, where “tested” means “set the time on the chips with a Pi that was NTP synchronized to a GPS timing receiver, disconnected them from the Pi, and left them on the shelf running on battery power for a year”. The chips would be in direct sunlight in the mornings, and the temperature in the room would range between about 15°C and 30°C throughout the year. Not extreme, but not precisely regulated either. I did not adjust the “aging register” in the chip to trim the oscillator before this test, and the register was set to its default value of “0”. After a year, the chip with the largest drift was only 16 seconds off, which is about 0.5 ppm. That’s well within spec, so I’m happy. If these chips were counterfeit, they were at least good counterfeits that worked as advertised.

However, I wanted to look closer so I sacrificed one of the chips for science. Thanks to my friend Jesse for reminding me that I can just snip off the legs of the chip rather than trying to de-solder it. That made things a lot easier.

Here’s the top of the package. It claims to be an SN model, which means it is specced for the full -40°C to +85°C temperature range. The date code says it was made in week 33 of 2011, as part of lot 917AC. The # mark means it’s RoHS compliant.

The laser markings seemed a bit dodgy and not like the normal high-quality laser markings I see on other Maxim chips. I contacted Maxim, explained the situation, and sent photos of the package and die (see below). After checking their records, they say the style of the markings, the date code, and lot number are all consistent with that particular lot made in 2011, which strongly suggests the chips are legitimate. They also reminded me that they do not warrant or guarantee any products purchased from unauthorized resellers. Good to know, and not unexpected.

The exterior of the chip's package. It has the markings "DS3231SN" on the first line, "1133A4" on the second, "917AC" on the third, and a "#" sign on the fourth.
The exterior of the chip’s package.

I zoomed in with my USB microscope to examine the markings in more detail. It’s a bit hard to see in this close-up, but you should be able to see the digits “31”. Compare these markings to those on the Maxim MAX3232 chip I investigated earlier and you can see why I was a bit skeptical as to their legitimacy at first. Obviously, Maxim must have different types of laser marking equipment on their different production lines.

A close-up of the chip's markings. The digits "31" are barely visible.
A close-up of the chip’s markings.

I normally would digest the epoxy packaging of the chip in acid at work, butI was at home that day and didn’t have access to the chemicals and safety equipment I have in the lab at work, plus I didn’t want to dissolve the integrated crystal and its metal can. Instead, I embrittled the packaging by heating it in the flame of a common Bic lighter for several seconds and then quenching it in a glass of cool water. I repeated this process several times.

Next, I sanded down the back of the ship (assuming that the interesting parts of the die would face upwards, which they were — if they hadn’t been on the top, I’d sacrifice another chip and sand the top down) with fine sandpaper until I hit metal.

It turns out I was a bit too vigorous in my sanding, and accidentally sanded through the crystal’s metal housing and broke one of the forks of the tuning fork oscillating element. Oops.

In the photos below, the notch on the chip is to the left, so pin 1 is to the top left. The main die is behind the large copper pad to the left. The fuzzy “hair” at the bottom are strands of the epoxy package that I didn’t clean up.

The underside of the chip's interior. Several large copper pads are visible, as is the internal 32,768 Hz crystal which has been cross-sectioned due to excessive sanding.
The underside of the chip’s interior.
A close-up of the base of the crystal, showing its connections and the broken fork.
The interior of the hermetically sealed metal can containing the crystal. It has been cross-sectioned by excessive sanding and one of the tines of the crystal tuning fork has been broken. The solder joints connecting the crystal to the exterior of the can are visible, as is some metal shavings from the sanding process.
A detailed look at the tuning fork crystal.
A close-up of the crystal tuning fork. One of the tines has been broken off.
A close-up of the crystal tuning fork.
A close-up of the base of the tuning fork, showing the electrical connections and solder joints.
The base of the tuning fork.

This was interesting, but even after Maxim said the packing and exterior markings looked legitimate, I was curious if the die itself was an actual Dallas/Maxim die or if it was a fake. Using tweezers and a fine, sharp knife I was able to crumble away more of the epoxy package and remove the die. Unfortunately, the bond wires were still embedded in the package and so broke off when I removed the die. I also slightly scratched part of the die and cracked off part of the top-right corner. Clearly, acid digestion is the way to go.

Here’s the first look at the die itself. I had washed it with isopropanol and both the chip and the microscope slide are a bit wet. The die measures ~3.6 x 2.3 mm, and the images below were taken with my USB microscope.

The whole DS3231 die. The die is still wet with isopropanol and bits of the epoxy package are still stuck to the outer edges of the die. Scratches appear on the several parts of the complex circuit laid out on the die.
The DS3231 die.

First, I wanted to check to see if the die was actually made by Maxim or if it was a fake. The die clearly says “DALLAS SEMICONDUCTOR”, as well as “©2004 (M) MAXIM”. Looks legit. That’s refreshing.

The manufacturer's markings on the die. The words "DALLAS SEMICONDUCTOR" are written in all-caps vertically, while the copyright sign, the year 2004, an "M" in a circle (for Maxim?), and the word "MAXIM" is written horizontally off to the side. There are additional markings that appear to say "14A3" and "16A3", but are slightly blurry due to the very small size of the markings and the limitations of the microscope.
The manufacturer’s markings on the die.

Here’s some more photos of the die.

Another photo of the die showing the complex circuitry it contains.
Another photo of the die.
A different region of the chip showing different types of circuitry. The marking "DS3231" is clearly visible in the bottom-center, though there is an unknown marking between the "32" and "32".
The marking “DS32B31” is clearly visible in the bottom-center, though the “B” in the center of the text is hard to make out in this image. It’s unclear what the “B” means.
A different region of the chip, to the left of the "DS3231" marking mentioned earlier. Two bonding pads are visible, one with a bit of the gold bond wire remaining attached, while the other has had the wire removed.
Another region of the chip. Two bonding pads are clearly visible.
A photo showing the whole die. Ten bonding pads are visible, several still with the remains of gold wires still attached. A small area in the upper-right of the die has been snapped off while removing the chip from the packaging, and small pieces of packaging are still stuck to the outer edges of the die. Several distinctly different regions of the chip are visible, clearly with different functions.
An overview of the whole die. Note a small bit broken off in the top-right and some of the packaging still stuck to it.

In addition to my cheap USB microscope at home, I was later able to take the die into the lab at work and use the (very expensive) Zeiss microscope to take more pictures. I was also able to clean it more thoroughly using the ultrasonic cleaner so the images came out considerably better.

Alas, compatibility issues between the camera mounted on the microscope and my computer prevented me from using the camera to get high-quality photos at this time. I’ve ordered an adapter so I can get better photos, but it will be several weeks. At that time I will either update this post or link to a new one. I plan on creating large composite images of the die at various levels of zoom, and with different optical filters. In the interim, here are a few photos I took using my smartphone aimed through the eyepiece of the lab microscope. They are nowhere near as clear or stunning in appearance as they are when viewed directly through the eyepiece or via the on-scope camera.

A close-up of the die's manufacturer markings prior to ultrasonic cleaning. The text "(C) 2004 (M) MAXIM" is visible, as are several large pieces of dust.
A close-up of the die’s manufacturer markings prior to ultrasonic cleaning. Large specks of dust are visible.
A close-up of the DS32B31 marking in the bottom-center of the die. It's unclear what the "B" stands for. Several large pieces of dust are visible.
A close-up of the DS32B31 marking in the bottom-center of the die prior to ultrasonic cleaning. It’s unclear what the “B” stands for.
A picture of the die using reflected differential interference contrast (DIC). The colors appear different (mostly blue and gold) but the contrast between the elements of the chip are greatly enhanced.
A picture of the die using reflected differential interference contrast (DIC) after ultrasonic cleaning. The colors appear different, but the contrast between the elements of the chip are greatly enhanced.

Addendum 2017-07-29: I’ve been able to get the camera on the microscope to cooperate and have gotten several high-quality photos. As the microscope has an extremely short depth of focus, particularly at high magnification, some images have been “focus stacked” by combining several images at different focus depths. Similarly, the large composite images are made from several individual images that may be focused slightly differently from each other. These processes may cause visual artifacts to be present.

In general, images with green and red colored layers use standard reflected microscopy with no filters, while images with blue and gold layers use reflected differential interference contrast (DIC).

A high-quality image of the Maxim logo on the chip.
A high-quality image of the Maxim logo on the chip.
A DIC image showing the "Maxim" brand markings.
A DIC image showing the “Maxim” brand markings.
Several markings (A1, 02A3, 08A1, 14A3, 15A3, 16A3, and 17A3) are made of different material and differ in color.
These look like they’re identifying different layers of material laid on the silicon: each section of text requires a different depth of focus and appears to be made of different material.
A DIC image showing markings (A1, 02A3, 08A1, 14A3, 15A3, 16A3, and 17A3) are made of different material and differ in color.
The same image as before, this time imaged using DIC.
The edge of the chip with many human-readable markings (e.g. Dallas Semiconductor, Maxim, etc.).
Most of the human-readable markings on the chip are found here, as are a bunch of scratches the die suffered when I removed it from the package.
A high-resolution composite image of the entire die.
A high-resolution composite image of the entire die.
A high-resolution composite DIC image showing the entire die.
A high-resolution composite DIC image showing the entire die.
A focus stacked image showing several circle-in-square circuit elements of two sizes.
A focus stacked image showing some interesting circuitry in the top-left corner of the die. Based on a discussion on the time-nuts mailing list, it appears likely that these are the capacitor arrays used for adjusting the frequency of the crystal.
A focus stacked DIC image showing several circle-in-square circuit elements of two sizes.
A focus stacked DIC image showing some interesting circuitry in the top-left corner of the die. Based on a discussion on the time-nuts mailing list, it appears likely that these are the capacitor arrays used for adjusting the frequency of the crystal.

That’s all the photos for now. I hope you found this as interesting as I did.

Investigating Fake MAX3232 TTL-to-RS-232 Chips

A while back I needed to interface a GPS timing receiver that only has an RS-232 serial connection with one of my Raspberry Pis. The Pi only supports TTL-level serial and only tolerates voltages between 0-3.3V its the UART pins.

Enter the MAX3232, a chip from Maxim Integrated that converts between RS-232 and TTL serial with supply voltages from 3.0 to 5.5V. It produces “true” RS-232-level voltages (both positive and negative) using built-in charge pumps and some small external capacitors. Just the ticket for what I needed.

Alas, the MAX3232 isn’t really something one can run down to the local electronics shop (and there isn’t any such shop where I live in Switzerland, as far as I know) and pick up. Typically it’s purchased by manufacturers in quantity from major suppliers. Hobbyists like myself need to turn to the internet where such things are available in abundance for cheap from China, though one must be wary of counterfeits. Of course, I could order from legitimate Swiss distributors, but small-quantity pricing and shipping are extremely high (>$10 USD per chip!) compared to major US distributors like DigiKey and Mouser.

In my case, I ended up buying a few boards like this one from an online vendor in China. The listing specifically states it had a MAX3232 chip. My thought was that if it was a legitimate chip, cool. If not, it’d be an interesting experiment and I’d get some cheap DE-9 connectors out of the deal.

Fake MAX3232 Board
Fake “MAX3232” Board

To the naked eye, everything seemed to be reasonable. The chip did have markings identifying it as a MAX3232 (falsely, as I later discovered; read on!). The board worked and the chip functioned within the specs in the Maxim datasheet and it even broke out the chip’s second RS-232-to-TTL channel on the header pins.

However, the first board failed after a few weeks, drew significant current, and dramatically overheated. By “overheated” I mean “blister-raising burn on my fingertip”-level-hot. Also, the data-transfer LEDs were glowing faintly all the time rather than flickering on and off when data was flowing.

Figuring this was just some bad luck on my part (this is before I got the anti-static mat on my desk), I swapped it out for another board. I was particularly careful with anti-static precautions, and put the board over a small glass container just in case it overheated and caught fire. Although it didn’t catch fire (thankfully!), it did fail after a few weeks and overheated just like the first one.

Ok, so something’s going on, but what? Since the chips had obviously failed, I figured I couldn’t harm them with some ham-fisted SMD desoldering, so I took them off their respective boards.

Here’s the results of my handiwork, as viewed under a petrographic microscope in the lab (I used a handheld camera aimed through the microscope eyepiece for all the microscope photos, hence the weird vignetting at the edges):

Fake MAX3232 Package
Fake MAX3232 #1 Package
Fake MAX3232 Package
Fake MAX3232 #2 Package

All right, quit laughing! De-soldering SOIC chips using a handheld soldering iron is no fun.

Anyway, the markings are inconsistent and seem pretty low-quality. Definitely not something I’d expect from Maxim. For comparison, I had ordered a free MAX3232 sample directly from Maxim (thanks, guys!) and it arrived a few days later. Here’s the legit chip:

Genuine MAX3232 Package
Genuine MAX3232 Package

According to the date code, I ended up killing this chip in the name of science about 2-4 weeks after it was made. Sorry, little guy. Anyway, you can see the markings of the real chip are distinctly different from the fake chips. The differences are striking even with a handheld magnifying glass: the real chip has distinct laser-etched markings with a textured surface. The fake chips have much “weaker” etching with a much flatter, duller surface.

Next, I decapsulated all three chips (two fake and one genuine) by dissolving them in hot nitric acid followed by an acetone wash and a few minutes in the ultrasonic cleaner. Don’t try this at home (or at least not in my home!): I did it in a controlled environment with a fume hood, proper ventilation, protective gear, etc. Zeptobars and the CCC have some interesting guides on how to do this if you’re interested. Be careful.

Alas, I wasn’t able to do the preferred method of just dissolving the package over the silicon die itself. Instead, I decided to dissolve the entire chip package, legs and all. Interestingly, the genuine one dissolved much more rapidly (but at a consistent rate) than the fakes; the fakes resisted the acid for nearly an hour, then quickly dissolved in a few minutes. The package seemed to be the same blackish epoxy that most chips are encased in, so I have no idea why they would behave so differently in acid. Any materials-type people have any ideas?

Here’s what the real MAX3232 die looks like:

Genuine MAX3232 Die
Genuine MAX3232 Die

Note the gold bond wires are still attached and didn’t dissolve in the acid bath. I’m not a semiconductor expert, so I can’t tell you what the actual regions of the chip actually are, but it’s a pretty picture and serves as a good reference for comparing the others. Also, the genuine die is about 50% longer than the fakes so it couldn’t fit entirely in the field of view of the microscope.

Here’s a closeup of the “Maxim” marking on the genuine chip as well as a date code. Presumably it refers to when the chip design was finalized.

Genuine Maxim Mark on MAX3232
Maxim Mark on Genuine MAX3232

Now, let’s look at the fakes. Both fakes were, unsurprisingly, identical.

Without magnification, the dies are pretty small and it’s hard to make out any detail.

The fake MAX3232 die is quite small. The real one is only a millimeter or so longer.
The fake MAX3232 die is quite small. The real one is only a millimeter or so longer.

Under the microscope, we can see the die quite well.

Fake MAX3232 Die
Fake MAX3232 Die

The above photo was taken at the same magnification as the genuine MAX3232 die photo: you can see the fake die is much smaller, has a much different appearance, and didn’t use gold bond wires. Whatever metal was used for the wire dissolved away in the acid.

Both chips had the same markings: they appear to have been designed in November 2009, and the marking on the second line appears to be “WWW01” (though I’m not sure if it’s the number zero or the letter “O”). I’ve had no luck figuring out what that means.

Fake MAX3232 Date Code & Manufacturer(??) Mark

As I mentioned above, I’m not an expert on low-level chip design or failure analysis and I was unable to find any obvious-to-the-layman failure in the chips that would have resulted in them passing significant current and overheating. Any ideas?