Hello mar0ni,
I'm trying your last script with a NanoPiM4v2, but bash gives me the following error:
/usr/bin/start-rk3399-pwm-fan-v2.sh: line 33: echo: write error: Invalid argument
But I can't find the problem in your code.
Any idea ?
EDIT:
I had to add quotes around the file path:
echo $DUTY > "/sys/class/pwm/pwmchip1/pwm0/duty_cycle";
It's working great now !