-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full power PWM not applied correctly (latest development version) #18726
Comments
Could you please test with a version that includes #18666 There was a mixup in the gamma tables, and the change you mention earlier is no more applicable. I don't have a device at hand to test. |
The version I tested is the most recent development branch as of today, so it includes the pull request you mentioned. Edit: It does look like #18666 also contributed to uncovering this issue, though. |
Ok thanks. Actually 1023 should match to 1023 in the gamma table, because it means full on. The problem is that the hardware PWM takes a value between 0 and 1024 (which counts for 1025 values). We need to apply the duty correction or the LED is not fully on when setting full range. From the tests we did in the past, the esp-idf documentation was wrong stating that values are 0..1023, they are 0..1024. This is easy to test with a real LED. Just set the led as The output from logic analyzer doesn't make sense. I really advise to test with a real device. |
Just checked the code of esp-idf, duty is passed unchanged to the hardware. So I suspect that the doc si still wrong about that. If the simulator was done based on esp-idf specs and not on hardware specs, this might explain the discrepancy. |
Thank you for your input! I can confirm your findings and I also took a look at the ESP32 data sheet which supports your observation: Let I will close this issue and file bug reports with |
@jonschz Tried the simulator. It is not useable for running Tasmota firmware. In my tests it always bootlooped a few times before starting correctly. This is a behaviour which Tasmota detects and resets user done settings.
|
I have encountered the same, but I have still been able to work with it reasonably well. Most of the time, the settings I made did not get erased. My main motivation is to fix another issue related to lights without buying a development board (I don't have a serial interface to my Tasmota light, so I want to minimise the odds of uploading broken firmware). For this application, the simulator worked well enough until I encountered this issue. I agree that the simulator cannot fully replace development boards in its current state. |
PROBLEM DESCRIPTION
This issue affects lights on the latest development build (this issue is not present in v12.5.0). Setting channels to 100 % (e.g.
Color1 000000FFFF
) results in a PWM output of roughly 50 %, while outputs lower than 100 % (e.g.FE
instead ofFF
) are unaffected. This issue appears in the latest commit but not in v12.5.0 (see below for details).REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:[inapplicable]
Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log:TO REPRODUCE
tasmota32-debug
.2.1 Simulate the circuit here by following the instructions on the left
2.2 Alternatively, upload the compiled firmware to an ESP32, hook
D18
andD19
up to some measurement device (like an oscilloscope), then runEXPECTED BEHAVIOUR
D18
andD19
should be on (about) 100 % output. However, they are closer to 50 %.SCREENSHOTS
Simulated digital analyzer output with
Color1 000000FFFF
:With
Color1 000000FEFE
:ADDITIONAL CONTEXT
I tracked down the most likely cause to this line:
Tasmota/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp
Line 385 in 7f312ba
This contrasts the documentation stating
The reason why this previously hidden problem came to light appears to be this (fully correct) change. In the past, the gamma correction curve would map
1023
to1017
which was then increased to1018
inanalogWritePhase()
. Now, the gamma curve (correctly) maps1023
to1023
which is then increased to1024
inanalogWritePhase
.In any case, commenting out the line in
analogWritePhase
solves the issue on my side.Disclaimer: I do not have an ESP32 and did my testing in Wokwi, so I cannot fully guarantee that the behaviour is identical on real hardware. However, the values passed to
ledc_set_duty_with_hpoint
are clearly not within spec, and in the simulator there is a stark difference between v12.5.0 and the current development version.(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: