-
-
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] SKR V1.3 BLTouch + FAST_PWM_FAN problem #13861
Comments
I'm seeing similar behavior on my Re-ARM. On mine the blue LED is also out. The logic analyzer shows no activity on the servo pin. The FAST_PWM_FAN functionality for the LPC176x family was added by PR #13491 on 26 Mar 2019. Time to do more digging. So far all I know for sure is that I don't understand the servo includes nor what timer is used by the servo code. |
The problem might be that FAST_PWM_FAN_FREQUENCY either isn't set or is set too high. Try setting it to 50. At 300 the BLTouch deploys and stows but the blue LED is off when stowed. |
It would be nice to be able to set different PWM frequencies for different pins. 50Hz is great for servos, but is pretty flickery for RGB LEDs. |
My vote would be we need a PWM class that can be instantiated for any pin. It needs to be carefully coded so it doesn't burn a lot of CPU cycles regardless of how many pins are using it. It can't use much more program space than the current code uses. |
Thank you for your answers. I found the "#define FAST_PWM_FAN_FREQUENCY" in the Configuration_adv.h file and tried different frequencies. Then I tried 50 as you Bob-the-Kuhn suggested - an the BLTouch worked again - BUT with 50Hz my radial fans are quite noisy if throttled down (they are running around 15-20% most of the time). So at the moment it seems not to be possible to use the "FAST_PWM_FAN" on BIGTREETECH SKR V1.3. (I noticed that the blue led on the BLTouch seems to light up brighter when FAST_PWM_FAN is activated at high frequencies.) |
Did some more experiments. For my configuration FAST_PWM_FAN_FREQUENCY 600 still works. With 650 the BLTouch is able to deploy and restore the pin from the menu but "self testing" doesn't work. With 700 BLTouch doesn't react any more. Now I use FAN_SOFT_PWM instead of FAST_PWM_FAN. Still an annoying sound from the fan but a lot better than without. Would be great if some could find the problem and FAST_PWM_FAN can be used as it was possible with the ATMEGA2560. |
The "problem" is the LPC176x only has four timers which forces sharing of one timer for the servos and the FAST_PWM_FAN. I take it the 600 setting had a noise worse than the FAN_SOFT_PWM. |
Servos and I had a feeling adding that support would be more trouble than it was worth, but not everyone uses servos so I though allowing it for lights may be useful. |
My explanation was totally wrong. The LPC1768 family already has PWM on any pin. If the pin is hardare PWM capable then a hardware PWM channel is used. If not then timer 3 is used to provide a software PWM. Try the following file. It forces the fan pins onto the software PWM if FAST_PWM_FAN is enabled. That way the hardware PWMs and the software PWMs can have a difference base frequency. |
@p3p - as I understand/remember we have three basic types of PWMs:
Maybe the LEDs should also be forced onto the software PWM and the default should set to 60Hz or maybe even 120Hz. If FAST_PWM_FAN is enabled then they'd run at the faster rate. |
Thank you for your comment p3p. I think the BLTouch Probe is used by many marlin users as a reliable Z-Axis Probe. Is there any possibility to solve this issue? |
@DrNeis We try to fix everything in software around these parts because it helps the most people without requiring hardware modification, but the hardware solution to this is a capacitor across the fans power leads with a current limiting resistor, smoothing the PWM signal into a DC voltage the fans are happy with, although at low frequency it may not reduce the ripple enough. @Bob-the-Kuhn As a side not the Hardware channels can run at upto 25Mhz (although that only gives 1 bit of resolution ;) ) with no overhead. |
The old software PWM (PR #9004) did all the next interrupt calculations when the pin was attached which kept the ISR as a strictly table lookup routine. The comments indicate a 5uS minimum ISR execution time which means an absolute top limit of 10kHz. The more software PWM pins the slower it gets. 10KHz is still in the audible range so that approach probably isn't an improvement. It's also much more complicated.
Never mind - I forgot that there is only one timer/counter for all the hardware PWM modules on the LPC1768. DUE has a timer/counter for each module. |
@p3p I really appreciate your hard work! A hardware solution with something like a resistor would be no problem to implement, but I would like to use |
Interestingly enough my part cooling fan is perfectly happy with the 50Hz hardware PWM (as long as I set |
Here's some proof of concept code (ugly and not fully functional) on using the Motor Control PWMs if FAST_PWM_FAN is enabled. The biggest drawback is it can handle only 3 fan pins. It does generate 31.4kHz PWMs. Theoretically it has 256 settings but … The ISR execution time is 1.375uS. Since the period is 31.94uS in reality it's more like 10-20. The max setting has to be limited to about 90% or else ISR jitter will result in missed pulses. @p3p - if this is of interest I'll work on it some more. |
@Bob-the-Kuhn did you mean to post a link to the code? |
Yes I did. Here's the code. |
Just had this issue myself: was tinkering with various settings and went for a print and my hotend went straight through my new (today) bed material ): |
Yeah... I'm waiting for a Pull Request from you to fix the issue. |
Does it look like there will be any "fix" action on this? If not, though I'm not qualified to try to actually fix it like @Bob-the-Kuhn, I can do a pull request for a SanityCheck.h for this to at least prevent enabling both. Does this affect anything that uses a servo? If so, what other devices require a servo and thus should not be enabled if FAST_PWM_FAN is enabled? If not, it's just as simple as:
EDIT: if so, then:
right? |
@boelle I see this as a bug BUT it's caused by hardware limitations (ironically) and therefore not going to be resolved in that context. However ... Software PWM for servos will work if interrupt driven, to avoid gitter. (I'm guessing it's already interrupt based?) This would leave HW PWM for fans, LEDs and the like, where the frequency is not mission critical, as it certainly is for servos, where there's a definite and slow maximum allowable freq. SOFT_PWM_SCALE > 0 would reduce servo resolution, which is bad. So, some kind of convoluted exception would have to made there for the 32-bit MCUs. One approach would be to keep SW PWM interrupt always at some, "highest" frequency and switch to implementing the slower speeds in the ISR routine — skip if down counter > 0, sort of thing. This would be a terrible idea on a slow 8-bit MCUs but shouldn't be an issue on a 100 MHz 32-bit chip. Obviously, all the (presumably) ISR code's pulse width timing would need to be aware of this, in different ways than it likely is today. Doable but oh what a PITA and on what should have been an allround higher performance MCU. 🤷♂ FWIW, in my case the only issue is flickering case light LEDs! sigh |
i can confim this bug as of 22/08/2019. |
Should a check/warning be added if |
@DrNeis is the issue still there? |
Lack of Activity |
@boelle I also have the same problem mentioned above. As soon as i deactivate FAST_PWM_FAN it works again. |
someone needs to make the fix and send it in as a PR to 2.0.x marlin dev people are just like you and me, they dont get any money everyone can help, my code skills are not good enough, simple stuff i can do and if people tell me what file to edit and what needs to be changed |
I suggest a comment on FAST_PWM_FAN option to hint for this would be welcome, I had to backtrack a boatload of config changes until I found this was the reason why my bltouch stopped working. |
See #16038 |
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. |
Description
If I activate "#define FAST_PWM_FAN" in the most recent Version of Marlin 2.0 my BL Touch Probe stops working connected to my Board " BIGTREETECH SKR V1.3". The Probe shows blue LED always on and doesn't react to GCODE.
If i uncomment that line everything works fine again.
Steps to Reproduce
Expected behavior:
Fan should be silent if running on reduced Speed AND BL Touch should still work
Actual behavior:
Fans are silent, but BL Touch stops working.
The text was updated successfully, but these errors were encountered: