bluehash 1,581 Posted May 27, 2013 Share Posted May 27, 2013 From phys-x.org. So a big thanks for how to write PWM on the BeagleBone Black forums. It just goes to show how we need to get more tutorials and examples on the web for programming the BeagleBone Black. So I adapted the post here: https://groups.google.com/forum/#!category-topic/beagleboard/beaglebone-black/wjbOVE6ItNg to write a 50 Hz signal with 50% duty cycle, units when you right to file are in nanoseconds. If it is the first time you are setting things up you need to setup the filesystem, note specific numbers will change so please double check your directory structure # echo am33xx_pwm > /sys/devices/bone_capemgr.9/slots Note this will be for pin 13 on header P8 # echo bone_pwm_P8_13 > /sys/devices/bone_capemgr.9/slots Now write out the period and duty. Clearly this would be easy in python, c++, etc., just seems a pain to make a general purpose library. # echo 20000000 > /sys/devices/ocp.2/pwm_test_P8_13.15/period so 20000000= 0.02 seconds # echo 10000000 > /sys/devices/ocp.2/pwm_test_P8_13.15/duty so 10000000 = 0.01 seconds Quote Link to post Share on other sites
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.