32k_N XTAL - TXCO

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

32k_N XTAL - TXCO

Postby Lancsrick » Thu Apr 20, 2023 3:08 pm

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

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: 32k_N XTAL - TXCO

Postby ESP_Sprite » Fri Apr 21, 2023 2:11 am

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?

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Fri Apr 21, 2023 6:25 am

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 :(.

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Fri Apr 21, 2023 10:31 am

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

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Sun Apr 23, 2023 2:26 pm

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.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: 32k_N XTAL - TXCO

Postby ESP_Sprite » Mon Apr 24, 2023 8:29 am

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.

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Mon Apr 24, 2023 8:32 am

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?

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Mon Apr 24, 2023 8:36 am

Rise time looks to be approx 2 micro seconds.

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Mon Apr 24, 2023 8:43 am

And thank you for all this help Sprite :).

Lancsrick
Posts: 30
Joined: Mon Apr 10, 2023 5:48 pm

Re: 32k_N XTAL - TXCO

Postby Lancsrick » Tue May 09, 2023 1:50 pm

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

Who is online

Users browsing this forum: No registered users and 97 guests