Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When I ran the smoke test for the ADT7476A, and then measured the output PWM signal, the signal was a constant 3.3 V instead of the duty cycle increasing by 10 % every second. I confirmed that the correct commands were being transmitted using an oscilloscope on the SDA and SCL signals. I noticed that the commands being sent were in the form device address, register address, device address, value (more on this later). After looking at the code for a bit, I decided to use the I2C smoke test instead to validate the ADT7476A because it’s much simpler. For the first step, I tried writing to a register and reading it back. I initially used the PWM 1 duty cycle register, but it appears to be locked since the value wasn’t changing. I was able to successfully read the default value 0xFF. Instead, I tried writing to the configuration register because I happened to notice in the datasheet that it has a start STRT bit that must be set to 1 to enable monitoring of the fan speeds. Otherwise, it sets the fans to 100% for safety reasons. I was able to write to this register and read the result after a few tries. I found out that even though registers are being written to, the i2c_write_reg command cannot be used and the regular i2c_write command must be used instead. This is because the device is expecting commands in the form device address, register address, data, but the i2c_write_reg command writes data using the form mentioned previously. I suspect this is caused by the fact that the device is designed to use SMBus, which is compatible with I2C, but not the same. Despite writing to this register, I was still unable to write to the PWM signal register. At this point, I looked back at the ADT7476A smoke test and was reminded that the PWM configuration register needs to be configured to allow for manual control of the fan, which it is not by default. So after writing the correct value to this register, I was able to write to the PWM duty cycle register. I then validated that the actual PWM output was consistent with the value written to the register by measuring it with an oscilloscope. Now that changing the PWM duty cycle is working, I decided to experiment with changing some values and checking the result to confirm which factors allow or prevent changing the PWM duty cycle.

Expand
titleHere’s a list of observations that may or may not be useful:
  1. If the start STRT bit in the configuration register is set to 0, the PWM duty cycle register cannot be written to, however there appears to be a buffer register because after attempting to write to the PWM duty cycle register and then setting the start STRT bit back to 1, the PWM duty cycle is automatically updated with the value.

  2. Setting the full speed bit of the configuration register doesn’t change the value in the PWM duty cycle register.

  3. Setting the mode to something other than manual mode does change the value in the PWM duty cycle register. The value is set back to the original value once the mode is set back to manual mode.

To read the tachometer registers after the device has been powered on, the STRT bit in the configuration register needs to be set to 1 and the upper byte must be read first because the device automatically reads the lower byte to lock the register. Once doing these two things, I was able to read the tachometer measurements from a digital waveform generator.

Expand
titleThis table summarizes the tachometer measurements.

Waveform Frequency

Imitated Fan Speed

Tachometer Value

Tachometer RPM

Error

100 Hz

3,000 RPM

0x0710

2,986.73 RPM

0.44 %

200 Hz

6,000 RPM

0x0388

5,973.45 RPM

0.44 %

100 kHz

3,000,000 RPM

0x0171

14,634.15 RPM

99.51 %

This is faster than the internal clock frequency (90 kHz), so it’s expected that the results are wrong.