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

Is there a max # of servos per Grand Central?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Is there a max # of servos per Grand Central?

by evgbrowns on Sat Apr 18, 2020 1:39 am

I'm trying to setup a Grand Central with a total of 15 servos: 8 continuous and 7 conventional (and 19 digital inputs and 5 separate neopixel strips if that matters). I can't get all the servos to initialize, though most do. The pulseio.PWMOUT(pin, frequency-50) or pulseio.PWMOUT(pin, duty_cycle=2**15, frequency=50) line depending on the servo type raises a RuntimeError exception, which if I don't catch says "All timers in use." Depending on the order I try to do this, I get two or three of the servos as errors. The ones with errors aren't the last ones I try, but the ones that fail vary depending on the order of initialization. I assigned the pins for all these in logical groups (servos, sensors and LEDs that work together on adjacent pins), ensuring I avoided the pins that the documentation (and the test program in the documentation under the heading Where's My PWM on page 119) says are not good for PWM (D0-D1,D10,D12,D46,D47,D49).

If I run my setup, in this instance (all conventional servos followed by all continuos servos), the allocations fail on D21, D22, and D42, If I then run the PWM scan program, it reports timers on 8 pins, including the three I couldn't allocate. It also shows a timer on D3,D4, D8, D41 and D51, which I didn't initialize. It doesn't show a timer on any of the servos that successfully allocated, including D5, D7, D14, D15, D20, D27, D28, D31, D32, D37, D38, and D50.

Is there a maximum number of simultaneous PWM outputs, smaller than the 22 implied by the board description? Is there some dependency between various pins that says I can't have servos on both pins x and y, but x and z is OK? If so, where is this documented? I saw a thread on the Metro M4 that talked about TCs and TCCs that sound related, but was more about the right error message and using all the resources, so I wasn't able to draw an answer to my question from that thread.

evgbrowns
 
Posts: 14
Joined: Sun Mar 22, 2020 9:53 pm

Re: Is there a max # of servos per Grand Central?

by dastels on Sat Apr 18, 2020 10:03 am

The SAMD51 has 8 TCs and 6 TCCs which puts a top limit on the number of PWMS you can have, regardless of how many pins are PWM capable. You could add a servo shield to offload some of the PWMs. https://www.adafruit.com/product/1411.

Dave

dastels
 
Posts: 3781
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.