SAM D21E Microcontroller - Are all I/O Pins Capable of PWM Output?

I'm creating a visual reference image for the SAM D21E ("E" is a 32-pin version of the D21 Series).

Looking at the datasheet, it appears all of the available I/O pins are multiplexed to at least one TCCx Timer. Does this indicate that each pin is capable of producing a PWM output (depending on the device configuration)?

I've scoured the datasheet for something definitive, however it's over 1,100 pages and I'm not not finding an answer. It's time to leverage the collective knowledge of others who may already know the answer - thanks in advance! :confused:

Datasheet: Smart | Connected | Secure | Microchip Technology Sheet_DS40001882E.pdf#page=30

Hi gabenix,

Looking at the datasheet, it appears all of the available I/O pins are multiplexed to at least one TCCx Timer. Does this indicate that each pin is capable of producing a PWM output (depending on the device configuration)?

Most pins are connected to a timer, but there some considerations.

The SAMD21E's pin functions are detailed in the SAMD21 Datasheet section 7, I/O Multiplexing and Considerations, Table 7.1 Port Function Multiplexing. The TC/TCC timers are in columns E and F.

Note that TCC0 has 4 channels: WO[0] to WO[3], repeated on WO[4] to WO[7]. The respective repeated channels can be used as either as an alternative output, for example WO[4] can be used as an alternative to WO[0], WO[5] for WO[1] and so on, or if dead-time insertion is activated, both respective channels can be employed as a complementary pair.

TCC1 has 2 channels: WO[0] and WO[1], repeated on WO[2] and WO[3].

TCC2 has 2 channels: WO[0] and WO[1].

Note that TCC0 and TCC1 are 24-bit timers, while TCC2 is only 16-bit.

There are also 3 TC timers: TC3, TC4 and TC5. These are also PWM capable, but are less fully featured than their TCC counterparts. TC timers: TC6 and TC7 are only found on the larger, 64-pin SAMDJ variant.

The TC timers are 16-bits, however TC4 and TC5 can easily chained together to create a 32-bit timer if required.

Hello Martin, thank you for the reply!

So far I have not discovered anything stating that any specific pin/s cannot be utilized for PWM. For my purposes (creating a graphic visual-reference of the chip and pin capabilities) the PWM capable pins will have the quintessential sine-wave "squiggly line" while others will have a straight line.

At this point, I'm giving them all a squiggly line unless I learn otherwise. :cold_sweat: Thanks!

Note that they can't all run PWM at the same time. because some of the timer outputs are "optionally connected" to multiple pins, and some of the outputs are merely complements of some other timer output (as Martin said, in slightly different words...)

westfw:
Note that they can't all run PWM at the same time. because some of the timer outputs are "optionally connected" to multiple pins, and some of the outputs are merely complements of some other timer output (as Martin said, in slightly different words...)

Yes, of course :wink:

This is a quick preview of the rough-draft image, I have not added the legend or any notes yet.

EDIT: The image has been removed as it contained errors.

Hi gabenix,

Wow, there's nothing rough about your draft image, Microchip/Atmel should use it in their datasheets. It gives a nice overview of each pin's capabilities.

In the SAMD21 datasheet, section 2 named "Configuration Summary", it details each variant's on-chip peripherals. The datasheet could make this much clearer, especially since they've now added a whole new group of optimised variants: SAMD21ExxA, SAMD21ExxB, SAMD21ExxC, SAMD21ExxD and finally the SAMD21ExxL.

The SAMD21E (in any of its new varieties) has only 4 SERCOM modules: SC0 through to SC3.

All varieties of the SAMD21E contain TCC timers: TCC0, TCC1 and TCC2, but only the SAMD21E17D and SAMD21E17L incorporate the additional TCC3 timer.

MartinL:
Hi gabenix,

Wow, there's nothing rough about your draft image, Microchip/Atmel should use it in their datasheets. It gives a nice overview of each pin's capabilities.

In the SAMD21 datasheet, section 2 named "Configuration Summary", it details each variant's on-chip peripherals. The datasheet could make this much clearer, especially since they've now added a whole new group of optimised variants: SAMD21ExxA, SAMD21ExxB, SAMD21ExxC, SAMD21ExxD and finally the SAMD21ExxL.

The SAMD21E (in any of its new varieties) has only 4 SERCOM modules: SC0 through to SC3.

All varieties of the SAMD21E contain TCC timers: TCC0, TCC1 and TCC2, but only the SAMD21E17D and SAMD21E17L incorporate the additional TCC3 timer.

Thanks Martin!

