mongoose-os icon indicating copy to clipboard operation
mongoose-os copied to clipboard

ESP32 set clock frequency in mos.yml?

Open Harvie opened this issue 5 years ago • 1 comments

I've noticed that ESP32 can run under various speeds 40MHz, 80MHz, 160MHz, 240MHz. Can this be set in mos.yml ?

Can this be set during runtime? I've noticed esp-idf has api for this, but i am not sure if nothing will break on mongoose side when i use it...

Harvie avatar Apr 21 '20 11:04 Harvie

it can be set in mos.yml via SDK options. for example, to run at 240 mhz:

ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_ESP32_DEFAULT_CPU_FREQ_80= CONFIG_ESP32_DEFAULT_CPU_FREQ_160= CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240"

changing frequency at runtime should be possible as long as APB frequency stays constant, otherwise peripheral frequency dividers need to be adjusted, which is not currently done.

you need to keep in mind that not all chips are qualified to run at 240 mhz. ones that are, have special efuse set and if it's not set, it will refuse to run.

rojer avatar Apr 21 '20 11:04 rojer