I have a board built by our team that is using an external clock source (not a crystal) for the external ESP32 RTC clock (32K). The source goes into XTAL32KP with XTAL32KN disconnected. However, whenever I set the CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL to y via menuconfig in sdkconfig and build our project which uses the 2nd stage bootloader and am getting this message:
clk: still waiting for 32k oscillator to start up
Two questions:
1) Can the ESP32 use a single ended clock source for the 32K external input?
2) Is there more I have to do (if the answer to #1 is yes) to enable using this clock source in the IDF? (I have a version of the IDF from June 2017; I would provide a commit but the repo we are using has had its history erased in transfer )
ESP32 External RTC 32K
Re: ESP32 External RTC 32K
Im still trying to get this to work, so I flashed the unit test application onto a few of our boards and scoped the signals. I tried running the rtc_clk unit tests and would get one of two possible outcomes from calibration:
Or:
In both cases, if I try to run the "Output 32k XTAL clock to GPIO25", I get a flat line while probing the XTAL_32KP line gets me the 32KHz clock as expected. Im maybe getting some noise one the 32K clock but I have to confirm with out hardware engineer if my setup is just a bit noisy. Other than that, even if it succeeds to calibrate, why am I getting a flat line on GPIO25?
Code: Select all
calibrate (0): 34.728 kHz
calibrate (1): 34.730 kHz
calibrate (2): 34.733 kHz
calibrate (3): 34.733 kHz
calibrate (4): 34.731 kHz
RTC_CAL_8MD256:
calibrate (0): 34.731 kHz
calibrate (1): 34.729 kHz
calibrate (2): 34.726 kHz
calibrate (3): 34.728 kHz
calibrate (4): 34.727 kHz
RTC_CAL_32K_XTAL:
calibrate (0): inf kHz
calibrate (1): inf kHz
calibrate (2): inf kHz
calibrate (3): inf kHz
calibrate (4): inf kHz
32K XTAL OSC has not started upswitching to RTC_SLOW_FREQ_8MD256: done
RTC_CAL_RTC_MUX:
calibrate (0): 34.725 kHz
calibrate (1): 34.726 kHz
calibrate (2): 34.729 kHz
calibrate (3): 34.729 kHz
calibrate (4): 34.725 kHz
RTC_CAL_8MD256:
calibrate (0): 34.728 kHz
calibrate (1): 34.727 kHz
calibrate (2): 34.729 kHz
calibrate (3): 34.731 kHz
calibrate (4): 34.732 kHz
RTC_CAL_32K_XTAL:
calibrate (0): inf kHz
calibrate (1): inf kHz
calibrate (2): inf kHz
calibrate (3): inf kHz
calibrate (4): inf kHz
Code: Select all
RTC_CAL_RTC_MUX:
calibrate (0): 34.728 kHz
calibrate (1): 34.727 kHz
calibrate (2): 34.726 kHz
calibrate (3): 34.727 kHz
calibrate (4): 34.726 kHz
RTC_CAL_8MD256:
calibrate (0): 34.728 kHz
calibrate (1): 34.730 kHz
calibrate (2): 34.730 kHz
calibrate (3): 34.728 kHz
calibrate (4): 34.731 kHz
RTC_CAL_32K_XTAL:
calibrate (0): 32.768 kHz
calibrate (1): 32.768 kHz
calibrate (2): 32.767 kHz
calibrate (3): 32.768 kHz
calibrate (4): 32.768 kHz
switching to RTC_SLOW_FREQ_32K_XTAL: done
RTC_CAL_RTC_MUX:
calibrate (0): 32.768 kHz
calibrate (1): 32.767 kHz
calibrate (2): 32.768 kHz
calibrate (3): 32.767 kHz
calibrate (4): 32.768 kHz
RTC_CAL_8MD256:
calibrate (0): 34.730 kHz
calibrate (1): 34.731 kHz
calibrate (2): 34.731 kHz
calibrate (3): 34.729 kHz
calibrate (4): 34.731 kHz
RTC_CAL_32K_XTAL:
calibrate (0): 32.767 kHz
calibrate (1): 32.768 kHz
calibrate (2): 32.768 kHz
calibrate (3): 32.768 kHz
calibrate (4): 32.768 kHz
switching to RTC_SLOW_FREQ_8MD256: done
RTC_CAL_RTC_MUX:
calibrate (0): 34.733 kHz
calibrate (1): 34.733 kHz
calibrate (2): 34.734 kHz
calibrate (3): 34.737 kHz
calibrate (4): 34.737 kHz
RTC_CAL_8MD256:
calibrate (0): 34.735 kHz
calibrate (1): 34.734 kHz
calibrate (2): 34.735 kHz
calibrate (3): 34.736 kHz
calibrate (4): 34.735 kHz
RTC_CAL_32K_XTAL:
calibrate (0): 32.767 kHz
calibrate (1): 32.768 kHz
calibrate (2): 32.767 kHz
calibrate (3): 32.768 kHz
calibrate (4): 32.768 kHz
Re: ESP32 External RTC 32K
We also want to do this, any information regarding its viability would be appreciated.
If it is possible to use an externally generated clock to supply just XTAL_32k_P, can XTAL_32k_N be reused as a GPIO?
Thanks
If it is possible to use an externally generated clock to supply just XTAL_32k_P, can XTAL_32k_N be reused as a GPIO?
Thanks
Steve.
Re: ESP32 External RTC 32K
We contacting ESP32 support directly and the response we got back told us to connect the XTAL32KN line to the oscillator, not the XTAL32KP line. We are going to try a rework to see if this fixes the strange issues we are seeing, so no definitive answers on this yet; but just for others looking for answers, this is what we have for now
Re: ESP32 External RTC 32K
Linking the related https://github.com/espressif/esp-idf/issues/1356 here.
Re: ESP32 External RTC 32K
As promised, a short update. We tried disconnecting our oscillator from the XTAL32KP and connected the XTAL32KN line to a function generator at 32.768KHz and it worked perfectly.
So, as with what ESP_iggr mentioned in the linked github issue; you must use the XTAL32KN line for the input of the oscillator if you arent using a crystal.
So, as with what ESP_iggr mentioned in the linked github issue; you must use the XTAL32KN line for the input of the oscillator if you arent using a crystal.
Who is online
Users browsing this forum: No registered users and 35 guests