Ales Krapez

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: rtc_clk_cpu_freq issue #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

    in reply to: rtc_clk_cpu_freq issue #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

Viewing 2 posts - 1 through 2 (of 2 total)