How to enable PWM in Ubuntu Server 18.04 Image

I followed the instructions available here:

I Installed rockchip-fstab and rockpi4-dtbo, edited /boot/hw_intfc.conf to set pwm0 and pwm1 to on, but after a reboot I am still getting that device is busy.

root@rockpi:/sys/class/pwm/pwmchip0# cat npwm 
root@rockpi:/sys/class/pwm/pwmchip0# echo 0 > export
-bash: echo: write error: Device or resource busy
root@rockpi:/sys/class/pwm/pwmchip0# echo 1 > export
-bash: echo: write error: No such device

I believe /boot/hw_intfc.conf is being ignored. Is there anywhere else that could set this?

My image is Ubuntu Server 18.04

Hi rodvlopes,

Can you provide the print of df?

And the print of ls -l /sys/class/pwm

root@rockpi:/sys/class/gpio/gpio146# df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/root       14722052   4297868   9785880  31% /
devtmpfs          985872         0    985872   0% /dev
tmpfs             986480         0    986480   0% /dev/shm
tmpfs             986480      2500    983980   1% /run
tmpfs               5120         0      5120   0% /run/lock
tmpfs             986480         0    986480   0% /sys/fs/cgroup
/dev/mmcblk1p4    102182     38844     63338  39% /boot
/dev/sda2      858090292 438977276 375501436  54% /mnt/sda2
tmpfs             197296         0    197296   0% /run/user/0

root@rockpi:/sys/class/gpio/gpio146# ls -l /sys/class/pwm
total 0
lrwxrwxrwx 1 root root 0 Jan 28  2018 pwmchip0 -> ../../devices/platform/ff420020.pwm/pwm/pwmchip0

Please execute the following command and let me know the result

cat /boot/hw_intfc.conf
sudo umount /boot
ls -al /boot
cat /boot/hw_intfc.conf

root@rockpi:~/workspace/scripts# cat /boot/hw_intfc.conf                                                                                               [27/29]
# Hardware Interface Config
# For more details, check

# Set "on" to enable the optional hardware interfaces while set "off" to disable.

# Devicetree Overlay Enable, uncomment to enable .dtbo under /boot/overlays/.
# EEPROM on I2C2
# Serial console on UART2
# Serial console on UART4
# Dummy spi device on SPI1 for test. Need set: intfc:spi1=on
# Dummy spi device on SPI2 for test. Need set: intfc:spi2=on
# PCIE running on GEN2 mode
# ALLNET 4duino B10/B11 two-coloe-led module on 40-pin Header Pin#35 and Pin#36
# waveshare 3.5inch lcd (B v2) on SPI1. Need set: intfc:uart4=off intfc:spi1=on

# waveshare 3.5inch lcd (C) on SPI1. Need set: intfc:uart4=off intfc:spi1=on

# spi flash on SPI1. Need set: intfc:uart4=off intfc:spi1=on


#hifiberry-dacplus on I2C7. Need set: intfc:i2c7=on

#enable raspberry pi official 7 inch LCD support

# setting cpu frequency over-2GHz

# Add imx219 camera module support. Need disabled ov5647 camera module.

# Add ov5647 camera module support. Need disabled imx219 camera module.

# Add w1 on GPIO4_D6 to support devices such as DS18B20.

root@rockpi:~/workspace/scripts# umount /boot
root@rockpi:~/workspace/scripts# ls -al /boot
total 8
drwxr-xr-x  2 root root 4096 Apr 24  2018 .
drwxr-xr-x 23 root root 4096 Jan 28  2018 ..

root@rockpi:~/workspace/scripts# cat /boot/hw_intfc.conf
cat: /boot/hw_intfc.conf: No such file or directory

Sorry for the late reply. You can try updating the kernel via:

sudo apt-get install linux-base
sudo apt-get install linux-4.4-latest

I dont have linux-4.4-latest yet but my kernel is exactly in this version. I will prepared a new SD card to test this change to avoid messing up my running server.

root@rockpi:~# dpkg --get-selections | grep linux-4.4-latest
root@rockpi:~# dpkg --get-selections | grep  linux-base
linux-base					install
root@rockpi:~# uname -a
Linux rockpi.localdomain 4.4.154-59-rockchip-g5e70f14 #4 SMP Fri Dec 14 20:55:41 CST 2018 aarch64 aarch64 aarch64 GNU/Linux

You can use to back up your system.