guild icon
Toit
#ESP32-S3 PWM error
Thread channel in help
theHuanter
theHuanter 03/20/2024 08:02 AM
When initialising the PWM generator
generator := pwm.Pwm --frequency=400
I receive this error:

E (218246) ledc: freq_hz=400 duty_resolution=17 ****************************************************************************** Decoding by `jag`, device has version <2.0.0-alpha.134> ****************************************************************************** EXCEPTION error. UNKNOWN ERROR 0x102(258) 0: pwm-init_ <sdk>\gpio\pwm.toit:177:3 1: Pwm <sdk>\gpio\pwm.toit:103:12 2: RGBLED espnow\rgb-led.toit:10:16 3: main test\02-rgb-led.toit:4:10 ******************************************************************************
theHuanter
theHuanter 03/20/2024 08:05 AM
From this page: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/error-codes.html

Error 0x102 means:
ESP_ERR_INVALID_ARG (0x102): Invalid argument
theHuanter
theHuanter 03/20/2024 08:07 AM
just found another thread with no solution: https://discord.com/channels/918498540232253480/1186697368595333150/1186697368595333150

It might has to do with a change in the IDF again?
floitsch
floitsch 03/20/2024 12:45 PM
I'm guessing we are computing the duty-resolution incorrectly. Maybe we always did, maybe they changed it with an IDF change. Will try to look at it later today. (Firefighting a few things right now)
๐Ÿ‘1
theHuanter
theHuanter 03/20/2024 12:58 PM
it works for me so far with the 10k frequency so its fine for now
floitsch
floitsch 03/21/2024 08:22 AM
The ESP32 accepts --frequency=400.
Could be that the ESP32S3 works differently and we don't make that distinction in the code...
floitsch
floitsch 03/21/2024 08:26 AM
Confirmed: the ESP32 works, but the ESP32S3 doesn't.
I'm looking at the docs now to figure out how they differ.
floitsch
floitsch 03/21/2024 08:48 AM
I'm pretty sure the ESP32S3 doesn't support 400Hz.
floitsch
floitsch 03/21/2024 11:15 AM
But we are looking at the min here
theHuanter
theHuanter 03/21/2024 02:25 PM
generator := pwm.Pwm --frequency=2050
theHuanter
theHuanter 03/21/2024 02:26 PM
seems to be the lowest, was not trying any further then that but less will cause the error to happen
floitsch
floitsch 03/21/2024 02:27 PM
It might be possible to change the clock that drives the PWM, but from what I can see that would only give a factor of 4.
floitsch
floitsch 03/21/2024 02:29 PM
Hi all I'm would like to use 1Hz frequency in my PWM project, but it do not works. According with the ESP32 pwm docs, frequency works from 1Hz to 40MHz ("The base frequency can range from ...
theHuanter
theHuanter 03/21/2024 04:17 PM
not very important tbh - I just want to blink an LED and stumbled over this problem
๐Ÿ‘1
15 messages in total