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

ItsyBitsy M0 PWM pin limit?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ItsyBitsy M0 PWM pin limit?

by octoshaw on Wed Jun 24, 2020 12:55 pm

Hi there.

I'm hoping to use a ItsyBitsy M0 to drive a somewhat large number of PWM outputs that control current on a bunch of LED drivers. However, I can't seem to successfully setup PWMs on all the pins that should allow it... my python fails to compile with a runtime error "all timers in use".

Is it possible that despite the advertised 13 PWM capable pins, only a smaller number can be used simultaneously?

I need a total of 13 PWM outputs (12 of these can share the same duty cycle & freq). Using CircuitPython, I have the following pins working (or at least the init is accepted):

D1,D2,D3,D5,D7,D9,D10,D11,D12,D13,A2,SCL - so I am one short...

According to the intro page (https://learn.adafruit.com/introducing- ... m0/pinouts) I should also be able to use A1 - however, configuring this results in a "Invalid pin error".

Other pins such as D4 should also be available for PWM - but the init results in the "all timers in use" error.
Additionally, I've noticed changing the init order of the above pins seems also affect where the "all timers in use" error kicks in. Am I missing something fundamental here?

As a side note, I did look into using a shift register to reduce pins - but unfortunately the resulting flicker is not compatable with my photographic application on this project.

Basic sample code attached for reference - any suggestions much apreciated!
Attachments
sample.py
(422 Bytes) Downloaded 2 times

octoshaw
 
Posts: 8
Joined: Fri Jan 31, 2020 4:38 pm

Re: ItsyBitsy M0 PWM pin limit?

by dastels on Wed Jun 24, 2020 2:50 pm

It's so much a matter of how many pins can be PWM outputs, it's about how many timers in the MCU available to drive PWM outputs.

If you need a bunch of PWM output for LEDs or servos, have a look at https://www.adafruit.com/product/815 or (only for LEDs) https://www.adafruit.com/product/1429.

Dave

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

Re: ItsyBitsy M0 PWM pin limit?

by octoshaw on Thu Jun 25, 2020 1:38 pm

Thanks for the reply Dave - I kind of figured that might be the issue. Still, a bit disappointing to see 13 PWMs advertised but I can only get to 9 of them :(

Looking at the breakout boards you suggested, neither will support the 35v LEDs I am running, but I assume I could just use them to send a logic level PWM to the individual drivers I have?

thanks,

Ollie.

octoshaw
 
Posts: 8
Joined: Fri Jan 31, 2020 4:38 pm

Re: ItsyBitsy M0 PWM pin limit?

by dastels on Thu Jun 25, 2020 2:33 pm

That is a bit misleading on the project page, but if you look at the pinout page in the tutorial, it says "can do PWM output" on the pins that can, which is more correct. 13 pins are capable of PWM, but not all at the same time.

That should work. Just do what you were planning to do with the M0's PWM outputs.

Dave

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

Please be positive and constructive with your questions and comments.