DWM1004C LSE X1 32.768 crystal ppm

Hi,

I’m looking for more information about the used 32.768 kHz crystal on the DWM1004C module. It is referenced to as X1 on the schematic.

I want calculate how accurate i can use the LPTIM with the LSE as Clock Source of the STM32 processor therefore i need to know the ppm of this crystal, but i can’t find specified which crystal is used…

Schematic:

The schematic PDF has parameters for the parts you can reach by clicking on them. The X1 results are 32.768 KHz, 20 ppm, 7 pF, 70 K, 2012 package. No specific part number is given, but those parameters match these parts at DigiKey:

ECS-.327-7-12R
CM8V-T1A-32.768KHZ-7PF-20PPM-TA-QC

There could be others, but they will all work pretty much the same. 20 ppm is a typical tolerance for commodity grade 32.768 KHz crystals. They can be had at 10 ppm and a few are available at 5 ppm.

The 20 ppm tolerance is only at 25 C. These low frequency crystals have a fairly strong temperature dependence:

For truly accurate timing, you need to periodically measure the temperature and apply mathematical adjustments to the clock. For example, at 65 C, the frequency is slow by about 55 ppm, or losing 1.8 ticks per second. You need to add in an extra clock tick every 550 ms or so at that temperature.

The STM32 processor RTC systems have a feature to do this correction. See section 22.4.12 of the reference manual:

You have to figure out the correction to be applied, but then the RTC does the adjustment for you as the RTC operates.

The STM32L041G6 has an internal temperature sensor. See section 13.9 of the reference manual. There are calibration bits ST puts in the chip during manufacturing to correct for part to part tolerance. Note that this isn’t exactly the crystal temperature, it is the processor temperature, so heavy use of the processor will cause a reading warmer than the crystal. Also, heavy use of the DW1000, especially in receive, will create a temperature gradient on the board.

To make a truly accurate RTC takes some effort, but all the tools are there in the hardware to do it.

Mike Ciholas, President, Ciholas, Inc
3700 Bell Road, Newburgh, IN 47630 USA
mikec@ciholas.com
+1 812 962 9408

2 Likes

Hi Mike,

Thank you I think I missed the extra info because of a quirk in my pdf reader but thank you.
And also thank you for the extra information regarding the correction, now I have to figure out if i can do this in low power mode.
but i have a fairly limited and constant temperature range where the tag will be in so i might pull it off without.

And I wanted to note that I appreciate all the extensive answers you give at this forum, a lot of helpful information / insights !

Hi Fabi,

I can confirm that in fact the 32 kHz MCU crystal and its loading caps (components X1, C1 and C2) aren’t populated in the DWM1004C module. Apologies for this misleading error in our schematic. We’re working to add <‘NM’> indicators to these components and issue an updated schematic.

A this is too bad, I had some ideas of how to use it with custom firmware.
Is this to reduce costs or what is the reason of not including this crystal,etc?

There’s a possible work around that requires some firmware development and some hardware changes external to the module.

Use the low power timer on the STM32L041G6. LPTIM1 can take an external clock on LPTIM1_IN1 which can be mapped to several pins, including some that come out the module pins: PA0, PA4, PA8, PB5.

Attach a 32 KHz precision oscillator to those pins, and program LPTIM1 properly, it will count 32 KHz pulses. You can then set an interrupt compare on the counter value. The LPTIM will operate in STOP mode, which is the basic mode to lower power of the MCU during idle times (preserves state as opposed to STANDBY mode).

You have to produce a 32 KHz clock signal to valid logic levels, not just hook up a crystal. Here’s a part that does that:

https://www.sitime.com/datasheet/SiT1533

You can even get a TCXO version with much higher accuracy:

https://www.sitime.com/datasheet/SiT1552

The other issue is that the LPTIM is 16 bits. If you prescale by 1, then it lasts 2 seconds. You will need to take a wake up interrupt every 2 seconds at least to time events further away than that. A wake up, update counter, go back to STOP mode is not very much power every 2 seconds.

If you use the prescaler, you can make it last much longer, up to 256 seconds, but timing resolution is reduced to 3.9 ms (1/256 of a second). I would favor prescale by 1 and waking up every 2 seconds to keep the timing resolution.

There is no way to get an external clock to drive the RTC other then feeding it into the OSC32 pins, which are not pinned out on the DWM1004C module.

Mike Ciholas, President, Ciholas, Inc
3700 Bell Road, Newburgh, IN 47630 USA
mikec@ciholas.com
+1 812 962 9408

Hi Mike,

Using the LPTIM1 was exactly what i wanted to do, but i was under the impression the crystal was already in the design. which is clearly not so i would have to add it later, or one of the versions as you suggested.

But i thought it was possible to set it in a way so it still runs in deep sleep, i think i read it wrong then.I’ll look into it.

Thank you!

Yes. The only low power oscillator that comes with the module is the LSI (low speed internal) clock inside the STM processor. It is based on an RC ring oscillator which makes it significantly less stable and accurate as compared to a crystal.

The LSI on the STM32L041G can be anywhere from 26 to 56 KHz which gives you some idea how much variance there can be. Even if you calibrate this against a known clock, it can vary several percent with temperature.

The STM processor can be put in STOP (state retained) or STANDBY (reset to exit) power saving modes.

The DW1000 chip can be put into SLEEP (wake up timer) or DEEPSLEEP (no timer) low power modes, too.

The only thing the crystal does is give you an accurate way to time when you wake up. The absence of it doesn’t prevent you from using low power modes, you just can’t do it precisely in time.

Mike Ciholas, President, Ciholas, Inc
3700 Bell Road, Newburgh, IN 47630 USA
mikec@ciholas.com
+1 812 962 9408