Skip to content

CPU Freq Setting #1286

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

Closed
Natalie88 opened this issue Apr 3, 2018 · 9 comments
Closed

CPU Freq Setting #1286

Natalie88 opened this issue Apr 3, 2018 · 9 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@Natalie88
Copy link

Hardware:

Board: ESP32 Generic ?ESP32 Dev Module?
Core Installation/update date: 25/03/2018
IDE name: ?Arduino IDE?
Flash Frequency: ?80Mhz?
Upload Speed: ?115200?

Description:

I am calling rtc_clk_cpu_freq_set(RTC_CPU_FREQ_80M); in setup() just one time to adjust the cpu freq to 80Mhz . after deep sleep the frequency is back to 240? I thought the freq change will survive the deep sleep?
if I call the function each time the ESP wake up it hangs after several sleep periods, I think due to WDT reset as rtc_clk_cpu_freq_set consume a huge amount of time.
I have tried to yield() and put at delay(300) after the function call, it hang less but however it still hang sometimes.

Sketch:

//Change the code below by your sketch
#include <Arduino.h>
RTC_DATA_ATTR  bool freqIsChanged= false;
void setup() {
  if(! freqIsChanged){
    rtc_clk_cpu_freq_set(RTC_CPU_FREQ_80M);
    yield();
    RTCdata.freqIsChanged = true;  
  }
  Serial.begin(115200);
  Serial.println();
  Serial.println("Booted");
  Serial.flush();
  Serial.println(String(rtc_clk_cpu_freq_get()));
  Serial.flush();
// do stuff 

// Go to deep sleep
}

void loop() {
}

Debug Messages:

Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here 
@lbernstone
Copy link
Contributor

If you want the speed fixed at 80MHz, I recommend you follow the instructions at #1142 or just download the file from https://github.com/lbernstone/arduino-esp32-80MHz. Changing the cpu speed is going to be rough on the arduino timers.

@Natalie88
Copy link
Author

@lbernstone Thank you for your reply
I changed the mentioned file but I am still getting 3 when I call this function
rtc_clk_cpu_freq_get(), this means that the Freq is still 240Mhz

@lbernstone
Copy link
Contributor

I just updated to the latest code and tested it. I get 1 for the frequency.

@beats0126
Copy link

@lbernstone the 80mhz file cannot use for v1.0.1-rc1
can u update it?

@lbernstone
Copy link
Contributor

lbernstone commented Nov 29, 2018

I don't update it for rc releases. See issue #1142 to compile it, if you wish.

@atanisoft
Copy link
Collaborator

@beats0126 direct link to the instructions: #1142 (comment)

@me-no-dev
Copy link
Member

I think you should report this to the IDF team ;) They can actually do something about it and make it work :P

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

5 participants