I try to setup a 10bit pwm with analogWriteResolution(LED_R, 10);
but I get the following output:
[esp32-hal-ledc.c:793] analogWriteResolution(): analogWrite resolution cant be set due to selected frequency! Try to adjust frequency first
then I tried to explicitely set the frequency analogWriteFrequency(LED_R,1000);
then I get an additional message:
[esp32-hal-ledc.c:785] analogWriteFrequency(): analogWrite frequency cant be set due to selected resolution! Try to adjust resolution first
void setup() {
ledcSetClockSource(LEDC_USE_APB_CLK);
analogWriteFrequency(LED_R,1000);
analogWriteFrequency(LED_G,1000);
analogWriteFrequency(LED_B,1000);
analogWriteResolution(LED_R, 10);
analogWriteResolution(LED_G, 10);
analogWriteResolution(LED_B, 10);
}
I really do not understand the problem. 10bit @ 1khz requires a timerfrequency of 1Mhz which should be achievable without problems.
my platormio.ini
[env:esp32]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
board = upesy_wroom
board_build.mcu = esp32
board_build.f_cpu = 240000000L
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
#build_type = debug
#upload_port = COM6
board_build.filesystem = littlefs
build_unflags = -std=gnu++11
-std=c++11
build_flags =
-std=c++17
-std=gnu++17