PWM in beagle bone black

665 views
Skip to first unread message

Megha Bhirade

unread,
Jul 30, 2019, 5:02:04 AM7/30/19
to BeagleBoard
Hi,

I am recently working on Beagle bone black, i need to use PWM module in the beagle bone black.

i followed the bellow steps for configuration :

1) cd /sys/class/pwm
2) ls -> here i found pwmchip0, pwmchip1, pwmchip2, pwmchip3....pwmchip7.
3) cd pwmchip0
4) ls -> here i found : device  export npwm power subsystem uevent unexport.
5) echo 0 > export i added pwm0
6) ls -> i can see pwm is added.
7) cd ./pwm0 -> here i can see the duty cycle , period and other information.

i want to add the pinmux for pwm

debian@beaglebone:/sys/class/pwm$ config-pin -l P9.22
default gpio gpio_pu gpio_pd gpio_input spi_sclk uart i2c pwm pru_uart
debian@beaglebone:/sys/class/pwm$ config-pin P9.22 pwm
P9_22 pinmux file not found!
sudo: no askpass program specified, try setting SUDO_ASKPASS
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_22_pinmux/state

but it is showing error for adding P9.22 pin as pwm.

please help me to resolve it


Megha Bhirade

unread,
Jul 30, 2019, 6:23:45 AM7/30/19
to BeagleBoard

In other hand if i try to add some more pwm means it is showing the error like this


debian@beaglebone:/sys/class/pwm$ cd pwmchip0
debian@beaglebone:/sys/class/pwm/pwmchip0$ ls
device  export  npwm  power  pwm-0:0  subsystem  uevent  unexport
debian@beaglebone:/sys/class/pwm/pwmchip0$ echo 3 > export
-bash: echo: write error: No such device

i am not able to add other pwm module... why it is showing the error.

please resolve it....

TJF

unread,
Jul 30, 2019, 10:48:33 AM7/30/19
to BeagleBoard
Insiders tip welcome?

Check out libpruio for easy and powerful PWM (and pinmuxing) features.

Regards

Megha Bhirade

unread,
Jul 31, 2019, 12:35:17 AM7/31/19
to BeagleBoard


Hi,

can anybody suggest me c programing example on the pwm in beagle-bone black.

evilwulfie

unread,
Jul 31, 2019, 1:12:52 AM7/31/19
to beagl...@googlegroups.com


On 7/30/2019 9:35 PM, Megha Bhirade wrote:


Hi,

can anybody suggest me c programing example on the pwm in beagle-bone black.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/1d74bedf-24c1-4bfb-883b-037323fcac0a%40googlegroups.com.

Megha Bhirade

unread,
Jul 31, 2019, 1:40:15 AM7/31/19
to BeagleBoard

Hi,

using pwm i am doing some configuartions in the beaglebone black..

in /sys/class/pwm/pwmchip1
  

Megha Bhirade

unread,
Jul 31, 2019, 1:47:55 AM7/31/19
to BeagleBoard


On Wednesday, July 31, 2019 at 11:10:15 AM UTC+5:30, Megha Bhirade wrote:

Hi,

using pwm i am doing some configurations in the beagle bone black..

in /sys/class/pwm/pwmchip1
         echo 0 > export
         echo 1 > export

i can see the 2 pwm are added pwm1:0 , pwm1: 1

using cd pwm1:0  i am assigning the duty cycle , period and enable

if i rebooted the BBB means this configurations are erasing, why i am not getting??

using config-pin -l  P9.14
         config-pin P9.14 pwm

i am setting pin for pwm as p9.14

in hardware wise i am connecting 1 external led providing 1 connection from P9.14 and other end to ground.

but led should glow based on pwm duty-cycle, but here the LED not all glowing ???

please suggest me where i am missing??
 
  

Megha Bhirade

unread,
Aug 1, 2019, 1:35:45 AM8/1/19
to BeagleBoard
Hi ,

i am using kernel version of 4.14.so slots file and bone -capemgr are disabled in V4.14 of kernel in the favor of U-boot overlay.

my uEnv.txt file look like this.


debian@beaglebone:/boot$ cat uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.14.71-ti-r80
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo

uboot_overlay_addr6=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr7=/lib/firmware/BB-UART2-00A0.dtbo

###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
#disable_uboot_overlay_video=1
#disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_rproc (4.14.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 quiet video=HDMI-A-1:1024x768@60e

#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 quiet overlayroot=tmpfs

##enable Generic eMMC Flasher:
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

debian@beaglebone:/boot$

please help me , here i am missing anything ??

Andrew Pikul

unread,
Aug 1, 2019, 1:41:43 PM8/1/19
to BeagleBoard
Isn't this just a permission error? Does it work with sudo?

Megha Bhirade

unread,
Aug 2, 2019, 12:07:38 AM8/2/19
to BeagleBoard

Hi,

I got why that error is coming . already i used those pins to UART , so i can't use that pins again to PWM.

i am using P9.14 for pwm, but still also it is not working for me..

i am feeling something i need to add in to uEnv.txt, but i am not getting ..

please suggest me??

lba...@cpqd.com.br

unread,
Aug 13, 2019, 12:14:53 PM8/13/19
to BeagleBoard
Hi Megha,

I recomend you to use adafruit python library to check your uEnv.tx configuration and pin choice. It is a very easy to use lib and helped me a lot to test GPIO stuff.

TJF

unread,
Aug 14, 2019, 12:38:55 PM8/14/19
to BeagleBoard
Hi Luis!

Am Dienstag, 13. August 2019 18:14:53 UTC+2 schrieb Luis Paulo Fernandes de Barros:
I recomend you to use adafruit python library ... It is a very easy to use lib and helped me a lot to test GPIO stuff.

Check out libpruio and judge again.

Regards
Reply all
Reply to author
Forward
0 new messages