Page 1 of 1
32MHz clock output on ESP32-S3?
Posted: Sun Apr 10, 2022 2:48 am
by Huckies
Hi everyone,
I'm attempting to have ESP32-S3 acting like a oscillator to drive another MCU, so I need a stable clock output.
I've look around here and github, someone mentioned the I2S APLL on ESP32, but it's not available on ESP32-S3. Does that mean I have to use a ledc generator? I'm kinda afraid that the frequency stability won't meet the requirement. Is there a better way to achieve this?
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 12:07 am
by rpiloverbd
Have you seen this thread?
viewtopic.php?t=1037
It talks about 20MHz though.
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 12:10 am
by Huckies
That's the LEDC way, it seems that the clock is not as accurate as needed.
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 1:02 am
by ESP_Sprite
What do you need wrt accuracy? Simply the right frequency, or do you also need low jitter?
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 1:12 am
by Huckies
I was trying to drive another MCU to save some space on the pcb. I tested it with a dupont line (~19cm long) and an ESP32-S3-DevKit-M, routing output to GPIO38. While the usb controller (on the other chip) works properly, flashing a new firmware using uart is a constant fail. I left ESP32-S3 continuously working when operating the other chip, so the clock should not break off.
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 1:13 am
by Huckies
ESP_Sprite wrote: ↑Mon Apr 11, 2022 1:02 am
What do you need wrt accuracy? Simply the right frequency, or do you also need low jitter?
Missed the reply button, see above please.
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 4:33 am
by ESP_Sprite
Hm, your issue may be jitter. LEDC uses 80MHz as a base clock, and that doesn't divide nicely into 32MHz; the only way to do it is with a fractional divider, and that introduces jitter. Unfortunately, USB is pretty insistent on a low-jitter clock signal; depending on how the clock infrastructure of the other MCU works, there likely isn't a way to get this to work with the LEDC at all.
Some peripherals in the ESP32S3 can use an internal 160MHz generated by the PLL as a base clock, e.g. the LCD/camera device. If you don't use that, there may be a way to abuse it to generate a clock... 160/5=32 exactly.
Re: 32MHz clock output on ESP32-S3?
Posted: Mon Apr 11, 2022 4:41 am
by Huckies
ESP_Sprite wrote: ↑Mon Apr 11, 2022 4:33 am
Hm, your issue may be jitter. LEDC uses 80MHz as a base clock, and that doesn't divide nicely into 32MHz; the only way to do it is with a fractional divider, and that introduces jitter. Unfortunately, USB is pretty insistent on a low-jitter clock signal; depending on how the clock infrastructure of the other MCU works, there likely isn't a way to get this to work with the LEDC at all.
Some peripherals in the ESP32S3 can use an internal 160MHz generated by the PLL as a base clock, e.g. the LCD/camera device. If you don't use that, there may be a way to abuse it to generate a clock... 160/5=32 exactly.
Yes, I noticed that too!
Code: Select all
esp_lcd_panel_handle_t panel_handle = NULL;
esp_lcd_rgb_panel_config_t panel_config = {
.data_width = 16, // RGB565 in parallel mode, thus 16bit in width
.clk_src = LCD_CLK_SRC_PLL160M,
.pclk_gpio_num = HSE_OUTPUT_IO,
.timings = {
.pclk_hz = HSE_FREQUENCY,
.h_res = 1,
.v_res = 1,
// The following parameters should refer to LCD spec
.hsync_back_porch = 40,
.hsync_front_porch = 20,
.hsync_pulse_width = 1,
.vsync_back_porch = 8,
.vsync_front_porch = 4,
.vsync_pulse_width = 1,
},
};
ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&panel_config, &panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
I have posted my implementation above, but there seems to be some missing operations so it failed to output the clock I need.
Re: 32MHz clock output on ESP32-S3?
Posted: Fri Jan 20, 2023 3:02 am
by lladam
is it too later here?
is it possible to use ESP32S3 make a clock without use Internet and External RTC module?
Thanks
Adam