2

I'm in trouble on using hardware PWM.

Used machine is RPi3 model B. Program is written by Python. pigpio library was used for controlling PWM.

Following the homepage of pigpio library, I started daemon, set the clock of the hardware as PCM and run the script written below

However, RPi3 doesn't make PWM. There was no problem on making software PWM, but only hardware PWM doesn't work. (I verified this with LED and oscilloscope.)

Could you give me your idea to solve this problem? Thank you.

import pigpio
import time

pin = 18

pi = pigpio.pi()
pi.set_mode(pin, pigpio.OUTPUT)

pi.hardware_PWM(pin, 100, 500000)
Ikajiro
  • 21
  • 4

1 Answers1

1

Old question, but I'm dealing with the same issue and figure others might find this question. Apparently, to access the hardware pwm channel, you need to explicitly set the GPIO mode.

GPIO.set_mode(18, pigpio.ALT5)

Source: https://nerdhut.de/2016/05/09/exact-timings-raspberry-pi/