Welcome! Log In Create A New Profile

Advanced

Change fan PWM frequency

Posted by matthick 
Change fan PWM frequency
June 08, 2016 04:35AM
Hi guys,

I would like to connect a 4wire fan to the fan output of my Rumba board. This type of fan use a 25000Hz PWM control and is thus not compatible to the 5Hz PWM of the Rumba board fan output. Does anybody know how to change the Marlin Firmware in order to get a 25000Hz PWM output instead of 5Hz?
If you check on the Marlin_main.cpp, the following lines which might be changed? :

#ifdef FAST_PWM_FAN
void setPwmFrequency(uint8_t pin, int val)
{
val &= 0x07;
switch(digitalPinToTimer(pin))
{

#if defined(TCCR0A)
case TIMER0A:
case TIMER0B:
// TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02));
// TCCR0B |= val;
break;
#endif

#if defined(TCCR1A)
case TIMER1A:
case TIMER1B:
// TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
// TCCR1B |= val;
break;
#endif

#if defined(TCCR2)
case TIMER2:
case TIMER2:
TCCR2 &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
TCCR2 |= val;
break;
#endif

#if defined(TCCR2A)
case TIMER2A:
case TIMER2B:
TCCR2B &= ~(_BV(CS20) | _BV(CS21) | _BV(CS22));
TCCR2B |= val;
break;
#endif

#if defined(TCCR3A)
case TIMER3A:
case TIMER3B:
case TIMER3C:
TCCR3B &= ~(_BV(CS30) | _BV(CS31) | _BV(CS32));
TCCR3B |= val;
break;
#endif

#if defined(TCCR4A)
case TIMER4A:
case TIMER4B:
case TIMER4C:
TCCR4B &= ~(_BV(CS40) | _BV(CS41) | _BV(CS42));
TCCR4B |= val;
break;
#endif

#if defined(TCCR5A)
case TIMER5A:
case TIMER5B:
case TIMER5C:
TCCR5B &= ~(_BV(CS50) | _BV(CS51) | _BV(CS52));
TCCR5B |= val;
break;
#endif

}
}
#endif //FAST_PWM_FAN


Any ideas?
Thank you!

Matthias
Sorry, only registered users may post in this forum.

Click here to login