[beagleboard] Re: PWM: changing Period of EHRPWM
Hi, In case someone still needs a solution to this problem, I've written a small kernel patch: ti_ehr_pwm.patch https://sites.google.com/site/avterekhov/ti_ehr_pwm.patch and a short description of how to apply it: https://randomlinuxhacks.wordpress.com/2014/09/16/changing-pwm-period-on-beaglebone-black/ So far it works for me. On Thursday, June 26, 2014 8:10:26 AM UTC+2, jmc...@gmail.com wrote: I also tried this and had no luck :-/ PWM on the BBB is turning out to be more work than I had thought. On Monday, January 6, 2014 12:13:37 PM UTC-8, Anto Dominic wrote: Thanks, Tried your trick even replaced the new dtbo file but even after that I am getting the default value for Period ( ie, 500) and duty (ie, 0) ... Is there any step that you missed in between...??. Anyways thanks for the tip..:) On Monday, 8 July 2013 08:44:54 UTC+5:30, tohr...@gmail.com wrote: Hello, you can change period by changing dtbo files. 1 Generate dts file from original dtbo file dtc -I dtb -O dts -o /lib/firmware/bone_pwm_P8_13-00A0.dts /lib/firmware /bone_pwm_P8_13-00A0.dtbo 2 Change period open file /lib/firmware/bone_pwm_P8_13-00A0.dts with editor at lines around line 26: pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 0x7a120 0x1; and change to following, for example change period to 10ns=0.1ms pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 10 0x1; where -3rd parameter of linepwms = ~ is period. -period (and other parameters) can be written in either decimal or hexadecimal of 0xABC format. -default period 0x7a120 is 500 in decimal. -As you mentioned, Both A and B output for one eHRPWM must have same period setting. If not, the second device will fail to setup at echo (device) /sys/devices/bone_capemgr.*/slots command. 3 Compile to new dtbo file dtc -O dtb -o bone_pwm_P8_13-00A0.dtbo -b 0 -@ bone_pwm_P8_13-00A0.dts You'd better back up original dtbo file before overwriting it. 4 Use new dtbo file. echo bone_pwm_P8_13 /sys/devices/bone_capemgr.*/slots 2013年6月4日火曜日 16時33分00秒 UTC+9 sultanof.ilo...@gmail.com: Hey, yes sure, duty must be (0 = duty = period). Otherwise you would try to to set a pwm duty cycle of less than 0% or more than 100%. Returning an error to the user is a proper way to handle this. As mentioned above EHRPWM1 and EHRPWM2 share the same base period (or respectively the base frequency). If I enable both PWM ouputs, writing to the period files always results in an error. Enabeling only one of the two outputs lets me change the periods. This does make sense after all. I assume the necessary crosschecking of the conditions (0 = duty = period) for related PWM outputs is simply not implemented yet or mayby just faulty. Am Montag, 3. Juni 2013 12:25:15 UTC+2 schrieb lawe...@gmail.com: Hi I'm just starting out, but here is what I found. Hopefully it can help you. The period must be greater than duty. This worked fine for me: echo 10 /sys/devices/ocp.2/pwm_test_P9_14.12/period Period is given in ns. Duty is given in ns on/off depending on polarity. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups BeagleBoard group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[beagleboard] Re: PWM: changing Period of EHRPWM
I also tried this and had no luck :-/ PWM on the BBB is turning out to be more work than I had thought. On Monday, January 6, 2014 12:13:37 PM UTC-8, Anto Dominic wrote: Thanks, Tried your trick even replaced the new dtbo file but even after that I am getting the default value for Period ( ie, 500) and duty (ie, 0) ... Is there any step that you missed in between...??. Anyways thanks for the tip..:) On Monday, 8 July 2013 08:44:54 UTC+5:30, tohr...@gmail.com wrote: Hello, you can change period by changing dtbo files. 1 Generate dts file from original dtbo file dtc -I dtb -O dts -o /lib/firmware/bone_pwm_P8_13-00A0.dts /lib/firmware/ bone_pwm_P8_13-00A0.dtbo 2 Change period open file /lib/firmware/bone_pwm_P8_13-00A0.dts with editor at lines around line 26: pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 0x7a120 0x1; and change to following, for example change period to 10ns=0.1ms pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 10 0x1; where -3rd parameter of linepwms = ~ is period. -period (and other parameters) can be written in either decimal or hexadecimal of 0xABC format. -default period 0x7a120 is 500 in decimal. -As you mentioned, Both A and B output for one eHRPWM must have same period setting. If not, the second device will fail to setup at echo (device) /sys/devices/bone_capemgr.*/slots command. 3 Compile to new dtbo file dtc -O dtb -o bone_pwm_P8_13-00A0.dtbo -b 0 -@ bone_pwm_P8_13-00A0.dts You'd better back up original dtbo file before overwriting it. 4 Use new dtbo file. echo bone_pwm_P8_13 /sys/devices/bone_capemgr.*/slots 2013年6月4日火曜日 16時33分00秒 UTC+9 sultanof.ilo...@gmail.com: Hey, yes sure, duty must be (0 = duty = period). Otherwise you would try to to set a pwm duty cycle of less than 0% or more than 100%. Returning an error to the user is a proper way to handle this. As mentioned above EHRPWM1 and EHRPWM2 share the same base period (or respectively the base frequency). If I enable both PWM ouputs, writing to the period files always results in an error. Enabeling only one of the two outputs lets me change the periods. This does make sense after all. I assume the necessary crosschecking of the conditions (0 = duty = period) for related PWM outputs is simply not implemented yet or mayby just faulty. Am Montag, 3. Juni 2013 12:25:15 UTC+2 schrieb lawe...@gmail.com: Hi I'm just starting out, but here is what I found. Hopefully it can help you. The period must be greater than duty. This worked fine for me: echo 10 /sys/devices/ocp.2/pwm_test_P9_14.12/period Period is given in ns. Duty is given in ns on/off depending on polarity. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups BeagleBoard group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[beagleboard] Re: PWM: changing Period of EHRPWM
Hi, the problem is a bug in pwm_test so that once you enabled two channels of the same ehrpwm you cannot change the period. Try look at http://saadahmad.ca/using-pwm-on-the-beaglebone-black/ https://github.com/SaadAhmad/beaglebone-black-cpp-PWM Il giorno lunedì 6 gennaio 2014 21:13:37 UTC+1, anto...@gmail.com ha scritto: Thanks, Tried your trick even replaced the new dtbo file but even after that I am getting the default value for Period ( ie, 500) and duty (ie, 0) ... Is there any step that you missed in between...??. Anyways thanks for the tip..:) On Monday, 8 July 2013 08:44:54 UTC+5:30, tohr...@gmail.com wrote: Hello, you can change period by changing dtbo files. 1 Generate dts file from original dtbo file dtc -I dtb -O dts -o /lib/firmware/bone_pwm_P8_13-00A0.dts /lib/firmware/ bone_pwm_P8_13-00A0.dtbo 2 Change period open file /lib/firmware/bone_pwm_P8_13-00A0.dts with editor at lines around line 26: pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 0x7a120 0x1; and change to following, for example change period to 10ns=0.1ms pwm_test_P8_13 { compatible = pwm_test; pwms = 0xdeadbeef 0x1 10 0x1; where -3rd parameter of linepwms = ~ is period. -period (and other parameters) can be written in either decimal or hexadecimal of 0xABC format. -default period 0x7a120 is 500 in decimal. -As you mentioned, Both A and B output for one eHRPWM must have same period setting. If not, the second device will fail to setup at echo (device) /sys/devices/bone_capemgr.*/slots command. 3 Compile to new dtbo file dtc -O dtb -o bone_pwm_P8_13-00A0.dtbo -b 0 -@ bone_pwm_P8_13-00A0.dts You'd better back up original dtbo file before overwriting it. 4 Use new dtbo file. echo bone_pwm_P8_13 /sys/devices/bone_capemgr.*/slots 2013年6月4日火曜日 16時33分00秒 UTC+9 sultanof.ilo...@gmail.com: Hey, yes sure, duty must be (0 = duty = period). Otherwise you would try to to set a pwm duty cycle of less than 0% or more than 100%. Returning an error to the user is a proper way to handle this. As mentioned above EHRPWM1 and EHRPWM2 share the same base period (or respectively the base frequency). If I enable both PWM ouputs, writing to the period files always results in an error. Enabeling only one of the two outputs lets me change the periods. This does make sense after all. I assume the necessary crosschecking of the conditions (0 = duty = period) for related PWM outputs is simply not implemented yet or mayby just faulty. Am Montag, 3. Juni 2013 12:25:15 UTC+2 schrieb lawe...@gmail.com: Hi I'm just starting out, but here is what I found. Hopefully it can help you. The period must be greater than duty. This worked fine for me: echo 10 /sys/devices/ocp.2/pwm_test_P9_14.12/period Period is given in ns. Duty is given in ns on/off depending on polarity. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups BeagleBoard group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.