adafruit / Adafruit_CircuitPython_EMC2101

CircuitPython driver for EMC2101 brushless fan controller
MIT License
3 stars 9 forks source link

Fan speed saturates at 75% #19

Closed stoklund closed 2 years ago

stoklund commented 2 years ago

I was testing a Noctua NF-A4x20 PWM fan with Adafruit's EMC2101 breakout board and noticed that the fan speed maxes out at 5000 rpm already at a 75% manual fan speed setting:

pwm_rpm.pdf

I first thought this was a property of my fan, but reading the EMC2101 data sheet, I noticed:

  1. The PWM Frequency Register PWM_F defaults to 0x17 after reset, not the maximum and recommended 0x1f.
  2. The PWM duty cycle is determined by both the Fan Setting Register and the PWM_F register. From Appendix A: DUTY_CYCLE = FAN_SETTING / (PWM_F * 2) * 100%.

The manual_fan_speed property is using MAX_LUT_SPEED as a divisor instead of PWM_F * 2. This means that the actual PWM duty cycle reaches 100% at emc.fan_speed = PWM_F * 2 / MAX_LUT_SPEED which is about 73%, matching my graph.

The divisor in the manual_fan_speed functions should be PWM_F * 2 when running in PWM mode and 64 in DAC mode. This should also cause more trouble when setting the pwm_frequency property, although I haven't tried that yet.

I'll put together a PR for this.

ladyada commented 2 years ago

ok! this chip is surprisingly complex - thanks for any PR :)