-
Notifications
You must be signed in to change notification settings - Fork 8
"SPARKFUN ESP32 THING" ISSUE WITH ESPRESSIF VERSION 3.0.0 - CORE CLOCK INCORRECT FREQUENCY? #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This chunk of code was pulled out of the Arduino examples/eps32/serial/Serial_All_CPU_Freqs.ino produces different uint32_t Freq = getCpuFrequencyMhz(); For the 2.0.17 version it produces ... For the 3.0.1 version it produces ... 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. |
Hi Dave (@dfrodin ), Many thanks for digging into this. We haven't seen the same issue on other ESP32 boards - but they usually use ESP32 modules with the crystal built-in. On the Thing, the XTAL is 26MHz and is 'external' to the ESP32-D0WDQ6-V3 processor: I suspect v3.0.0 of the core isn't detecting the XTAL frequency correctly, or is defaulting to the wrong value. This code is relevant: It might be possible to correct the XTAL frequency by calling I don't have a Thing here... Could you please set Core Debug Level to Verbose and give this a try:
Best wishes, |
Paul, I added a call to getXtalFrequencyMhz() which shows the transition from 40MHz to 26Mhz. It had no impact on the |
Hi Dave, The Verbose option is under Tools \ Core Debug Level (in the "Boards" section). So, no magic wand... That's a shame. I tried the code on a ESP32 Thing Plus C and it didn't change the baud rate either... I was hoping it might work on the Thing, but I'm not very surprised it isn't... I'll take another look at this tomorrow. We might need to ask Espressif for advice and/or a fix. More later, |
Hi again Dave, I think you're right about the divider (re)initialization.
Best, |
Paul, this ... produces this result... then... produces... with the 3 calls from above the baud rate is correct at 115200 and the millis() timer is dead on. I guess espressif should be made aware that there's some sort of bug in their clock init code. Thanks for finding this work around for me. |
Issue opened here: espressif/arduino-esp32#9837 |
Resolved! Please see: espressif/arduino-esp32#9844 I'll leave this open until the fix is built into a arduino-esp32 Release Candidate |
PaulZC, |
Thanks Dave. Closing... |
Is this supposed to be working now? |
Since the issue was supposed to have been fixed at the espressif arduino repo, I'm putting everything in that issue there for now instead to all three places. |
Issue opened at espressif/arduino-esp32#10388 |
This applies to the "Sparkfun ESP32 Thing" not the Thing Plus.
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 or perhaps just the core clock.
I initialize the serial port to 115k baud in setup(). With the latest espressif library change I have to reduce the baud rate on the serial monitor to 74880 to get meaningful output. The ratio of those two values is 115200/74880 = 1.55.
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
This output arrives at the correct 115200 baud rather than the runtime baudrate of 74880.
If I output a message every 60,000 msec using the Arduino 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 also 93/60 = 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'm unaware of what version/variant of the ESP32 is on the "Sparkfun ESP32 THING".
Feel free to ask if you need details on any particulars I can provide.
The text was updated successfully, but these errors were encountered: