vbox-firmware/azero_pins.md

12 KiB

SAMD21 Pinout Table

Pin Number Board Pin Pin Label/Name Comments
Digital Low
0 0 -> RX PA11 EIC/EXTINT[11] ADC/AIN[19] PTC/X[3] *SERCOM0/PAD[3] SERCOM2/PAD[3] TCC0/WO[3] TCC1/WO[1]
1 1 <- TX PA10 EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0]
2 2 PA14 EIC/EXTINT[14] SERCOM2/PAD[2] SERCOM4/PAD[2] TC3/WO[0] TCC0/WO[4]
3 ~3 PA09 EIC/EXTINT[9] ADC/AIN[17] PTC/X[1] SERCOM0/PAD[1] SERCOM2/PAD[1] *TCC0/WO[1] TCC1/WO[3]
4 ~4 PA08 EIC/NMI ADC/AIN[16] PTC/X[0] SERCOM0/PAD[0] SERCOM2/PAD[0] *TCC0/WO[0] TCC1/WO[2]
5 ~5 PA15 EIC/EXTINT[15] SERCOM2/PAD[3] SERCOM4/PAD[3] *TC3/WO[1] TCC0/WO[5]
6 ~6 PA20 EIC/EXTINT[4] PTC/X[8] SERCOM5/PAD[2] SERCOM3/PAD[2] *TCC0/WO[6]
7 7 PA21 EIC/EXTINT[5] PTC/X[9] SERCOM5/PAD[3] SERCOM3/PAD[3] TCC0/WO[7]
Digital High
8 ~8 PA06 EIC/EXTINT[6] ADC/AIN[6] AC/AIN[2] PTC/Y[4] SERCOM0/PAD[2] *TCC1/WO[0]
9 ~9 PA07 EIC/EXTINT[7] ADC/AIN[7] AC/AIN[3] PTC/Y[5] SERCOM0/PAD[3] *TCC1/WO[1]
10 ~10 PA18 EIC/EXTINT[2] PTC/X[6] +SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2]
11 ~11 PA16 EIC/EXTINT[0] PTC/X[4] +SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6]
12 ~12 PA19 EIC/EXTINT[3] PTC/X[7] +SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] *TCC0/WO[3]
13 ~13 PA17 EIC/EXTINT[1] PTC/X[5] +SERCOM1/PAD[1] SERCOM3/PAD[1] *TCC2/WO[1] TCC0/WO[7]
Analog Connector
14 A0 PA02 EIC/EXTINT[2] *ADC/AIN[0] DAC/VOUT PTC/Y[0]
15 A1 PB08 EIC/EXTINT[8] *ADC/AIN[2] PTC/Y[14] SERCOM4/PAD[0] TC4/WO[0]
16 A2 PB09 EIC/EXTINT[9] *ADC/AIN[3] PTC/Y[15] SERCOM4/PAD[1] TC4/WO[1]
17 A3 PA04 EIC/EXTINT[4] *ADC/AIN[4] AC/AIN[0] PTC/Y[2] SERCOM0/PAD[0] TCC0/WO[0]
18 A4 PA05 EIC/EXTINT[5] *ADC/AIN[5] AC/AIN[1] PTC/Y[5] SERCOM0/PAD[1] TCC0/WO[1]
19 A5 PB02 EIC/EXTINT[2] *ADC/AIN[10] PTC/Y[8] SERCOM5/PAD[0]
Wire
20 SDA PA22 EIC/EXTINT[6] PTC/X[10] *SERCOM3/PAD[0] SERCOM5/PAD[0] TC4/WO[0] TCC0/WO[4]
21 SCL PA23 EIC/EXTINT[7] PTC/X[11] *SERCOM3/PAD[1] SERCOM5/PAD[1] TC4/WO[1] TCC0/WO[5]
SPI (Legacy ICSP)
22 1 PA12 EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6]
2
23 4 PB10 EIC/EXTINT[10] *SERCOM4/PAD[2] TC5/WO[0] TCC0/WO[4]
24 3 PB11 EIC/EXTINT[11] *SERCOM4/PAD[3] TC5/WO[1] TCC0/WO[5]
5
6
USB
27 PA28 EIC/EXTINT[8]
28 PA24 *USB/DM
29 PA25 *USB/DP
LEDs
25 PB03
26 PA27
EDBG
30 PB22 *SERCOM5/PAD[2]
31 PB23 *SERCOM5/PAD[3]
32 PA22 Pin 20 (SDA)
33 PA23 Pin 21 (SCL)
34 PA19 EIC/EXTINT[3] *SERCOM1/PAD[3] SERCOM3/PAD[3] TC3/WO[1] TCC0/WO[3]
35 PA16 EIC/EXTINT[0] *SERCOM1/PAD[0] SERCOM3/PAD[0] TCC2/WO[0] TCC0/WO[6]
36 PA18 EIC/EXTINT[2] *SERCOM1/PAD[2] SERCOM3/PAD[2] TC3/WO[0] TCC0/WO[2]
45 PA31 SWDIO, alternate use EXTINT[11] TCC1/WO[1] SERCOM1/PAD[3]
37 PA17 EIC/EXTINT[1] *SERCOM1/PAD[1] SERCOM3/PAD[1] TCC2/WO[1] TCC0/WO[7]
38 ATN PA13 EIC/EXTINT[13] SERCOM2/PAD[1] SERCOM4/PAD[1] *TCC2/WO[1] TCC0/WO[7]
39 PA21 Pin 7
40 PA06 Pin 8
41 PA07 Pin 9
GND
42 AREF PA03 EIC/EXTINT[3] *[ADC
43 PA02 Alternate use of A0 (DAC output)
44 PA30 SWCLK, alternate use EXTINT[10] TCC1/WO[0] SERCOM1/PAD[2]

what does EIC/EXTINT[11] means ?

In the context of the SAMD21 microcontroller, EIC/EXTINT[11] is a reference to a specific external interrupt configuration on pin PA11 (or other associated pins depending on the device's pin mapping).

Breakdown of Terms

  • EIC:

    • Stands for External Interrupt Controller.
    • The EIC manages external interrupts from the microcontroller's I/O pins.
  • EXTINT[11]:

    • Refers to External Interrupt Line 11.
    • The number inside the brackets (11) identifies which external interrupt line is associated with the specific pin.
    • In this example, PA11 would likely be mapped to EXTINT[11].

How It Works

When PA11 is configured with EIC/EXTINT[11], it means the pin can trigger an interrupt when a specific signal change (rising edge, falling edge, or level change) occurs.

Typical Usage

  1. Wake-up from Sleep: External interrupts can wake up the SAMD21 from a low-power state.
  2. Button Press Detection: Connecting a button to PA11 and enabling the EXTINT[11] interrupt allows the microcontroller to handle button events asynchronously.
  3. Event-Driven Systems: Useful for monitoring external signals without constantly polling the pin.

Example in Code

Using Arduino with the SAMD21:

attachInterrupt(digitalPinToInterrupt(11), myInterruptHandler, RISING);

In this example:

  • The digitalPinToInterrupt(11) would map to PA11 with EXTINT[11] behind the scenes.
  • RISING triggers the interrupt on a rising edge.

what does PTC/X[3] means ?

PTC/X[3] on the SAMD21 refers to a specific pin's capability as part of the Peripheral Touch Controller (PTC).

Breakdown

  • PTC:

    • Stands for Peripheral Touch Controller.
    • This is a hardware module on the SAMD21 designed for capacitive touch sensing applications, such as touch buttons, sliders, and wheels.
  • X[3]:

    • The X-line 3 refers to one of the electrode channels used for touch detection.
    • The PTC uses a matrix of X-lines (transmitter) and Y-lines (receiver) to measure capacitance changes on a touch-sensitive electrode.

How It Works

  • Each X-line is connected to a specific GPIO pin on the microcontroller.
  • When configured for touch sensing, the pin generates a signal to detect changes in capacitance caused by a finger touching the corresponding electrode.

Example Use Case

If you're designing a capacitive touch button using X[3], you would:

  1. Connect the electrode to the pin corresponding to PTC/X[3].
  2. Enable and configure the PTC in your firmware to monitor capacitance changes on this pin.

Why It Matters

  • Using PTC/X[3] allows you to implement touch-sensitive controls without needing additional external ICs.
  • The SAMD21 provides efficient touch sensing hardware, reducing the need for software-based polling.