32MHz clock output on ESP32-S3?

Huckies
Posts: 6
Joined: Wed Feb 16, 2022 3:22 am

32MHz clock output on ESP32-S3?

Postby Huckies » Sun Apr 10, 2022 2:48 am

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?

rpiloverbd
Posts: 101
Joined: Tue Mar 22, 2022 5:23 am

Re: 32MHz clock output on ESP32-S3?

Postby rpiloverbd » Mon Apr 11, 2022 12:07 am

Have you seen this thread? viewtopic.php?t=1037
It talks about 20MHz though.

Huckies
Posts: 6
Joined: Wed Feb 16, 2022 3:22 am

Re: 32MHz clock output on ESP32-S3?

Postby Huckies » Mon Apr 11, 2022 12:10 am

That's the LEDC way, it seems that the clock is not as accurate as needed.

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

Re: 32MHz clock output on ESP32-S3?

Postby ESP_Sprite » Mon Apr 11, 2022 1:02 am

What do you need wrt accuracy? Simply the right frequency, or do you also need low jitter?

Huckies
Posts: 6
Joined: Wed Feb 16, 2022 3:22 am

Re: 32MHz clock output on ESP32-S3?

Postby Huckies » Mon Apr 11, 2022 1:12 am

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.

Huckies
Posts: 6
Joined: Wed Feb 16, 2022 3:22 am

Re: 32MHz clock output on ESP32-S3?

Postby Huckies » Mon Apr 11, 2022 1:13 am

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.

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

Re: 32MHz clock output on ESP32-S3?

Postby ESP_Sprite » 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.

Huckies
Posts: 6
Joined: Wed Feb 16, 2022 3:22 am

Re: 32MHz clock output on ESP32-S3?

Postby Huckies » Mon Apr 11, 2022 4:41 am

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.

lladam
Posts: 44
Joined: Tue Jul 20, 2021 12:14 am

Re: 32MHz clock output on ESP32-S3?

Postby lladam » Fri Jan 20, 2023 3:02 am

is it too later here?
is it possible to use ESP32S3 make a clock without use Internet and External RTC module?
Thanks
Adam

Who is online

Users browsing this forum: Baidu [Spider] and 147 guests