Title: Hardware pwm in user space [Print This Page] Author: Key Time: 12/18/2015 05:33 Title: Hardware pwm in user space Hi there http://wiki.t-firefly.com/index.php/Firefly-RK3288/PWM/en
That guide describes only kernel space.
How to control hardware pwm in user space?
/sys/class/pwm doesn't exist
Is there a way to enable sysfs pwm interface?
ThanksAuthor: zhansb Time: 12/18/2015 08:59
there is no ready-made pwm in user space£¬ need to write interface by youself, just like the backlight's.Author: Key Time: 12/20/2015 20:06
ok. i did it. I wrote a linux kernel module. when I tried insmode i got error in function pwm_config: Unable to handle kernel paging request at virtual address fffffe0b
dmesg
What is wrong?Author: zhansb Time: 12/23/2015 08:59
[ 1716.354256] [<c028a3f4>] (pwm_config+0x40/0x60) from [<bf036050>] (x_init+0x50/0xc0 [sysfs])
[ 1716.362695] [<bf036050>] (x_init+0x50/0xc0 [sysfs]) from [<c00086a4>] (do_one_initcall+0x34/0xc8)
make sure your pwm0 is not NULL.Author: Key Time: 12/23/2015 18:11
pwm_request() used to return bad structure because device name was incorrect .
Thank you for your answers , but i have some more questions)
1. In dts file I found, that pwm1 used by pwm_regulator. Is it safe to disable this device?
2. Is it possible to use pwm2 and pwm3? How to assign them with the pins?
P.S. sorry for my bad english
Author: zhansb Time: 12/25/2015 09:21
pwm_regulator is disabled, pwm1 can be used by yourself.
pwm2 and pwm3 can also be used, enable them in dts file as pwm1.Author: Key Time: 12/28/2015 05:51 Last edited by Key In 12/28/2015 05:53 Editor
I need to achieve 10000 microseconds period.
pwm_config(1000000,10000000) didn't work(
How to change timer resolution?Author: Key Time: 12/29/2015 17:43
ok. prescale parameter is calculating in pwm-rockchip driver automatically. there is no reason to recalculate.
but...
When I set a period more than 850 microseconds, something strange is happening.
For example I set a period of 900 microseconds(pwm_config(500000,900000)). but according to oscilloscope real period is 450 microseconds. Is there a way to fix it?Author: madman Time: 1/4/2016 11:05
Hi,
You can use this pwm-rockchip.c (see attachment) to replace the /kernel/drivers/pwm/pwm-rockchip.c, then recompile, this is can be normal use, the main reason is that # define PWMDCR_MAX_DUTY length is too small¡£
madman Posted at 1/4/2016 11:05
Hi,
You can use this pwm-rockchip.c (see attachment) to replace the /kernel/drivers/pwm/pwm-rockchi ...
hi, madman. it's not working(
I got 670 microsends period with pwm_config parameters: duty: 1600000, period: 2000000...
P.S. I tried to put the printk("test_pwm\n") code in each pwm_config function in pwm-rockchip.c, but the message didn't appear in dmseg... wtfAuthor: madman Time: 1/13/2016 17:09
hi£¬
I add printk in the probe£¬it can pritk. use pwm will use this function,
--- a/kernel/drivers/pwm/pwm-rockchip.c
+++ b/kernel/drivers/pwm/pwm-rockchip.c
@@ -630,6 +630,7 @@ static int rk_pwm_probe(struct platform_device *pdev)
struct rk_pwm_chip *pc;
int ret;