PWM Not working

I can’t configure GPIO pins (GPIO 12, 17 in my case) to work on PWM frequency.
I tried to use 2 libraries to write my python code: python-periphery and Adafruit_BBIO.

  • Overlays didn’t work.
  • I tried to use ‘config-pin’ and it was not recognised. In order to use ‘config-pin’ I had to install bb.org-overlays repo and run the installer which I can’t on beagleY-AI since I got this error: Error: this script: [./install.sh] is not supported to run under [aarch64]
  • I tried to edit manually extlinux.conf file and add required overlays for required pins. It didn’t help either.

My question is: what do I do? I’m trying to power a small motor that would rotate a wheel for me.

For GPIO12/GPIO17 you need to load these two overlays:

k3-am67a-beagley-ai-pwm-ecap0-gpio12.dtbo k3-am67a-beagley-ai-pwm-ecap2-gpio17.dtbo

Open, /boot/firmware/extlinux/extlinux.conf and add:

fdtoverlays /overlays/k3-am67a-beagley-ai-pwm-ecap0-gpio12.dtbo /overlays/k3-am67a-beagley-ai-pwm-ecap2-gpio17.dtbo

To the menu option you are currently using…

label microSD (default)
    kernel /Image
    append console=ttyS2,115200n8 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0 quiet
    fdtdir /
    fdt /ti/k3-am67a-beagley-ai.dtb
    fdtoverlays /overlays/k3-am67a-beagley-ai-pwm-ecap0-gpio12.dtbo /overlays/k3-am67a-beagley-ai-pwm-ecap2-gpio17.dtbo
    #initrd /initrd.img
voodoo@beagley-ai-83:~$ sudo beagle-version | grep UBOOT
UBOOT: Booted Device-Tree:[k3-am67a-beagley-ai.dts]
UBOOT: Loaded Overlay:[k3-am67a-beagley-ai-pwm-ecap0-gpio12.kernel]
UBOOT: Loaded Overlay:[k3-am67a-beagley-ai-pwm-ecap2-gpio17.kernel]

I have a helper script:

sudo beagle-pwm-export --pin gpio12
sudo beagle-pwm-export --pin gpio17

They end up here: /dev/hat/pwm/

voodoo@beagley-ai-83:~$ ls -lha /dev/hat/pwm/
total 0
drwxr-xr-x 2 root root  80 Jun 16 11:15 .
drwxr-xr-x 3 root root 140 Jun 16 10:34 ..
lrwxrwxrwx 1 root root  63 Jun 16 10:34 GPIO12 -> /sys/devices/platform/bus@f0000/23100000.pwm/pwm/pwmchip0/pwm0/
lrwxrwxrwx 1 root root  63 Jun 16 11:15 GPIO17 -> /sys/devices/platform/bus@f0000/23120000.pwm/pwm/pwmchip2/pwm0/

Regards,

1 Like

Thank you for your answer. The overlays you mentioned are meant only to receive pwm signal (ECAP module). I have wiring diagrams included. Which overlays I need to import here so I can know the chips and channels I need to operate on?
Thank you!

temp.drawio (1.0 МБ)

Here is the full list of pwm overlays I have on my board:
k3-am67a-beagley-ai-pwm-ecap0-gpio12.dtbo
k3-am67a-beagley-ai-pwm-ecap1-gpio16.dtbo
k3-am67a-beagley-ai-pwm-ecap1-gpio21.dtbo
k3-am67a-beagley-ai-pwm-ecap2-gpio17.dtbo
k3-am67a-beagley-ai-pwm-ecap2-gpio18.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio12.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio14.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio15.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio15-gpio12.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio15-gpio14.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio5.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio5-gpio12.dtbo
k3-am67a-beagley-ai-pwm-epwm0-gpio5-gpio14.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio13.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio20.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio21.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio21-gpio13.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio21-gpio20.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio6.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio6-gpio13.dtbo
k3-am67a-beagley-ai-pwm-epwm1-gpio6-gpio20.dtbo

No, that’s not true… The TI’s ECAP Linux driver supports driving a single output “pin” in pwm mode thru the ECAP module! Capture side of “ECAP” module is supported thru the Linux counter driver…

PWM: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/pwm/pwm-tiecap.yaml?h=v6.16-rc2

Capture: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/counter/ti,am62-ecap-capture.yaml?h=v6.16-rc2

Regards,