Electronic – How to translate from data sheet to actual pin function (blank Atmel SAMD21)

datasheetpinout

I am looking for a way to actually read an Atmel processor (SAMD-21) pin setup; but I am not sure how do you actually get the right info from the data sheet.

I did read the pinout, which has names like PA00, PB03 and so on; reading in the multiplexed section, I see a table with each pin, but I can't get what it actually does. I was expecting something like "SPI MOSI" or "Serial TX" and such; instead the table has a ton of entry that does not look like anything that I recognize.

For example Pin 13 is PA08, as type it is mentioned as I2C, and the rest of the line has entry like

NMI  AIN[16]  X[0]  SERCOM0/Pad0  SERCOM2/Pad0  TCC0/WO[0]  TCC1/WO[2]  I2S/SD[1]

I did search in the section related to pinout, but there is only this table, which while it tell me if the pin is a I2C or SPI, it doesn't give me any context to translate in what I would see on a breakout board for example.

Is there a conversion table that show what these entry mean? I am a SW engineer, so this is my first attempt at reading a datasheet for a processor.

UPDATE:

Found some info online, after looking for SERCOM.

From my understanding, the SAMD21 has programmable pins, but there are some that are set as default for communication related to I2C, SPI and UART. These are under the name "SERCOM".

This show basically the default value for each pin, using an arduino zero board as reference

Pin     Default     SERCOM      SERCOM alt
-----------------------------------------
PA00    xtal                    SERCOM1.0
PA01    xtal                    SERCOM1.1
PB08                            SERCOM4.0
PB09                            SERCOM4.1
PA04                            SERCOM0.0
PA05                            SERCOM0.1
PA06                            SERCOM0.2
PA07                            SERCOM0.3
PA08                SERCOM0.0   SERCOM2.0
PA09                SERCOM0.1   SERCOM2.1
PA10                SERCOM0.2   SERCOM2.2
PA11                SERCOM0.3   SERCOM2.3
PB10    MOSI                    SERCOM4.2
PB11    SCK                     SERCOM4.3
PA12    MISO        SERCOM2.0   SERCOM4.0
PA13    EDBC        SERCOM2.1   SERCOM4.1
PA14                SERCOM2.2   SERCOM4.2
PA15                SERCOM2.3   SERCOM4.3
PA16                SERCOM1.0   SERCOM3.0
PA17                SERCOM1.1   SERCOM3.1
PA18                SERCOM1.2   SERCOM3.2
PA19                SERCOM1.3   SERCOM3.3
PA20                SERCOM5.2   SERCOM3.2
PA21                SERCOM5.3   SERCOM3.3
PA22    SDA         SERCOM3.0   SERCOM5.0
PA23    SCL         SERCOM3.1   SERCOM5.1
PA24    USB         SERCOM3.2   SERCOM5.2
PA25    USB         SERCOM3.3   SERCOM5.3
PB22    EDBG TX                 SERCOM5.2
PB23    EDBG RX                 SERCOM5.3
PA30    SWCLK                   SERCOM1.2
PA31    SWDIO                   SERCOM1.3
PB02                            SERCOM5.0
PB03    RX LED                  SERCOM5.1

So basically, you can set any of these pins if you need extra ports for I2C, SPI or UART.

Since I am using the bare SAMD21; I believe that the pins does not even have a default set. If anyone did start with a bare SAMD21, I would really appreciate some guidance about how did you set up the chip.

Datasheet link: http://www.atmel.com/Images/Atmel-42181-SAM-D21_Datasheet.pdf

Pinout : page 26
Muxing table: page 33 to 36

Best Answer

It is not unusual to see multifunction I/O pins on microcontrollers, so the tables in the datasheet (particularly table 7.1) identify the alternate functions associated with each pin (and by extension, the peripheral they can attach to internally).

This part is not much different from many variants using ARM Mx cores with multiple peripheral mappings.

The default pin function for all standard I/O pins is an ordinary digital I/O port (See the copied text from the datasheet at the bottom).

As an example, I will take a couple of lines from the table in question:

SAM D21 Mux Table

On the left is the physical pin (if it exists - depends on how many pins the package has and controller variant).

The next part is the port bit attached to the pin itself.

To the right of here is the supply pin(s) that actually power this I/O bit.

In the next column, we see I2C - this is explained in note 3:

  1. Only some pins can be used in SERCOM I2C mode. See the Type column for using a SERCOM pin in I2C mode. Refer to Electrical Characteristics for details on the I2C pin characteristics.

This tells me that I can only use pins with I2C against them for the serial control unit(s) to be able to use an I2C interface.

To the right are alternate functions (if any exist) of A to H.

PB13 for example, has alternate functions in

A: EXTINT[13] which attaches to the interrupt controller if selected.

B -> X(11) for the touch controller

C -> SERCOM (serial module controller) number four which will attach to PAD1 as documented in the SERCOM chapter in the datasheet.

D, F and G have no alternate function.

E and F permit the pin to operate as part of the Timer / Counter module

Function G attaches the pin to the I2S (audio) module.

Function H attaches the pin as a generic clock (See the clock description in section 14 for details).

To use any function, you must (at least)

  1. Turn on the clock associated with the function (or any writes to the peripheral are ignored - see the power manager module)

  2. Enable the specific peripheral function

  3. Programme the PMUX register(s) appropriately (see section 23.7).

  4. Enable the multiplexed function in PINCFGy by setting the PMUXEN bit for the specific pin.

  5. The other bits in PINCFGy must also be appropriately set.

Without knowing the specific setup you need, I cannot give further guidance.

Bit 0 – PMUXEN: Peripheral Multiplexer Enable This bit enables or disables the peripheral multiplexer selection set in the Peripheral Multiplexing register (PMUXn) to enable or disable alternative peripheral control over an I/O pin direction and output drive value. Writing a zero to this bit allows the PORT to control the pad direction via the Data Direction register (DIR) and output drive value via the Data Output Value register (OUT). The peripheral multiplexer value in PMUXn is ignored. Writing '1' to this bit enables the peripheral selection in PMUXn to control the pad. In this configuration, the physical pin state may still be read from the Data Input Value register (IN) if PINCFGy.INEN is set.

Related Topic