Using Vim3 pro with Ubuntu server image.

How can i use PWM on pin 35?

From docs i see PWM_F on pin 35.
are there any more?

I found this guide for odroid n2 (amlogic s922x) but it seems that none of the PWM is accessible:

I would appreciate the help.

Hello @rider

The PWM is disabled by default. You update the kernel to enable it.

khadas@Khadas:~$ wget
khadas@Khadas:~$ sudo dpkg  -i linux-dtb-amlogic-4.9_0.8.1_arm64.deb 
khadas@Khadas:~$ sudo reboot

Setup PWM_F:

khadas@Khadas:~$ sudo -i
[sudo] password for khadas: 
root@Khadas:~# echo 1 > /sys/class/pwm/pwmchip4/export 
root@Khadas:~# echo 1000000 > /sys/class/pwm/pwmchip4/pwm1/period 
root@Khadas:~# echo 500000 > /sys/class/pwm/pwmchip4/pwm1/duty_cycle 
root@Khadas:~# echo 1 > /sys/class/pwm/pwmchip4/pwm1/enable 

Disable PWM:

root@Khadas:~# echo 0 > /sys/class/pwm/pwmchip4/pwm1/enable 

Thanks, I will try and report back.
Are there any other gpio pwm lines in the 40 pin gpio header?

I don’t think so, maybe you can disable the cooling fan’s PWM pin and use it, but I’m not sure. Any Khadas Team’s developer could confirm it?

No, the FAN of VIM3 is controled by MCU.

You’re right. So PWM_F must be the only one exportable PWM pin on VIM3, what a pity…

Yes, there is only one hardware PWM, but you can use software PWM.
@Frank Please provide the software PWM of WiringPi.

1 Like

@antoniayza The soft PWM in wiringPi works fine . You can clone the lastest version .

1 Like

@numbqq @Frank Thanks to you both, I had not realise that I could use software PWM instead of hardware PWM. I will take it into account on future develops.


@numbqq I tried to do it on VIM3 with Android Pie V200103 but it didn’t work. Is it necessary to setup anything else?

Thanks in advance!

I test this on Ubuntu. You need to enable the PWM_F for android dts. Same to this:

1 Like

I want to continue in this thread only but for Vim1-v14 and Vim2-V14.

I want to add cooling fan support using mcu from vim3 dts and port it to vim1 and vim2 also.

Is anyone else working on the same and plan to upstream it ?

From the schematic I see that MCU is connected on i2c_B so adding it under this node will help but I am not able to find the register used.

Can someone hint me to the right register for vim1 and vim2 ?
for Vim3 I see that Neil used Reg 18 and IDK where did he get that information from.

Please advice. @hyphop