rtc_clk_cpu_freq issue

Home Forums English support forum rtc_clk_cpu_freq issue

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1711
    Ales KrapezAles Krapez
    Participant

    Hi.
    I have an issue with uploading sketch.

    ‘rtc_clk_cpu_freq_set’ was not declared in this scope

    Is there any solution?
    Thank you

    #1713
    Koray TuncerKoray Tuncer
    Participant

    Yes same problem:
    Board ESP-Wroom-32
    I try the sketch temparature sensor only.

    rtc_clk_cpu_freq_set’ was not declared in this scope

    Need an urgent solution if possible.
    Sincerely,

    #1714
    Ales KrapezAles Krapez
    Participant

    I noticed that the problem is in “slowDownCpu” in Sketch 3.1 this code did not exist and these versions work (at least for me)

    [code]
    void setup() {
    Serial.begin(115200);
    slowDownCpu();
    pinMode(ONBOARD_LED_PIN, OUTPUT);

    pinMode(RELAY_PIN, OUTPUT);

    dht.setup(DHT_PIN, DHT_TYPE);

    setUpWifi();

    lastReceivedRelayCommandMilis = millis();

    }

    void slowDownCpu() {
    rtc_clk_cpu_freq_set(RTC_CPU_FREQ_160M);
    uart_tx_wait_idle(0);
    int clockspeed = rtc_clk_cpu_freq_get();

    char* clockSpeeds[5] = {“XTAL”, “80Mhz”, “160Mhz”, “240Mhz”, “2Mhz”};
    Serial.print(“Setting CPU freq to: “);
    Serial.println(clockSpeeds[clockspeed]);
    Serial.println(“”);
    }

    [/code]

    If you isolate this code in version 3.4, everything works

    #1715
    Koray TuncerKoray Tuncer
    Participant

    I think it is not the right solution, but i disabled some codes with //

    [code]
    void setup() {

    Serial.begin(115200);
    //slowDownCpu();
    pinMode(ONBOARD_LED_PIN, OUTPUT);

    dht.setup(DHT_PIN, DHT_TYPE);
    setUpWifi();
    }

    //void slowDownCpu() {
    //rtc_clk_cpu_freq_set(RTC_CPU_FREQ_160M);
    //uart_tx_wait_idle(0);
    //int clockspeed = rtc_clk_cpu_freq_get();

    //char* clockSpeeds[5] = {“XTAL”, “80Mhz”, “160Mhz”, “240Mhz”, “2Mhz”};
    //Serial.print(“Setting CPU freq to: “);
    //Serial.println(clockSpeeds[clockspeed]);
    //Serial.println(“”);
    //}
    [/code]

    It worked.
    Does anyone know the right solution?

    #1716
    adminadmin
    Keymaster

    Hi there!

    I would not say, that it is not the right solution. It seems that the board you are using is not exactly the same as the board I used to develop the project, and it behaves differently when it comes to modifying the CPU frequency.

    The ‘slowDownCpu’ function is used to slightly slow down the CPU and save energy, as it’s not at all necessary to run at the maximum speed the ESP board can offer. Removing this function will only result in your ESP board consuming a bit more energy, but it will likely be negligible.

    Regards!

    #1718
    Koray TuncerKoray Tuncer
    Participant

    Dear Admin,
    Thank You for your reply.
    Whats is your ESP32 board model exactly?
    Sincerely,

    #1721
    Ales KrapezAles Krapez
    Participant

    Now I pasted another code for CPU speed (and it works). I hope the admin won’t be offended.

    [code]
    #include “esp32-hal-cpu.h”

    void setup(void)
    {
    Serial.begin(115200);

    setCpuFrequencyMhz(80); //Set CPU clock from 80MHz to 240MHz for example
    Serial.println();
    Serial.print(“CPU Frequency is: “);
    Serial.print(getCpuFrequencyMhz()); //Get CPU clock
    Serial.print(” Mhz”);
    Serial.println();
    }

    [/code]

    Please can you look into why the code in the previous post is not working.
    Thank you

    #1727
    Radian VoiculescuRadian Voiculescu
    Participant

    Solved the above problem by installing a older version of ESP32 in Board Manager (v 1.0.4)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.