Open haegr opened 3 years ago
Same problem
That's interesting behavior. Did you guys find out which function call was causing it?
Also, it might be fixed by #50, which was in master for a long time, but unfortunately, it wasn't tagged so it was not used if you were using go modules. I created the new tag now, so you might try to update it (go get -u github.com/stianeikeland/go-rpio/v4
) and check whether it solves your issue.
This appears to still be an issue; we attempt to set pin 13 to PWM.
if err2 := rpio.Open(); err2 != nil {
log.Printf("Error loading brightness_control module")
err = err2
return
}
log.Printf("Start Brightness pin setup")
pin := rpio.Pin(13)
log.Printf("Set PWM")
pin.Mode(rpio.Pwm)
log.Printf("Set Freq")
pin.Freq(100000)
if bri, err2 := getBrightness(); err2 == nil {
log.Printf("Set duty cycle")
pin.DutyCycle(uint32(bri), 100)
} else {
err = fmt.Errorf("error getting brightness value: %v", err2.Error())
}
log.Printf("Close mem map")
rpio.Close()
Our log stops at "Set Freq" and the process then hangs.
Calling raspi-gpio also shows the pin is still configured as set in config.txt (gpio=13=op,dl).
Perhaps it's just me but whenever I try to use PWM the BCM pin 2 changes from ALT0 to ALT2 and suddenly it's no longer possible to use ADC chips to for example read the value of a Rotary Potentiometer and then controlling a DC motor using PWM. Doesn't seem to matter if I use PWM on BCM pin 12 or BCM 13.
Using Raspberry PI 4.