-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fan PWM Troubleshooting / Timer Investigation #26
Comments
I don't know if the issue I'm having is connected to this but it sounds like it is. If I run a m106 command FAN0 does not turn on however FAN0 led does light up. The voltage at the fan terminal after a m106 s255 is 1.39 and s128 is .93, s0 is .10 |
Hi @phongshader, The problem you're describing is the reason I started looking into this. However, I've found the fan issue is not related to any of the above, but is an issue with the PWM frequency+resolution in 1.7.0 of the Arduino Core (which is the version ProjectIO + Marlin currently uses). When ProjectIO and Marlin update to use v1.9 this issue should be fixed. In the meantime, the best way to get fans running correctly is to use Marlin's |
Collecting information for troubleshooting why PWM on FAN (PC9) isn't outputting the expected values when running Marlin bugfix-2.0.x.
Suspect there is a conflict somewhere / the same timer is being used in multiple places or something to that effect.
Timers in use
Checking everywhere timers are configured/selected.
STM32 Arduino Core
RUMBA32_F446VE/variant.h:
SoftwareSerial/src/SoftwareSerial.cpp
RUMBA32_F446VE/PeripheralPins.c (enabled pins only):
Marlin
STM32/timers.cpp:
Timer Reference
Timer Mapping
Current Mapping
PA8 (CH1)
PA9 (CH2)
PA10 (CH3)
PA11 (CH4)
PA0 (CH1)
PA5 (CH1)
PA15 (CH1)
PB2 (CH4)
PB3 (CH2)
PB10 (CH3)
PB4 (CH1)
PB5 (CH2)
PC6 (CH1)
PC8 (CH3)
PB6 (CH1)
PB7 (CH2)
PB8 (CH3)
PA1 (CH2)
PB0 (CH2)
PB1 (CH3)
PC7 (CH2)
PC9 (CH4)
PB9 (CH1)
PB14 (CH1)
PB15 (CH2)
PA5 (CH1)
PA7 (CH1)
As noted above, there are several conflicts.
Many of the pin PWM conflicts likely do not arise / are not noticed because PWM is actually only enabled and used on a few pins. Could cut back PWM config to only required pins which would remove all conflicts and free up a few timers. Nice to have PWM available on all pins possible, so should trim this back with the goal of keeping as many PWM pins as possible.
Servo and SoftwareSerial conflict is mentioned elsewhere. Likely not always noticed as SoftwareSerial is only used if enabled (for example, TMC2208/2209 drivers). Servo is probably not always used/enabled either, most common application is probably BLTouch sensors. Should remap one of these.
Tone is probably overridden by Marlin step timer setup and doesn't work after that. Probably not used often / not noticed. Should remap one of these.
Interestingly, there is no obvious conflict with the fan PWM / PC9. It may be behaving oddly because of the other conflicted channel mapping on TIM8. Will have to check if resolving all above solves problem.
Proposed Changes
PWM pin allocation can only be changed by updating the STM32Duino Core.
Timers for Tone and Servo can only be changed by updating the STM32Duino Core.
Timers for SoftSerial, Step and Temp can be changed in Marlin (for instance in RUMBA32 pins file) or in STM32DuinoCore.
Updating Marlin will be faster, assuming changes get pulled into bugfix-2.0.x branch. STM32Duino Core changes will only take effect for most users on next release / when PlatformIO incorporates next release.
Suggest moving Step Timer to currently available
TIM10
. Should be done in Marlinpins_RUMBA32.h
file to fix ASAP.Suggest moving SoftSerial to currently available
TIM9
. Should be done in Marlinpins_RUMBA32.h
file to fix ASAP. Should also be addressed in STM32Duinovariant.h
so non-Marlin projects do not have to deal with same problem.PA5
andPA7
areSPI1_SCK
andSPI1_MOSI
. These do not need PWM. Removing these freesTIM13
and fixes conflict onTIM14
. Other PWM pins should be checked for conflicts and reassigned or removed as necessary. Needs to be done in STM32Duino Core.So, should result in a PR for both Marlin and STM32Duino Core.
PA8 (CH1)
PA9 (CH2)
PA10 (CH3)
PE14 (CH4)
PA15 (CH1)
PB2 (CH4)
PB3 (CH2)
PB10 (CH3)
PC6 (CH1)
PC7 (CH2)
PC8 (CH3)
PC9 (CH4)
PD12 (CH1)
PD13 (CH2)
PD14 (CH3)
PD15 (CH4)
PA0 (CH1)
PA1 (CH2)
PA2 (CH3)
PA3 (CH4)
PB14 (CH1)
PB15 (CH2)
Other References
Issue about softwareserial / servo conflict here: stm32duino/Arduino_Core_STM32#731
The text was updated successfully, but these errors were encountered: