Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

ItsyBitsy M0 Express PWM Timers
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ItsyBitsy M0 Express PWM Timers

by Iceweasel44 on Mon Jul 27, 2020 6:52 am

I've seen posts here about having a limited number of timers available for PWM pins. First I'm wondering what that limit is exactly; looking at the docs it sounds like it depends on the number of output channels available from TC / TCC instances? (Or is it just number of TCC instances?)

Either way, I'm running into a problem with three PWM outputs. I can make three PWM outputs, but only on specific combinations of pins.
This works with no error:

Code: Select all | TOGGLE FULL SIZE
PWMA = pulseio.PWMOut(board.D4, frequency=1, variable_frequency=True)
PWMB = pulseio.PWMOut(board.D3, frequency=1, variable_frequency=True)
#PWMC = pulseio.PWMOut(board.D9, frequency=1, variable_frequency=True)
PWMC = pulseio.PWMOut(board.D5, frequency=1, variable_frequency=True)


This, however:
Code: Select all | TOGGLE FULL SIZE
PWMA = pulseio.PWMOut(board.D4, frequency=1, variable_frequency=True)
PWMB = pulseio.PWMOut(board.D3, frequency=1, variable_frequency=True)
PWMC = pulseio.PWMOut(board.D9, frequency=1, variable_frequency=True)
#PWMC = pulseio.PWMOut(board.D5, frequency=1, variable_frequency=True)


results in the following error:
Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "code.py", line 58, in <module>
RuntimeError: All timers in use


I'm not sure why it decides all timers are in use when merely moving to a different pin, not adding a fourth.
Relevant version output from serial:
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18

Iceweasel44
 
Posts: 6
Joined: Sat Jan 18, 2020 10:22 pm

Please be positive and constructive with your questions and comments.