Hello.
We are using the SAMD21turboPWM library on a Nano33IOT board to check PWM operation.
In the DataSheet of Arduino, PWM PINs D3,5,6,9,10 are listed as PWM.
I checked by running the SAMD21turboPWM and found the following relationship
PWM operation on D4.7 when using Timer1
When using Timer2, PWM operation on D11,13
Is it possible to control the pins where PWM operates?
The sample I used is as follows
#include <SAMD21turboPWM.h>
TurboPWM pwm;
void setup() {
for ( int i =0 ; i !=21; i ++ ){
pinMode(i, OUTPUT); // all output
}
pwm.setClockDivider(1, false);
pwm.timer(2, 1, 60000, true);
for ( int i =0 ; i !=21; i ++ ){
pwm.analogWrite( i, 500); // all pwm pin
}
}
void loop() {}
I don't know anything about that library, however most pins that have PWM capability have two choices for timer channels they can use. The Arduino library will only use one of them and has in a couple of cases made bad decisions that cause conflicts in assignments and has pins that can be used but are not supported. Here is the list (bold face are the ones the library used):
D0 TC3/1
D1 TC3/0
D2 TC5/0 TCC0/4
D3 TC5/1 TCC0/5
D4 TCC1/1
D5 TCC0/1
D6 TCC0/0
D7 TCC1/0
D8 TC3/0 TCC0/2
D9 TCC0/6
D10 TCC0/7
D11 TCC2/0 TCC0/6
D12 TC3/1 TCC0/3
D13 (LED, no physical pin) TCC2/1 TCC0/7
A0
A1
A2 TCC1/1 TCC0/3
A3 TCC1/0 TCC0/2
A4 TC4/0
A5 TC4/1
A6 TCC0/1 TCC1/3
A7