ESP32S2 (S2FN4R2) and LEDC #7388
Replies: 3 comments
-
@P-R-O-C-H-Y Can you help answering this? |
Beta Was this translation helpful? Give feedback.
-
Hi @stef-ladefense,
|
Beta Was this translation helpful? Give feedback.
-
hi @P-R-O-C-H-Y // Test on Lolin S2 Mini ESP32-S2FN4R2 on gpio15 (internal led) https://www.wemos.cc/en/latest/s2/s2_mini.html
// bits freq min freq max (Hz)
// 1 19532 ?
// 2 9766 10019569
// 3 4883 5009784
// 4 2442 2504892
// 5 1221 1252446
// 6 611 626223
// 7 306 313111
// 8 153 156555
// 9 77 78277
// 10 39 39138
// 11 20 19569
// 12 10 9784
// 13 5 4892
// 14 3 2446
#define bit_num 3
#define freq 5000
#define channel 0
#define pin 15
const uint16_t maxi = (1 << bit_num) - 1;
uint16_t dutyCycle = 0;
int8_t _direction = 1;
void setup() {
ledcSetup(channel, freq, bit_num);
ledcAttachPin(pin, channel);
}
void loop() {
if (dutyCycle == maxi) _direction = -1;
else if (dutyCycle == 0) _direction = 1;
dutyCycle += _direction;
ledcWrite(channel, dutyCycle);
delay(5);
} |
Beta Was this translation helpful? Give feedback.
-
Hi there
I have a few questions, remarks
I work on 4 bits (so from 0 to 15), and the minimum frequency is 2500Hz, below that it doesn't work.
on the other hand in 8-bit mode, 1000Hz works well.
in the S2FN4R2 datasheet, it says PWM on all GPIOs, but it doesn't wo,rk on GPIO14, GPIO10.
work well 1, 6 ,8, dont have test other gpio for moment
merci
Beta Was this translation helpful? Give feedback.
All reactions