I would like to use the RTC functionality of the CM4 IO board, I'm trying to use PCF85063AT RTC, but it doesn't work.
Can you help me

Code: Select all
dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi
1) You know you can add many devices on a single I2C bus?walid yahia wrote: ↑Tue Jul 26, 2022 2:18 pm@PhilE
Thank you for your reply
I have three questions about rtc and fan:
1- How can I use other Gpios for rtc/fan, because of my hw design is using Gpios 44,55 for an other I2c peripheral ?
2- How to install fan to my CM4 ?
3- Is Linux managing the communication with rtc and fan on the same I2c bus ?
Thank you![]()
@aBUGSworstnightmare, thank you for replyaBUGSworstnightmare wrote: ↑Tue Jul 26, 2022 2:31 pm1) You know you can add many devices on a single I2C bus?walid yahia wrote: ↑Tue Jul 26, 2022 2:18 pm@PhilE
Thank you for your reply
I have three questions about rtc and fan:
1- How can I use other Gpios for rtc/fan, because of my hw design is using Gpios 44,55 for an other I2c peripheral ?
2- How to install fan to my CM4 ?
3- Is Linux managing the communication with rtc and fan on the same I2c bus ?
Thank you![]()
2) Do you have a fan controller? How should anyone know which fan you want to mount and how you intend to control it?
I have some of these https://www.waveshare.com/cm4-fan-3007-b.htm which do their job (but have not tested them to much).
3) a single I2C/SMB host can deal with 112 slaves! So yes, that's possible (and done on the CM4IO i.e.).
I2C_fan is a dedicated overlay for fan controllers - see https://github.com/raspberrypi/linux/bl ... ADME#L1585
Include "dtoverlay=i2c-fan,emc2301,i2c_csi_dsi" in your config.txt to enable the kernel fan controller driver (for fan controller IC used on CM4IO!).
Further parameters of minpwm (slowest pwm value 0-255 to run the fan at), maxpwm (max pwm value 0-255 to run the fan at), and midtemp and maxtemp to tune the fan speed vs temperature.
Kernel drivers and apps can share the same bus, but they can't share the same address on the same bus.aBUGSworstnightmare wrote: ↑Tue Jul 26, 2022 5:47 pmKernel driver and your app should not share the same I2C bus as this can cause conflicts.
Kernel drivers on the same bus are fine!
That's good,aBUGSworstnightmare wrote: ↑Tue Jul 26, 2022 5:47 pmKernel driver and your app should not share the same I2C bus as this can cause conflicts.
Kernel drivers on the same bus are fine!
"dtoverlay -h i2c-fan" gives you the help text, sourced from https://github.com/raspberrypi/linux/bl ... ADME#L1585walid yahia wrote: ↑Wed Jul 27, 2022 8:58 amThat's good,aBUGSworstnightmare wrote: ↑Tue Jul 26, 2022 5:47 pmKernel driver and your app should not share the same I2C bus as this can cause conflicts.
Kernel drivers on the same bus are fine!
looking to my base question "How to make rtc/fan work on pins other than 44, 45 ?"
Code: Select all
Params: addr Sets the address for the fan controller. Note
that the device must be configured to use the
specified address.
i2c0 Choose the I2C0 bus on GPIOs 0&1
i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
i2c3 Choose the I2C3 bus (configure with the i2c3
overlay - BCM2711 only)
i2c4 Choose the I2C3 bus (configure with the i2c3
overlay - BCM2711 only)
i2c5 Choose the I2C5 bus (configure with the i2c4
overlay - BCM2711 only)
i2c6 Choose the I2C6 bus (configure with the i2c6
overlay - BCM2711 only)
minpwm PWM setting for the fan when the SoC is below
mintemp (range 0-255. default 0)
maxpwm PWM setting for the fan when the SoC is above
maxtemp (range 0-255. default 255)
midtemp Temperature (in millicelcius) at which the fan
begins to speed up (default 50000)
midtemp_hyst Temperature delta (in millicelcius) below
mintemp at which the fan will drop to minrpm
(default 2000)
maxtemp Temperature (in millicelcius) at which the fan
will be held at maxrpm (default 70000)
maxtemp_hyst Temperature delta (in millicelcius) below
maxtemp at which the fan begins to slow down
(default 2000)
emc2301 Select the Microchip EMC230x controller family
- EMC2301, EMC2302, EMC2303, EMC2305.
Code: Select all
Params: abx80x Select one of the ABx80x family:
AB0801, AB0803, AB0804, AB0805,
AB1801, AB1803, AB1804, AB1805
bq32000 Select the TI BQ32000 device
ds1307 Select the DS1307 device
ds1339 Select the DS1339 device
ds1340 Select the DS1340 device
ds3231 Select the DS3231 device
m41t62 Select the M41T62 device
mcp7940x Select the MCP7940x device
mcp7941x Select the MCP7941x device
pcf2127 Select the PCF2127 device
pcf2129 Select the PCF2129 device
pcf85063 Select the PCF85063 device
pcf85063a Select the PCF85063A device
pcf8523 Select the PCF8523 device
pcf85363 Select the PCF85363 device
pcf8563 Select the PCF8563 device
rv1805 Select the Micro Crystal RV1805 device
rv3028 Select the Micro Crystal RV3028 device
rv8803 Select the Micro Crystal RV8803 device
sd3078 Select the ZXW Shenzhen whwave SD3078 device
s35390a Select the ABLIC S35390A device
i2c0 Choose the I2C0 bus on GPIOs 0&1
i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
i2c3 Choose the I2C3 bus (configure with the i2c3
overlay - BCM2711 only)
i2c4 Choose the I2C3 bus (configure with the i2c3
overlay - BCM2711 only)
i2c5 Choose the I2C5 bus (configure with the i2c4
overlay - BCM2711 only)
i2c6 Choose the I2C6 bus (configure with the i2c6
overlay - BCM2711 only)
addr Sets the address for the RTC. Note that the
device must be configured to use the specified
address.
trickle-diode-disable Do not use the internal trickle charger diode
(BQ32000 only)
trickle-diode-type Diode type for trickle charge - "standard" or
"schottky" (ABx80x and RV1805 only)
trickle-resistor-ohms Resistor value for trickle charge (DS1339,
ABx80x, RV1805, RV3028)
wakeup-source Specify that the RTC can be used as a wakeup
source
backup-switchover-mode Backup power supply switch mode. Must be 0 for
off or 1 for Vdd < VBackup (RV3028 only)
Code: Select all
i2c_gpio_sda GPIO used for I2C data (default "23")
i2c_gpio_scl GPIO used for I2C clock (default "24")
i2c_gpio_delay_us Clock delay in microseconds
(default "2" = ~100kHz)
Thank you for reply to my post @6by96by9 wrote: ↑Wed Jul 27, 2022 10:37 am"dtoverlay -h i2c-fan" gives you the help text, sourced from https://github.com/raspberrypi/linux/bl ... ADME#L1585walid yahia wrote: ↑Wed Jul 27, 2022 8:58 amThat's good,aBUGSworstnightmare wrote: ↑Tue Jul 26, 2022 5:47 pmKernel driver and your app should not share the same I2C bus as this can cause conflicts.
Kernel drivers on the same bus are fine!
looking to my base question "How to make rtc/fan work on pins other than 44, 45 ?"So add a parameter from that list to choose which I2C interface you wish to use.Code: Select all
Params: addr Sets the address for the fan controller. Note that the device must be configured to use the specified address. i2c0 Choose the I2C0 bus on GPIOs 0&1 i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 i2c3 Choose the I2C3 bus (configure with the i2c3 overlay - BCM2711 only) i2c4 Choose the I2C3 bus (configure with the i2c3 overlay - BCM2711 only) i2c5 Choose the I2C5 bus (configure with the i2c4 overlay - BCM2711 only) i2c6 Choose the I2C6 bus (configure with the i2c6 overlay - BCM2711 only) minpwm PWM setting for the fan when the SoC is below mintemp (range 0-255. default 0) maxpwm PWM setting for the fan when the SoC is above maxtemp (range 0-255. default 255) midtemp Temperature (in millicelcius) at which the fan begins to speed up (default 50000) midtemp_hyst Temperature delta (in millicelcius) below mintemp at which the fan will drop to minrpm (default 2000) maxtemp Temperature (in millicelcius) at which the fan will be held at maxrpm (default 70000) maxtemp_hyst Temperature delta (in millicelcius) below maxtemp at which the fan begins to slow down (default 2000) emc2301 Select the Microchip EMC230x controller family - EMC2301, EMC2302, EMC2303, EMC2305.
Similarly for "dtoverlay -h i2c-rtc"If you want the RTC on generic GPIOs with a bit-bashed I2C interface, then i2c-rtc-gpio is almost the same as i2c-rtc, but addsCode: Select all
Params: abx80x Select one of the ABx80x family: AB0801, AB0803, AB0804, AB0805, AB1801, AB1803, AB1804, AB1805 bq32000 Select the TI BQ32000 device ds1307 Select the DS1307 device ds1339 Select the DS1339 device ds1340 Select the DS1340 device ds3231 Select the DS3231 device m41t62 Select the M41T62 device mcp7940x Select the MCP7940x device mcp7941x Select the MCP7941x device pcf2127 Select the PCF2127 device pcf2129 Select the PCF2129 device pcf85063 Select the PCF85063 device pcf85063a Select the PCF85063A device pcf8523 Select the PCF8523 device pcf85363 Select the PCF85363 device pcf8563 Select the PCF8563 device rv1805 Select the Micro Crystal RV1805 device rv3028 Select the Micro Crystal RV3028 device rv8803 Select the Micro Crystal RV8803 device sd3078 Select the ZXW Shenzhen whwave SD3078 device s35390a Select the ABLIC S35390A device i2c0 Choose the I2C0 bus on GPIOs 0&1 i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45 i2c3 Choose the I2C3 bus (configure with the i2c3 overlay - BCM2711 only) i2c4 Choose the I2C3 bus (configure with the i2c3 overlay - BCM2711 only) i2c5 Choose the I2C5 bus (configure with the i2c4 overlay - BCM2711 only) i2c6 Choose the I2C6 bus (configure with the i2c6 overlay - BCM2711 only) addr Sets the address for the RTC. Note that the device must be configured to use the specified address. trickle-diode-disable Do not use the internal trickle charger diode (BQ32000 only) trickle-diode-type Diode type for trickle charge - "standard" or "schottky" (ABx80x and RV1805 only) trickle-resistor-ohms Resistor value for trickle charge (DS1339, ABx80x, RV1805, RV3028) wakeup-source Specify that the RTC can be used as a wakeup source backup-switchover-mode Backup power supply switch mode. Must be 0 for off or 1 for Vdd < VBackup (RV3028 only)
to allow you to define which GPIOs and at what speed.Code: Select all
i2c_gpio_sda GPIO used for I2C data (default "23") i2c_gpio_scl GPIO used for I2C clock (default "24") i2c_gpio_delay_us Clock delay in microseconds (default "2" = ~100kHz)
There isn't an equivalent GPIO based I2C overlay for i2c-fan at present.
Code: Select all
dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi
dtparam=minpwm=0,maxpwm=255,midtemp=60000,maxtemp=70000,midtemp_hyst=55000