Assistance Required: Configuring 7.27 MHz Clock on CW308 UFO Board for AES Power Analysis on ESP32

Hello everyone,

I’m currently a Master’s student at the University of Geneva, working on a project involving the power analysis of AES on ESP32. In the course of my research, I came across a fascinating paper titled “I, for One, Welcome Our New Power Analysis Overlords”.

The authors of this paper utilized the CW308 esp32 UFO board, noting that this platform operates with a 7.27 MHz external clock. However, despite extensive searches through both the ChipWhisperer and ESP32 documentation, I haven’t found any clear guidance on how to configure this specific clock setting.

My current implementation, which is a modification of the official CW308 code (and works quite well), operates at a clock speed of 26 MHz. I’m seeking insights or advice on how to adjust the clock speed to 7.27 MHz, as well as general tips on setting up the CW308 board for my project.

If anyone has experience with this setup or can offer some direction, I’d greatly appreciate it. Your expertise could be invaluable in advancing my research.

Thank you in advance for your help

Rose

Hi,

You can set the clkgen frequency by setting scope.clock.clkgen_freq. Small correction, but you probably want 7.37MHz instead of 7.27MHz. Also, if you don’t want to change the baud rate in the code, you’ll need to scale the baud rate the chipwhisperer uses by a factor of 7.37/26

Alex

I attempted to implement your solution, but it doesn’t seem to be working. I’m not sure if the issue lies within the following function in my C code for the ESP32, which I sourced from the official ESP32 interface for the ChipWhisperer, or if it’s related to something else. Additionally, I tried using an external quartz crystal, but I think I may not fully understand how to utilize it in conjunction with the ESP32

void clock_configure(void)
{
    /* Set CPU to 80MHz. Keep other clocks unmodified. */
    //uart_tx_wait_idle(0);
    rtc_clk_config_t clk_cfg = RTC_CLK_CONFIG_DEFAULT();
    clk_cfg.xtal_freq = RTC_XTAL_FREQ_26M;
    // clk_cfg.cpu_freq_mhz = 26;//same clk speed as osc?
    clk_cfg.slow_clk_src = rtc_clk_slow_freq_get();
    clk_cfg.fast_clk_src = rtc_clk_fast_freq_get();
    rtc_clk_init(clk_cfg);
    /* As a slight optimization, if 32k XTAL was enabled in sdkconfig, we enable
     * it here. Usually it needs some time to start up, so we amortize at least
     * part of the suint8_t set_lock_key(uint8_t* msg,size_t len);
// uint8_t test_lock_key(uint8_t* msg,size_t len);
tart up time by enabling 32k XTAL early.
     * App startup code will wait until the oscillator has started up.
     */
#ifdef CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
    if (!rtc_clk_32k_enabled()) {
        rtc_clk_32k_bootstrap();
    }
#endif
}

I would like to offer my apologies. After a few more attempts, the solution worked perfectly, and I’m not entirely sure why it didn’t on my first try. Furthermore, this solution integrates seamlessly with my implementation of Serial V2 that I have implemented on the ESP32.