ESP32Servo icon indicating copy to clipboard operation
ESP32Servo copied to clipboard

PWM on the s2 is currently broken

Open madhephaestus opened this issue 3 years ago • 9 comments

This issue:

https://github.com/espressif/arduino-esp32/issues/5050

is causing this library not to work on the s2 hardware.

madhephaestus avatar Apr 13 '21 15:04 madhephaestus

Indeed, I went back to basics and discovered the problem.

One point of note, the way the ESP32S2 core is distributed seems to have changed;

https://www.esp32.com/viewtopic.php?f=19&t=20364

I wonder how different the 'new' core is the the previous one and if other stuff is affected.

StuartsProjects avatar Apr 13 '21 15:04 StuartsProjects

can you try to set https://github.com/madhephaestus/ESP32Servo/blob/master/src/ESP32Servo.h#L84 to 10 and https://github.com/madhephaestus/ESP32Servo/blob/master/src/ESP32Servo.h#L85 to 1024 and see if the servo PWM starts working for you?

madhephaestus avatar Apr 13 '21 15:04 madhephaestus

@madhephaestus Do you have an S2 dev board to test fixes?

lbernstone avatar Apr 13 '21 15:04 lbernstone

I have an ESP32S2 Saola board hooked up on the bench with a scope on the servo pin.

Changing to ;

#define DEFAULT_TIMER_WIDTH 10 #define DEFAULT_TIMER_WIDTH_TICKS 1024

Gives, using the Sweep.ino example, a pulse period of 250uS.

StuartsProjects avatar Apr 13 '21 15:04 StuartsProjects

@lbernstone I do not yet. THis issue will stay open until there is a fix, and i can verify the fix.

madhephaestus avatar Apr 13 '21 16:04 madhephaestus

@ilush-a this issue is dependant on https://github.com/espressif/arduino-esp32/issues/5050 Once that issue is resolved the the solution published, this issue will go away. The problem is entirely in the lower layer of the stack, not in this code.

madhephaestus avatar May 16 '21 14:05 madhephaestus

any news about the problem with the esp32s2 ? i have now tried it for the first time and i dont know why it doesnt work

NirZamir1 avatar Dec 25 '21 19:12 NirZamir1

Will this be the same for the S3? I'm using a feather and all goes well until about 2 seconds after attach(pin, min, max) when the Hz on that pin drops to zero, and the servo does not centralise as it does on my LOLIN D1 mini (an ESP8266 using the Adafruit Servo library, not this one, I know :smile: ) Up to that point, I'm seeing 50Hz on the pin from bootup.

It seems odd that the core code is broken for over a year and they release a new board with the same broken stuff on it ☹️

I just tested the 10 and 1024 fix mentioned above, and it works fine on the Feather S3, Can that not be committed as a workaround with some testing for ESP32S or ESP32S3 or whatever the magic numbers are?

Less sad now 😄

nigeljohnson73 avatar Jul 08 '22 15:07 nigeljohnson73

I can confirm that the problem exists in ESP32-S3, and fixing DEFAULT_TIMER_WIDTH and DEFAULT_TIMER_WIDTH_TICKS to

#define DEFAULT_TIMER_WIDTH 10
#define DEFAULT_TIMER_WIDTH_TICKS 1024

solves the issue.

kpochwala avatar Apr 19 '23 16:04 kpochwala