As should be clear from one of my earlier posts, I’m really interested in clocks and precision timekeeping. In particular, I rather like the Dallas Semiconductor DS3231 series of temperature compensated RTC/TCXO (real-time clock/temperature compensated crystal oscillator) modules.
Recently, I had ordered several DS3231 boards from my regular eBay vendor in Shenzhen for some testing, only to find two oddities: first, the factory had evidently gotten an incorrect chip with the same sized 0.300″ SOIC package as the DS3231. This chip was the wholly-incompatible DS1315. It happens, particularly at this price point and via gray market suppliers. No worries, I contacted the seller and they sent me a replacement board.
The second oddity was that two of the boards I ordered contained a DS3231M chip, which, though seemingly only a different variant of the same chip, is a somewhat different beast than the DS3231 (non-M), in that the non-M variant has a standard 32.768 kHz crystal oscillator built into the chip package and which has its frequency corrected for temperature variations by the chip and its internal temperature sensor. The M variant uses a microelectromechanical system (MEMS) oscillator which is more resistant to vibration and shock than a crystal, but which has a stability of only 5 ppm vs. the 2 ppm of the non-M variant. Other than the choice of time base and stability, there’s two major differences between the chips which I’ll discuss below.
That I received a board with a wrong chip turned out to be fortuitous, since I was able to desolder the incorrect chip (at the cost of lifting one pad, hence the bodge wire in the photo below) and replace it with one of the “free samples” of genuine DS3231Ms I ordered from Maxim (many thanks to Maxim for offering such samples with minimal hassle) without having to waste a working chip. Note that although I placed the order for the free sample in August of 2017, the date code on the genuine chip pictured above is from December of 2011. Obviously Maxim keeps an inventory of chips in storage, presumably to have a buffer for spikes in demand.
The genuine Maxim chips (both the one I soldered to the board, as well as the second one I received but haven’t put on a board) both meet the datasheet specs for 1 Hz stability. So do the eBay-sourced ones. The laser markings on the packages are nearly indistinguishable, and all the eBay-sourced ones appear to be authentic Maxim chips.
After doing some tests with the M variants, two major differences between the two variants became clear. These are detailed in the respective datasheets (available here for the DS3231, and here for the DS3231M), but are a bit subtle and may be, as Dave Jones says, a “trap for young players”. Thus, I felt I should explicitly mention them here.
Here we go:
1. The DS3231 can be used as both an RTC and a TCXO but the DS3231M is only an RTC.
This is actually mentioned in the title of each chip in their datasheets, with the DS3231 described as an “Extremely Accurate I2C-Integrated RTC/TCXO/Crystal”, while the DS3231M is described as a “+/- 5 ppm, I2C Real-Time Clock”.
Why is this so? Let’s take a look at the block diagrams from the datasheet to find out. First, here’s the crystal-based DS3231:
The crystal, which is integrated into the package itself, is connected to the oscillator circuit and array of capacitors which can be switched in and out to steer the frequency.
The output of the oscillator is sent to the control system that, after reading the temperature from the temperature sensor, determines the number of capacitors to switch into the circuit to compensate for any changes in temperature. A divider in the control system outputs both a 1 Hz signal which is used internally for timekeeping, as well as other signals which are used in the “square-wave buffer; INT#/SQW control” block. Critically, both of these outputs are temperature compensated.
The “square-wave buffer; INT#/SQW control” block has two external outputs, both open drain (and thus requiring external pullup resistors): the 32.768 kHz output and a user-programmable interrupt (e.g. for an alarm) or square wave (which is programmable to produce either 1 Hz, 1.024 kHz, 4.096 kHz, or 8.192 kHz signals) output.
In short, one can use the “32 kHz” pin to measure the actual, temperature compensated frequency of the crystal oscillator, as well as using the “INT#/SQW” pin to output a temperature compensated signal either at 1 Hz or one of several fixed frequencies.
Keep in mind the following caveat from Maxim (personal email from one of their application engineers):
The DS3231SN# is a crystal based RTC whose 32kHz output is temperature compensated. So depending on the temperature we will adjust the internal capacitive load to maintain a consistent 32kHz frequency across temperature. However, the DS3231 series is not intended to be used as a 32kHz reference as the design is strictly focused on creating the most accurate 1Hz signal to drive the RTC.
Seems reasonable to me: the DS3231 is primarily focused on timekeeping, and the 32 kHz output is a nice bonus. Although the 32 kHz output will be continuous (i.e., it won’t skip or add extra pulses), the frequency output is only corrected for temperature variations every 64 seconds and so may drift a bit during that time. When the temperature conversion and correction happens, there may be a sharp, distinct change in frequency. For systems that require smooth changes in frequency, using a DS3231 as a clock source or frequency standard might not be the best option. For other purposes though, it may work reasonably well. I use mine for driving AVR microcontrollers at low speed, and this works fine.
Compare the above diagram with that for the DS3231M:
In lieu of a crystal, the DS3231M’s MEMS “time-base resonator” oscillates at a high-but-unspecified frequency. The resonator signal is sent to both a divider and to the digital adjustment block. Note that the temperature sensor is connected to the digital adjustment block (but, critically, not the divider that drives the 32 kHz output), which in turn outputs a temperature compensated 1 Hz signal to the timekeeping block (out of view above) and to the INT#/SQW output pin which can produce a 1 Hz signal.
The 32 kHz output of the DS3231M is not temperature compensated, while the 1 Hz INT#/SQW output is.
The 1 Hz signal has a specified stability of 5 ppm, but the 32 kHz signal can vary by up to +/- 2.5%. Yikes.
If you have a frequency counter or an oscilloscope with a stable reference, you can see the difference between the two chips by probing the 32 kHz output (with a proper pullup resistor) and then touching the chip with your finger to gently warm it. The DS3231’s output frequency will slowly change and, after up to 64 seconds, the chip will compensate and the frequency will stabilize again. The DS3231M’s output frequency will change dramatically since the temperature coefficient of a MEMS oscillator is significantly higher than that of a crystal, though the temperature coefficient of the MEMS oscillator is not specified in the datasheet.
I have no idea why they designed the chip this way, but it is what it is. It’d be nice if a later revision to the DS3231M offered a temperature compensated 32 kHz output.
This brings us to the second point.
2. The DS3231 can output one of several frequencies or an interrupt on the INT#/SQW pin, but the DS3231M can only output a 1 Hz signal (or an interrupt).
By writing to bits 3 (Rate Select 1, RS1) and 4 (RS2) and setting bit 2 (Interrupt Control, INTCN) to 0 in the control register (0x0E) of the DS3231, a square wave at either 1 Hz, 1.024 kHz, 4.096 kHz, or 8.192 kHz will be output on the INT#/SQW pin.
On the DS3231M, the RS1/RS2 bits are not used and have no effect. When INTCN is set to 0, the INT#/SQW pin outputs a 1 Hz signal. No other frequency options are available.
The INT#/SQW outputs of both chips are temperature compensated.
So far, these are the only two major differences I’ve found between the M and non-M variants. Are you aware of any more? Do you have any idea why Maxim would choose not to have the 32 kHz output of the DS3231M be temperature compensated? Why would they not allow for several user-selectable output frequencies and only allow the user to select the 1 Hz output? If you know, please comment!