generated from pimoroni/boilerplate-python
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I'm developing an application involving a Raspberry Pi 5. I have the Pimoroni I/O expander connected to the I2C GPIO pins, and in general the board is working fine. However, every once in a while, this happens:
>>> ioe.set_pwm_period(60000) Timed out waiting for PWM load!
However, if I invoke that function with wait_for_load=False, the I/O expander behaves just fine, including controlling PWM devices connected to those pins.
Looking at this code:
def pwm_load(self, pwm_module=0, wait_for_load=True):
# Load new period and duty registers into buffer
t_start = time.time()
self.set_bit(self._regs_pwmcon0[pwm_module], 6) # Set the "LOAD" bit of PWMCON0
if wait_for_load:
while self.pwm_loading(pwm_module):
time.sleep(0.001) # Wait for "LOAD" to complete
if time.time() - t_start >= self._timeout:
raise RuntimeError("Timed out waiting for PWM load!")
def pwm_loading(self, pwm_module=0):
return self.get_bit(self._regs_pwmcon0[pwm_module], 6)
...it looks like get_bit() is returning 0/False even though the PWM controller has been correctly configured and is behaving as expected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels