Closed
Description
Hardware:
Board: es32-s2 wrover
Core Installation version: 2.0.0 alpha 21947eb
IDE name: platform.io
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 460800
Computer OS: Xubuntu
Description:
The frequency of the ledc driver when running on an esp32-s2 is off by a factor of 80. If you configure to have a fairly slow frequency (50Hz in my case) the ledc output frequency will be 0.62
My guess is that the culprit is https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-ledc.c#L154, the ESP32-S2 doesn't have a high speed mode for ledc.
If i multiply the clock by 80 then I get the desired frequency
Sketch
#include <Arduino.h>
#include "driver/ledc.h"
void setup() {
ledcSetup(LEDC_CHANNEL_7, 50, LEDC_TIMER_14_BIT);
ledcAttachPin(38, LEDC_CHANNEL_7);
ledcWrite(LEDC_CHANNEL_7, 8191);
}
void loop() {
}