Can I use Mraa by user privilege?

I’d like to use PWM by user mode, not root. For now, it works by root, and the error of ‘Failed to initialize PWM’ occurs by user like “rock”. The board is Rockpi S.

Thanks in advance.

Hi, have you found a solution already?

I found a working solution at last!

First , create a group and add the user that needs access to the GPIOs to it (this is for the current user;
replace $USER with an explicit username if you want).

sudo groupadd gpio

sudo usermod -a -G gpio $USER

Now reboot

Second , add the following lines to /etc/rc.local (you will have to edit it as root, using sudo vi or whatever).
chown -R root:gpio /sys/class/gpio

chmod -R ug+rw /sys/class/gpio

Third , create a new udev rule in a file, say /etc/udev/rules.d/80-gpio-noroot.rules (you will have to edit it as root again):

# /etc/udev/rules.d/80-gpio-noroot.rules

# Corrects sys GPIO permissions on the Joule so non-root users in the gpio group can manipulate bits

# Change group to gpio

SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chown -R root:gpio /sys/devices/platform/INT34D1:*/gpio'"

# Change user permissions to ensure user and group have read/write permissions

SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chmod -R ug+rw /sys/devices/platform/INT34D1:*/gpio'"

Fourth , reboot or restart udev using
sudo udevadm trigger --subsystem-match=gpio

And finally test:
mraa-gpio get 16

The first call will not do anything but set up the GPIO, so the value will be -1, but following calls should work. And return a value between 0-1.

Sorry for my very late reply and thunk you for the solution.
Finally, I gave it up and used the sudo command. It took much time to remove root privilege related errors.