I missed it, ouch! This datasheet is not intuitive to say the least. Microchip has many variants, having significant distinction and nuance between them, all crammed into a single datasheet.

However this is the reason I want to extract the chip-specific data to create a graphic representation (and notes).

I'll follow up with a final version for review and scrutiny. Thanks!

In the SAMD21 datasheet, section 2 named "Configuration Summary", it details each variant's on-chip peripherals.

I missed that too, especially since the "IO Multiplexing an Considerations" doesn't indicate the unavailable peripherals in any way that I can see.
I usually put together a spreadsheet; doing the work gives me a better understanding of how a particular chip actually works, along with limitations of the pinout. And it's useful to be able to sort based on different columns... SAMD21-PMUX - Google Sheets
Lately, I've been working on a python program that parses the higher-level .ATDF machine description file that is provided, translating it to various more readable formats.

for i in range(1,32):
    showChipPin(str(i))
    
Chip Pin 1 on ATSAMD21E17L is PA02
  ADC: AIN0 pmux:B
  DAC: VOUT pmux:B
  EIC: EXTINT2 pmux:A
  PORT: P2 pmux:default
  TCC3: WO0 pmux:F
Chip Pin 2 on ATSAMD21E17L is PA03
  ADC: AIN1 pmux:B
  DAC: VREFP pmux:B
  EIC: EXTINT3 pmux:A
  PORT: P3 pmux:default
  TCC3: WO1 pmux:F
Chip Pin 3 on ATSAMD21E17L is PB04
  AC1: AIN0 pmux:B
  ADC: AIN12 pmux:B
  EIC: EXTINT4 pmux:A
  PORT: P36 pmux:default
Chip Pin 4 on ATSAMD21E17L is PB05
  AC1: AIN1 pmux:B
  ADC: AIN13 pmux:B
  EIC: EXTINT5 pmux:A
  PORT: P37 pmux:default
   :
   :
Chip Pin 31 on ATSAMD21E17L is PB02
  AC1: AIN2 pmux:B
  ADC: AIN10 pmux:B
  EIC: EXTINT2 pmux:A
  PORT: P34 pmux:default
  TCC3: WO2 pmux:F
Chip Pin 32 on ATSAMD21E17L is PB03
  AC1: AIN3 pmux:B
  ADC: AIN11 pmux:B
  EIC: EXTINT3 pmux:A
  PORT: P35 pmux:default
  TCC3: WO3 pmux:F

I wonder if it would be possible to go programmatically straight from the descriptions to some sort of image...

westfw:
I usually put together a spreadsheet; doing the work gives me a better understanding of how a particular chip actually works, along with limitations of the pinout. And it's useful to be able to sort based on different columns...

Lately, I've been working on a python program that parses the higher-level .ATDF machine description file that is provided, translating it to various more readable formats.

I wonder if it would be possible to go programmatically straight from the descriptions to some sort of image...

Very cool script, I'm taking a peek at the spreadsheet now. And good idea as well! :wink:

It would definitely be possible to auto generate an image based on the raw data from a spreadsheet or database. Could be done on-the-fly with JavaScript to produce an image in a web browser.The image could be downloaded or saved as well. Shouldn't be too difficult either. Most of the programming I've done in that area was visually animating or creating interactive mathematical equations (like the Riemann zeta function) Hmm... I like it. Maybe I could whip something up in the coming weeks.

Okay, here's the updated graphic after making the revisions. Hopefully I'm close now. Let me know of any issues with this one. Thanks in advance!

Hi gabenix,

I referenced your image against the Port Function Multiplexing table in the SAMD21 datasheet. It all looks good to me.

gabenix,

Nice job. I see your reference to functions C - G. Are those functions defined somewhere in the SAMD21 Family datasheet?

borland:
gabenix,

Nice job. I see your reference to functions C - G. Are those functions defined somewhere in the SAMD21 Family datasheet?

Hey Borland, thanks! Yes, they are defined in section 7. I/O Multiplexing and Considerations and are referenced in the table (7-1). See below.

7.1 Multiplexed Signals
Each pin is by default controlled by the PORT as a general purpose I/O and alternatively it can be assigned to one of the peripheral functions A, B, C, D, E, F, G or H. To enable a peripheral function on a pin, the Peripheral Multiplexer Enable bit in the Pin Configuration register corresponding to that pin (PINCFGn.PMUXEN, n = 0-31) in the PORT must be written to one. The selection of peripheral function A to H is done by writing to the Peripheral Multiplexing Odd and Even bits in the Peripheral Multiplexing register (PMUXn.PMUXE/O) in the PORT.