The SAMD has many Clocks, Timer/Counter (TC) Units and Timer/Counter for Control (TCC) units, so it is a bit complicated.
I’ve been focussing on the TCC units for now, since they support the cool stuff needed for 6-PWM with dead time insertion and interrupts for current sensing. In theory the TC units support PWM as well, so they could be used for 3-PWM…
To spice things up a bit, the SAMD can’t map any TCC Unit channel to any pin, but has fixed pin assignments. The different TCC Unit outputs are mapped to different pins on the Nano, with each pin having up to 2 TCC signals, which need to be configured via the pin configuration registers (peripheral configuration).
To make matters even more exciting, it seems that the facilities you can use to query pin capabilities on the Arduino Nano 33 IoT are badly messed up (or I have some kind of bug in my code I just can’t see!) - variant.cpp looks ok, and matches the pinout diagram, but when I use the get-Pin-Information functions I get completely different things coming back - so clearly something is overwriting the variant.cpp data, at the compile-time or at the run-time level, I don’t know.
This means however that you can’t reliably query the pin information to do the TCC setup, especially relevant in this case where each pin could have 2 different TCC outputs, and you want to find a matching TCC Unit across the 3 pins if possible…
Unless this can be resolved it means this information will have to be provided explicitly to the initialization, or it won’t work.