Page 1 of 1

CM3588: CPU Fan

Posted: Tue Jan 09, 2024 7:21 pm
by inf
I have connected the ZH1.5-2pin connector to the 5V CPU fan socket to a 40mm fan, however the fan does not turn on.

The fan works fine when powered from GPIO pins.

I've checked the voltage across 5V pins and it was only 0.10V.

Does this CPU fan need to be activated via /sys or GPIO somehow?

Thanks

Re: CM3588: CPU Fan

Posted: Sun Jan 14, 2024 1:32 pm
by yaazzz
This is making the trick for me :

Code: Select all

echo 59 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio59/direction
echo 1 > /sys/class/gpio/gpio59/direction


Should probably create a /etc/init.d for that?

Regards.

Re: CM3588: CPU Fan

Posted: Sun Jan 14, 2024 4:56 pm
by inf
yaazzz wrote:
This is making the trick for me :

Code: Select all

echo 59 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio59/direction
echo 1 > /sys/class/gpio/gpio59/direction


Should probably create a /etc/init.d for that?

Regards.


Thank you for that, curious where did you find which GPIO pin to use?

I'm also curious to know how /sys/class/gpio/gpioXX maps to the pin# on 40-pin GPIO stack.

Also slight correction to your script:

Code: Select all

echo 59 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio59/direction
echo 1 > /sys/class/gpio/gpio59/value

Re: CM3588: CPU Fan

Posted: Sun Jan 14, 2024 9:22 pm
by yaazzz
I made it using the schematic and the formula found on a rk3588 wiki :
pin = bank*32 + group*8 + number;

GPIO1_D3 => Bank 1 pin
bank=1 => 1*32
group ∈ {(A=0), (B=1), (C=2), (D=3)} => group = 8*3 = 24

pin = 1*32 + 8*3 + 3 = 59

We are now at the same level ;)

Re: CM3588: CPU Fan

Posted: Mon Jan 15, 2024 12:07 am
by inf
yaazzz wrote:
I made it using the schematic and the formula found on a rk3588 wiki :
pin = bank*32 + group*8 + number;

GPIO1_D3 => Bank 1 pin
bank=1 => 1*32
group ∈ {(A=0), (B=1), (C=2), (D=3)} => group = 8*3 = 24

pin = 1*32 + 8*3 + 3 = 59

We are now at the same level ;)


Thank you

Re: CM3588: CPU Fan

Posted: Sun Jan 21, 2024 10:57 am
by yaazzz
Here is the code I use to start the fan at startup. Probably usefull for all of the CM3588 users.

1 - Create a new init.d script, for example, /etc/init.d/gpio_setup:

Code: Select all

sudo nano /etc/init.d/gpio_setup


2. Add the following content to the script:

Code: Select all

#!/bin/sh
### BEGIN INIT INFO
# Provides:          gpio_setup
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Set up GPIO 59 as output with value 1
# Description:       Set up GPIO 59 as output and set its value to 1 during system startup.
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="GPIO setup script"
NAME=gpio_setup
DAEMON=/usr/local/bin/gpio_setup.sh

case "$1" in
  start)
    echo "Setting up GPIO 59 as output with value 1..."
    $DAEMON
    ;;
  stop)
    # No need to stop anything in this example
    ;;
  restart|force-reload)
    echo "Restarting GPIO setup script..."
    $DAEMON
    ;;
  *)
    echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0


3. Save the file and exit the text editor.

4. Now, create the script that actually sets up the GPIO. Create a file named /usr/local/bin/gpio_setup.sh:

Code: Select all

sudo nano /usr/local/bin/gpio_setup.sh


5. Add the following content to the script:

Code: Select all

#!/bin/bash

# GPIO number
GPIO_NUMBER=59

# Set GPIO 59 as output
echo $GPIO_NUMBER > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$GPIO_NUMBER/direction

# Set the value to 1
echo 1 > /sys/class/gpio/gpio$GPIO_NUMBER/value

exit 0


6. Save the file and exit the text editor.

7. Make the init.d script and the setup script executable:

Code: Select all

sudo chmod +x /etc/init.d/gpio_setup
sudo chmod +x /usr/local/bin/gpio_setup.sh


8. Register the init.d script to start during the system boot:

Code: Select all

sudo update-rc.d gpio_setup defaults

Re: CM3588: CPU Fan

Posted: Tue Apr 23, 2024 9:46 pm
by Gimli
This solution worked great on my CM3588 NAS kit. Thank you both for your contribution!