Firefly Open Source Community

   Login   |   Register   |
New_Topic
Print Previous Topic Next Topic

[Hardware] Firefly-RK3399 fan control

116

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
116

【Hardware】 Firefly-RK3399 fan control

Posted at 2/10/2019 03:31:14      View:7431 | Replies:2        Print      Only Author   [Copy Link] 1#
Last edited by abutkov In 2/10/2019 20:41 Editor

I noticed that according to schematics FAN_12V is switched with Q20 that is controlled by Q21 over BL_EN line. And the latter corresponds to GPIO1_A1. So if I export the correct gpio number I can write a simple script that reads temperature from /sys/class/thermal/thermal_zone0/temp and turns the fan on/off due to setpoint (t_high and t_low for hysteresis).
Supposing GPIO1_A1 should be 33 I do:
  1. echo 33 > /sys/class/gpio/export
  2. echo out > /sys/class/gpio/gpio33/direction
  3. echo 0 > /sys/class/gpio/gpio33/value
Copy the code
And see  the fan keeps turnung. Please correct me if I'm wrong with that idea or I just picked the wrong number for gpio.

UPD1: Seems I have to desolder 10K R702 from PWR_EN_SYS and put it on R701
Reply

Use props Report

116

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
116
Posted at 2/10/2019 23:40:20        Only Author  2#
Last edited by abutkov In 2/10/2019 20:43 Editor

It was a kind of surgery to perform soldering, I've lost original 0402 so had to put 0805 with wire
And finally it does work:
  1. #!/bin/bash

  2. FAN_ON_TEMP="39000"    # operating temperature range in milliC
  3. FAN_OFF_TEMP="35000"   # OFF is less than ON for hysteresis

  4. if [ ! -d /sys/class/gpio/gpio33 ];
  5.     then
  6.     echo 33 > /sys/class/gpio/export;
  7.     echo out > /sys/class/gpio/gpio33/direction;
  8. fi

  9. echo 1 > /sys/class/gpio/gpio33/value;

  10. while [ 1 ]; do
  11.   read CPUTEMP < /sys/class/thermal/thermal_zone0/temp
  12.   if [ "$CPUTEMP" -gt "$FAN_ON_TEMP" ]; then echo 1 > /sys/class/gpio/gpio33/value; fi
  13.   if [ "$CPUTEMP" -lt "$FAN_OFF_TEMP" ]; then echo 0 > /sys/class/gpio/gpio33/value; fi
  14.   sleep 30
  15. done
Copy the code
You can even create  a systemd service if you wish.
Reply

Use props Report

1396

Credits

0

Prestige

0

Contribution

vip

Rank: 6Rank: 6

Credits
1396
Posted at 2/12/2019 11:07:05        Only Author  3#
Great work! Thanks for sharing!
Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list