Page 1 of 2

32k_N XTAL - TXCO

Posted: Thu Apr 20, 2023 3:08 pm
by Lancsrick
Hi everyone,

I'm really struggling to get my ESP32 boards to recognise a 32.678khz signal being applied to improve their timing accuracy (I need better than 50ppm).

What I've done:
- Read the hardware design guidelines
- Confirmed that a 3.3v square wave is produced by my DS3231 board
- Tried a voltage divider to drop the 3.3v square wave to approx 0.8v square wave
- Tried both GPIO32 (N) and GPIO33 (P) pins
- Tried two different DS3231 boards and two different ESP32 boards (Devkit V1)
- Tried with and without capacitor on 32k_P
- Tried with both pull-up and pull-down resistors on 32k_N

In all of these instances the serial monitor shows me that the ESP32 fails to find the external oscillator on start, and reverts to the 150khz internal oscilator.

Any help would be gratefully received - it's my first time moving into ESP32 territory and getting this working is critical to the entire project I'm trying to do.

Thanks.

Rick

Re: 32k_N XTAL - TXCO

Posted: Fri Apr 21, 2023 2:11 am
by ESP_Sprite
Basic check: you're not configuring those IO pins as GPIO, right? Do you have a 32KHz crystal at hand and can you check if it works with that?

Re: 32k_N XTAL - TXCO

Posted: Fri Apr 21, 2023 6:25 am
by Lancsrick
Thanks for the reply :).

No, I've not set any explicit pin modes, and as far as I've been able to find there isn't an XTAL mode to set for those pins.

No crystal to hand unfortunately :(.

Re: 32k_N XTAL - TXCO

Posted: Fri Apr 21, 2023 10:31 am
by Lancsrick
Ok @ESP_Sprite, here are some pictures and code to try and help.

Code: Select all

[0;33mW (492) clk: 32 kHz XTAL not found, switching to internal 150 kHz oscillator␛[0m

Tiny bit of code just to have something to compile:

Code: Select all

/*
 * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: CC0-1.0
 */

#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
#include "esp_log.h"


void app_main(void)
{
    printf("Hello world!\n");

}


sdkconfig:

Code: Select all

# RTC Clock Config
#
# CONFIG_RTC_CLK_SRC_INT_RC is not set
# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set
CONFIG_RTC_CLK_SRC_EXT_OSC=y
# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set
CONFIG_RTC_CLK_CAL_CYCLES=5000
# end of RTC Clock Config
And finally some breadboard pics of the current setup (variation number something-or-other).
https://imgur.com/a/OJt4q86

Re: 32k_N XTAL - TXCO

Posted: Sun Apr 23, 2023 2:26 pm
by Lancsrick
Ok I got a different board now (Feather v1) and I'm still having no luck, so I'm all but certain I'm missing something fundamental here in either software/firmware config or hardware setup. Any help gratefully received as I'm at a dead end.

Re: 32k_N XTAL - TXCO

Posted: Mon Apr 24, 2023 8:29 am
by ESP_Sprite
Do you have an oscilloscope to check what the signal looks like? Your RTC is open-drain and needs a pull-up resistor on the 32KHz line, so I'm wondering if the rise time is OK.

Re: 32k_N XTAL - TXCO

Posted: Mon Apr 24, 2023 8:32 am
by Lancsrick
I'll get you an image now.

To check, other than enabling source as ext osc and call cycles to at least 3000, there are no code edits required to do this?

Re: 32k_N XTAL - TXCO

Posted: Mon Apr 24, 2023 8:36 am
by Lancsrick
Rise time looks to be approx 2 micro seconds.

Re: 32k_N XTAL - TXCO

Posted: Mon Apr 24, 2023 8:43 am
by Lancsrick
And thank you for all this help Sprite :).

Re: 32k_N XTAL - TXCO

Posted: Tue May 09, 2023 1:50 pm
by Lancsrick
Sprite I'm afraid I still can't get this working. Please can you review the below as a circuit connections and advise what I'm doing wrong. I've switched to an Adafruit DS3231 and a Feather v2 so completely different hardware set and the same issue, so without doubt the problem is me.

"␛[0;33mW (653) clk: 32 kHz XTAL not found, switching to internal 150 kHz oscillator␛[0m" received at startup


Feather 3.3v > DS3231 3.3v
Feather GND > DS3231 GND
DS3231 32k > Feather Pin 33
Feather Pin 32 > 4.4nf > Feather GND
Feather Pin 33 > 400k > Feather 3.3v