Figuring out the PWM pins on SAM D10 MCU - Page 1
Forum section: electronics / general

author: anvoice
author_rank: Frequent Contributor
timestamp: February 07, 2018, 07:33:26 am
content: Hello, I'm selecting an MCU for a brushless servo controller, which means I need 6 PWM outputs as well as some ADC inputs for current detection (plus some pins pot or quadrature encoder or pot, depending on which route I go). I'm currently looking at the ATSAMD10D14 SOIC20 package (datasheet is too big to attach, but is one of the first hits on google searching for that MCU), which seems to have the desired characteristics, but by looking at its datasheet (yes, I'm not very good at it yet) I can't determine which pins are the PWM pins. The analog pins are marked on the pinout, so those should be the ADC (I see 6 of them), but the rest are just marked as digital pins. It would be my assumption that the PWM pins would not be on the same pins as the ADC, but I'm not certain. If they overlap I wouldn't have the proper number of pins to control my motor. Can someone help me interpret this? Any help is most appreciated.

author: ataradov
author_rank: Super Contributor
timestamp: February 07, 2018, 08:02:16 am
content: Look at the table "Table 6-1. PORT Function Multiplexing". TCCx/WO are your outputs. There are only a couple of ADC channels that don't intersect with TCC outputs, but if you don't need all the outputs, then you can save more ADC channels.

author: anvoice
author_rank: Frequent Contributor
timestamp: February 07, 2018, 08:37:37 am
content: So if I'm reading it correctly, there are 10 ADC channels. Which pins are PWM-capable though? I believe the specifications for the MCU claim something like 8 PWM channels, if they all intersect with the ADC that could be a problem.

author: ataradov
author_rank: Super Contributor
timestamp: February 07, 2018, 08:39:56 am
content: All TCCx/WO are PWM waveform outputs from the TCCs.You need to think though your TCC channel assignments to make sure that all the channels you need synchronized are synchronized. Actually never mind that, there is only one TCC.

author: anvoice
author_rank: Frequent Contributor
timestamp: February 07, 2018, 08:48:32 am
content: So basically the TCC0/WO[0-7] are the possible independent PWM outputs? That would mean I should be able to scrape enough ADC channels for my needs. In fact if I'm reading it correctly, if I use TCC0/WO[2-7] I can avoid all overlap with the ADC channels, which would mean I'd have 10 ADC channels available. Correct me if I'm wrong of course, and thank you for your help.

author: ataradov
author_rank: Super Contributor
timestamp: February 07, 2018, 08:51:45 am
content: There is only 4 independent channels. The corresponding pair channels can be programmed to output a complimentary signal with configurable dead time insertion. Just what you need for motor control.Figure 29.3 shows a block diagram of the TCC.You can achieve more independence by using TCs as well, but I would stick with TCC for motor control and let hardware do the work.

author: anvoice
author_rank: Frequent Contributor
timestamp: February 07, 2018, 09:49:39 am
content: Thank you!

author: ajb
author_rank: Super Contributor
timestamp: February 14, 2018, 08:45:46 pm
content: You may also want to look at the D21 family if you need a few more channels. There are a few parts that are only a few more pins than the D10 but come with a larger peripheral set. In particular, the D21L parts have additional ADC channels versus the equivalent standard D21 parts (IIRC, it's just different pins that are dropped from the lower pincount packages, so otherwise the parts and peripherals are identical).

author: westfw
author_rank: Super Contributor
timestamp: February 15, 2018, 02:10:34 am
content: You can also look athttps://docs.google.com/spreadsheets/d/12YnZpTPGxS-oINhrRfFgx2rkwPUyUYQbXvVIME8oCHY/This is just a spreadsheet version of the "Figure 29.3" pinmux table that Ataradov mentioned, but I find it very useful to create these and be able to sort them based on the different headers/etc.