Verdin PWM example pwmchip permission denied

Hi,
I try to get the pwm example in c running from your git examples repo.

I already had issues to export the pwmchip to sysfs as described here: PWM (Linux) | Toradex Developer Center

“echo 0 > export” throws a permission denied. I found out that “sudo sh -c 'echo 0 > export” works and I ended up having command line control over the pwm channel. An LED at the output works fine…

However, I want to control the pwm channels from my application and there the export write gives my the following error:

Error Number 30

pwm: Read-only file system

failed to export

Is there a pwm usergroup I need to add the torizon user to in the buildcommands?
Or am I missing something in the general concept?

Thanks in advance!

Jan

Greetings @jan380,

It sounds like you’re not running this in a container, or are you? I’m asking since you mentioned running “sudo” which isn’t available in a container but is available on the host TorizonCore OS.

In any case to use PWM in a container on Torizon please see the article here: How to Use PWM on TorizonCore | Toradex Developer Center

As stated in the article there’s a certain way you have to bindmount the PWM interface into as to not have a “read-only” error. Otherwise though there should be no user-groups required for PWM access.

Best Regards,
Jeremias

Hi,
I followed the tutorial but got:

docker run -it --rm -v /sys:/sys pwm-sample
WARNING: The requested image’s platform (linux/arm) does not match the detected host platform (linux/amd64) and no specific platform was requested
Error Number 2
pwm: No such file or directory
failed to export

Could you please advise ?
Best regards,

Hi @ducnn ,

Although your issue is related to PWM, it seems different from the one found in this topic. Can you open a new community topic detailing:

  • The module you’re using;
  • The carrier board you’re using;
  • The TorizonCore version installed; (you can see it by running cat /etc/os-release on the module)
  • A step-by-step explanation of what you did before the error message appeared.

Best regards,
Lucas Akira

Hi Lucas,
I have raised a proper post for it:

I will update this information.