beagleboard / linux

The official Read Only BeagleBoard and BeagleBone kernel repository https://git.beagleboard.org/beagleboard/linux
http://beagleboard.org/source
Other
722 stars 565 forks source link

Enable/Disable PWM in BBB Programmatically (C/C++) #151

Closed Soheilica closed 5 years ago

Soheilica commented 6 years ago

Hi,

Im using BeagleBoard Black and the question is:

How can I Enable / Disable PWM Pin on BBB programmatically (C/C++)?

For the moment I use system ("Config-pin Px:xx pwm") but it seems that after a reboot the PWM does Not run unless I manually go in the ocp folder and export manually the PWM.

Any thoughts are appreciated.

Thank you

RobertCNelson commented 6 years ago

@Soheilica correct after a reboot, you'll need to export the pwm.

I didn't answer you question on the forum because, I don't have a good "C/C++" answer for you, and you are really limiting your options.

The best way to use the pwm, is to use the adafruilt python library: https://github.com/adafruit/adafruit-beaglebone-io-python

Regards,

ericrini commented 5 years ago

I think it's confusing to say that the Python library is "the best" way to do anything. Perhaps it is the "easiest" or "most user-friendly" way. There are still valid reasons for wanting to understand how to do it in C. Especially if your application isn't written in Python.