Sparkfun ESP32 Thing issue with espressif version 3.0.0 - core clock incorrect frequency?

I’ve been using the Sparkfun ES32 Thing for several projects. With the latest 3.0.0 rev of the espressif ESP32 library with the Arduino IDE there is an issue with several of the clocks.

If you output a message every 60,000 msec using the millis() function you should get a message output every minute.

This has worked in the past but now outputs a message every 1 min 33 seconds. The ratio of these values is 93/60 = 1.55.

I initialize the serial port to 115k baud in setup(). With the latest espressif lib change I have to reduce the baud rate on the serial monitor to 74880 to get meaningful output. The ratio of those two values also happens to be 115200/74880 = 1.55.

I haven’t been able to reproduce these problems on a XIAO_ESP32C3 board.

I’m guessing that there is a missing configuration of the ESP32 core clock divider/multiplier setting that didn’t get adjusted with all of the other changes made by espressif in the 3.0.0 release.

I noticed that pressing the reset button on the “ESP32 Thing” produces the normal output of …

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

configsip: 0, SPIWP:0xee

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00

mode:DIO, clock div:1

load:0x3fff0030,len:1288

load:0x40078000,len:13872

load:0x40080400,len:4

ho 8 tail 4 room 4

load:0x40080404,len:3048

entry 0x40080590

However this output arrives at the correct 115200 baud rather than the runtime baudrate of 74880

Create an issue here https://github.com/sparkfun/ESP32_Thing_Plus/issues or here https://github.com/sparkfun/ESP32_Thing … .FL/issues :slight_smile:

I added https://github.com/sparkfun/ESP32_Thing_Plus/issues/7 even though (as far as I know) it applies to the ESP32 Thing rather than the ESP32 Thing Plus

Will a github issue written against the Sparkfun ESP32 Thing Plus have any visibility to the Espressif arduino-esp32 developers?

Those boards are identical except the ports

It’ll let the SFE engineers know, who can then work with Espressif for a fix

This chunk of code was pulled out of the Arduino examples/eps32/serial/Serial_All_CPU_Freqs.ino produces different

results depending on which esp32 board library is used.

uint32_t Freq = getCpuFrequencyMhz();

Serial.print("CPU Freq = ");

Serial.print(Freq);

Serial.println(" MHz");

Freq = getXtalFrequencyMhz();

Serial.print("XTAL Freq = ");

Serial.print(Freq);

Serial.println(" MHz");

Freq = getApbFrequency();

Serial.print("APB Freq = ");

Serial.print(Freq);

Serial.println(" Hz");

For the 2.0.17 version it produces …

CPU Freq = 240 MHz

XTAL Freq = 26 MHz

APB Freq = 80000000 Hz

For the 3.0.1 version it produces …

CPU Freq = 240 MHz

XTAL Freq = 40 MHz

APB Freq = 80000000 Hz

I would guess that the XTAL frequency is a hardcoded value defined in the board code. And even though the 3.0.1 version reports the CPU Freq as 240MHz it might be 160MHz.

The GitHub link posted on June 5th has a more robust description of the issue and a workaround to get the correct xtal frequency of 26MHz and core clock of 240 MHz.

I’ve retested with the 3.0.2 version of the ESP32 library and everything is behaving correctly. Thanks for your efforts.

1 Like