-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[BUG] No PWM on Pins 5, 6 and 44 (LED RGBW) ATmega2560 on MKS Gen L V2.0 #25018
Comments
Most of your pins are in conflict R is on pin 5 G is on pin 4 B is on pin 6 W is on 44 But even removing these pin conflicts, the PWM still fails to function. |
A git bisect says e3e0735 is the commit that broke it |
This fixes it. diff --git a/Marlin/src/HAL/AVR/fast_pwm.cpp b/Marlin/src/HAL/AVR/fast_pwm.cpp
index e440315e00..3f17de5095 100644
--- a/Marlin/src/HAL/AVR/fast_pwm.cpp
+++ b/Marlin/src/HAL/AVR/fast_pwm.cpp
@@ -146,7 +146,7 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
LIMIT(res_pc_temp, 1U, maxtop);
// Calculate frequencies of test prescaler and resolution values
- const int f_diff = ABS(f - int(f_desired)),
+ const uint32_t f_diff = ABS(f - int(f_desired)),
f_fast_temp = (F_CPU) / (p * (1 + res_fast_temp)),
f_fast_diff = ABS(f_fast_temp - int(f_desired)),
f_pc_temp = (F_CPU) / (2 * p * res_pc_temp), |
FYI my Pin debug. It may was confusing because I did not send in the changed pin definition files (MKS/RAMPS). Recv: PIN: 4 Port: G5 RGB_LED_G_PIN Output = 0 TIMER0B PWM: 1 WGM: 3 COM0B: 3 CS: 3 TCCR0A: 3 TCCR0B: 3 TIMSK0: 3 overflow interrupt enabled Recv: PIN: 5 Port: E3 RGB_LED_R_PIN Output = 0 TIMER3A PWM: 1 WGM: 1 COM3A: 1 CS: 0 TCCR3A: 1 TCCR3B: 0 TIMSK3: 0 Recv: PIN: 6 Port: H3 RGB_LED_B_PIN Output = 0 TIMER4A PWM: 1 WGM: 1 COM4A: 1 CS: 0 TCCR4A: 1 TCCR4B: 0 TIMSK4: 0 Recv: PIN: 44 Port: L5 RGB_LED_W_PIN Output = 1 TIMER5C PWM: 1 WGM: 1 COM5C: 0 CS: 0 TCCR5A: 1 TCCR5B: 0 TIMSK5: 0 |
fixes issue MarlinFirmware#25018
A PR to fix this issue has been created. Closing this issue. |
I can confirm the fix did it (at least on my side). All works as expected now. I tested manually with M150 and can also see the startup test going thru "all" colors. Great work! Thanks! |
fixes issue MarlinFirmware#25018
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
Dear Development Team,
I have connected a LED RGBW strip via a transistor board to the Pins 5 (R), 4(G), 6(B) and 44 (W) and enabled RGBW_LED. When setting the values for LED lighting via M150 to S255 the corresponding LED illuminates. Setting a value of 254 or less the light switches off (0V at the pin). This does not affect pin 4 (G). This pin works as expected.
Even using M43 does not change the behaviour.
From past versions (v2.0.x) I can remember having pin 44 running on PWM before so I have seen PWM working on that board.
Bug Timeline
Seems to be from version 2.1 on
Expected behavior
I expected to dim all leds on pins 4, 5, 6 and 44 not on 4 alone.
Actual behavior
Only pin 4 dims and the others do not react to PWM values lower 255
Steps to Reproduce
e.g.
Version of Marlin Firmware
Marlin bugfix-2.1.x (Nov 25 2022 20:28:19)
Printer model
Anet A8
Electronics
MKS GEN L V2.0
Add-ons
No response
Bed Leveling
ABL Bilinear mesh
Your Slicer
Other (explain below)
Host Software
OctoPrint
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
Using Slicer from Autodesk Fusion 360 (n/a to this issue)
Configs.zip
The text was updated successfully, but these errors were encountered: