PWM0 Example Not Working in Ubuntu 16.04

skcolb
skcolb New Member Posts: 1

I'm trying to get PWM0 working on my Up2 board, following the example here:
https://wiki.up-community.org/Pinout_UP2

I have Ubuntu 16.04.5 installed, and otherwise followed the instructions here:
https://wiki.up-community.org/Ubuntu

The GPIO works on that pin (Linux pin number 468), but when I run the PWM example commands, nothing happens.

Any suggestions? Thanks.

Comments

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @skcolb ,

    The best and easy way is to check how the pin level is changing:

    $ echo 0 > /sys/class/pwm/pwmchip0/export
    $ echo 3413333 > /sys/class/pwm/pwmchip0/pwm0/period
    $ echo 1706667 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle

    Before active the pin: cat /sys/class/pwm/pwmchip0/pwm0/enable
    $ echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
    After ative the pin: cat /sys/class/pwm/pwmchip0/pwm0/enable

    Then, you should see how the pin is off and on when you want.

    Also, you could try to conenct a logic analyser in your pin to see something like in the attached pic.

    Cheers!