How to use PWM from user space

Hi,

could you confirm that to use PWM from user space in a C language project, the only mode is throught sysfs interface ? I’m using BSP (not Torizon) “Toradex Embedded Linux Reference Multimedia Image (UPSTREAM) 6.2.0+build.6”.

Thanks

Hello @Massimo,

May I know what exactly is your use-case here?
Are you facing any issues in accessing the PWM through sysfs interface?

Hello Rudhi,

accessing PWM using sysfs from C program works fine, but it is slow for our application.
I verifyed that only to change the PWM period, it take about 100 microseconds.

Is there another method to speed up PWM control ?

Hello @Massimo ,
You mention that 100us is slow. May we know your timing requirements?
Maybe you can improve the timing by doing it in the kernel (developing a driver).
Also, we would like to know how you are measuring the time , so that we exclude that you are measuring the time it takes to open the sysfs file and then write (if you’re worried about speed you should keep the file open and just write to it when needed)

Best regards,
Josep