That’s a shame… My script simply sets GPIO8 high/low and that sets the SATA 12v on/off. But I do have another script which actually generates PWM using core-utils sleep #!/bin/sh
function gpiopwm() {
sleep_low=$(awk -v freq="$2" -v duty="$3" 'BEGIN{print (1/freq)*((100-duty)/100)}')
sleep_high=$(awk -v freq="$2" -v duty="$3" 'BEGIN{print (1/freq)*((100-(100-duty))/100)}')
echo "low $sleep_low high $sleep_high"
var_count=0
repeat=1000
while [ $var_count -lt $repeat ]
do
echo 1 > /sys/class/gpio/gpio$1/value
sleep $sleep_high
echo 0 > /sys/class/gpio/gpio$1/value
let var_count=var_count+1
if [ $var_count -le $repeat ]
then
sleep $sleep_low
fi
done
}
echo 419 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio419/direction
lastcpu=0
duty=15
gpiopwm 419 20 10
echo "finished 10"
gpiopwm 419 20 90
Already tested, It works great. The frequency is not that high . All you have to do is to connect the SATA 12V to the fan VCC, no need to connect anything to the pwm input