andrea9nta
Posts: 2
Joined: Mon Apr 05, 2021 3:35 pm

Compute Module 4 IO Board Fan

Mon Apr 05, 2021 4:16 pm

Hi all!
I want to regulate the speed of a fan connected to the fan header of my compute module 4 io board. From the datasheet I've read that it's connected to a EMC2301 chip but I cannot figure out how to control it. I am using the raspbian lite OS with rebuilt kernel (64bit and sata support).

Thanks in advance to all

aBUGSworstnightmare
Posts: 2653
Joined: Tue Jun 30, 2015 1:35 pm

Re: Compute Module 4 IO Board Fan

Tue Apr 06, 2021 5:51 am

It's controlled via PWM. The EMC2301 (https://www.microchip.com/wwwproducts/en/EMC2301 ) sits on the I2C bus .
It has two addresses: 0x0c is the alert response address of SMBBus (0001_100xb); device address is 0x2f (0101_111(r/w)b)

With 'dtparam=i2c_vc=on' added to config.txt I get below from the CM4IO

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --     
the data sheet has the details on the device. Sorry, but don't know if there is a kernel driver for the PWM controller.

Icarus_Radio
Posts: 4
Joined: Sat Apr 03, 2021 6:02 am

Re: Compute Module 4 IO Board Fan

Wed Apr 07, 2021 3:12 am

aBUGSworstnightmare wrote:
Tue Apr 06, 2021 5:51 am
It's controlled via PWM. The EMC2301 (https://www.microchip.com/wwwproducts/en/EMC2301 ) sits on the I2C bus .
It has two addresses: 0x0c is the alert response address of SMBBus (0001_100xb); device address is 0x2f (0101_111(r/w)b)

With 'dtparam=i2c_vc=on' added to config.txt I get below from the CM4IO

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --     
the data sheet has the details on the device. Sorry, but don't know if there is a kernel driver for the PWM controller.
It seems that Linux has a PWM interface (https://www.kernel.org/doc/html/latest/ ... i/pwm.html). I am wondering how to control the fan as well. Any help is appreciated.

aBUGSworstnightmare
Posts: 2653
Joined: Tue Jun 30, 2015 1:35 pm

Re: Compute Module 4 IO Board Fan

Wed Apr 07, 2021 6:40 am

Icarus_Radio wrote:
Wed Apr 07, 2021 3:12 am
aBUGSworstnightmare wrote:
Tue Apr 06, 2021 5:51 am
It's controlled via PWM. The EMC2301 (https://www.microchip.com/wwwproducts/en/EMC2301 ) sits on the I2C bus .
It has two addresses: 0x0c is the alert response address of SMBBus (0001_100xb); device address is 0x2f (0101_111(r/w)b)

With 'dtparam=i2c_vc=on' added to config.txt I get below from the CM4IO

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --     
the data sheet has the details on the device. Sorry, but don't know if there is a kernel driver for the PWM controller.
It seems that Linux has a PWM interface (https://www.kernel.org/doc/html/latest/ ... i/pwm.html). I am wondering how to control the fan as well. Any help is appreciated.
if you simply want to have it temperature controled simply enable that feature. 'Controlling' it has a different understanding to me.

andrea9nta
Posts: 2
Joined: Mon Apr 05, 2021 3:35 pm

Re: Compute Module 4 IO Board Fan

Wed Apr 07, 2021 2:27 pm

By 'Controlling' I mean adjust automatically the speed of the fan in relation of temperature. If this is not possible it would be fine to only adjust it to a speed lower than 100%.


aBUGSworstnightmare
Posts: 2653
Joined: Tue Jun 30, 2015 1:35 pm

Re: Compute Module 4 IO Board Fan

Thu Apr 08, 2021 5:44 am

Temperature control is avaialble from the OS; open Raspi Config and enable it. The default GPIO setting should not be changed for the CM4IO, so you only need to set the temp level when the fan kicks in.

If you want your own profile use the kernel driver.

Return to “Compute Module”