Page 1 of 2

External 32768 clock

Posted: Thu Mar 28, 2019 8:33 pm
by tsc1987
Does anyone have specifications regarding the crystal and the capacitance to use for the external 32.768kHz clock with the ESP32Wroom module?
I have tried using this crystal: https://www.digikey.com/product-detail/ ... ND/3927445 .
with 12pF capacitors on both sides.

We are seeing failure in about 20-25% of our units. The ESP32 during startup displays the following message:

"clk: RTC: Not found External 32kHz crystal. Switching to internal 150 kHz RC chain."

I have also tried to switch to 6pF capacitors on both sides with the above crystal and it still does not work.


Any insights into this issue will be really appreciated.

Re: External 32768 clock

Posted: Fri Mar 29, 2019 11:48 am
by WiFive

Re: External 32768 clock

Posted: Fri Mar 29, 2019 8:34 pm
by tsc1987
Hi,
I am using esp-idf v1.1.1 which already has the bug fix that was reported. I am still getting the failures in a few boards.

Re: External 32768 clock

Posted: Fri Mar 29, 2019 10:41 pm
by tsc1987
The issue was resolved by changing the clk.c file with the bugfix (https://github.com/espressif/esp-idf/co ... f66fae576a)

Any idea why this bug fix is not part of the standard release yet?

Re: External 32768 clock

Posted: Sat Mar 30, 2019 7:26 am
by ESP_Sprite
What do you mean by 'standard release'? As far as I can see, that fix has been in ESP-IDF since 3.1 was released. Are you really sure you're using ESP-IDF 1.x.x? Because the 1.x branch is three years old and unmaintained by now.

Re: External 32768 clock

Posted: Tue Apr 02, 2019 5:26 pm
by tsc1987
Sorry the firmware version is v3.1.1.

Also, the issue wasn't fixed with the changes. I ran unit tests on the clock. For the cases where its not working properly, the unit tests show that the crystal is detected but the time measurement fails.Following are the results of the unit tests:
attempt #1/3... [time=63] FAIL. Time measurement...FAIL [calibration val = 16000371]
attempt #2/3... [time=63] FAIL. Time measurement...FAIL [calibration val = 15999923]
attempt #3/3... [time=63] FAIL. Time measurement...FAIL [calibration val = 16000115]

Re: External 32768 clock

Posted: Fri Apr 05, 2019 2:47 am
by WiFive

Re: External 32768 clock

Posted: Wed Apr 10, 2019 5:55 pm
by commando_j
Are you giving enough time for the crystal to stabilize after power up, before measurement?

What is your layout like, trace length?

I don't like that the datasheet says "Load capacitance at both ends should be configured according to the crystal’s specification."
Usually there's a recommended load capacitance from the uC manufacturer.

Re: External 32768 clock

Posted: Wed Apr 10, 2019 6:54 pm
by commando_j
I have found this info. ESP32 does not seem to have an internal bias / feedback resistor internal to the chip. So it would be needed externally "for the oscillator to reliably start up- it biases the amplifier into the linear region where noise can be amplified to get the crystal oscillator going." ( From https://electronics.stackexchange.com/q ... ss-crystal).
The ESP32 datasheet says "The parallel resistor R4 is used for biasing the crystal circuit (5 MΩ < R4 ⩽ 10 MΩ)." And the image shows the R4 resistor is external to the ESP32 in the ESP32 Hardware Design Guidelines V2.7 page 6 Figure 6.
What is odd is that the WROVER kit doesn't have this resistor. But it is a dev kit, so not really a design to base yours on.
You could try adding a resistor across the pins, and/or making sure your caps calculation take into consideration some stray capacitance, say 2pF. CX1=CX2 = 2(CL - Cstray). So for your Digi-Key crystal with 6pF load capacitance, try 8pF caps. And ensure the caps are higher voltage (say 50V) at least 5% or less, and C0G(NP0).

Re: External 32768 clock

Posted: Mon Apr 15, 2019 2:59 pm
by commando_j
Any feedback?
Would like to know if you had any positive affects on your board.