Port Mapping

IO Pins

Pin numbers below refer to the pin on the RF220 Series footprint. To reference the pins in your code, use the SNAPpy IO number from the table below:

RF220 Pin SNAPpy IO ATmega128RFA1 Description
1 N/A GND Power Supply
2 7 GPIO0 OC0A OC1C PCINT7 PB7 GPIO_0 or PWM or Interrupt
3 6 GPIO1 OC1B PCINT6 PB6 GPIO_1 or PWM or Interrupt
4 5 GPIO2 OC1A PCINT5 PB5 GPIO_2 or PWM or Interrupt
5 16 GPIO3 RXD0 PCINT8 PE0 GPIO_3 or UART0 Data In or Interrupt
6 17 GPIO4 TXD0 PE1 GPIO_4 or UART0 Data Out
7 20 GPIO5 OC3B INT4 PE4 GPIO_5 or UART0 CTS Output or PWM or Interrupt
8 21 GPIO6 OC3C INT5 PE5 GPIO_6 or UART0 RTS Input or PWM or Interrupt
9 10 GPIO7 RXD1 INT2 PD2 GPIO_7 or UART1 Data In or Interrupt
10 11 GPIO8 TXD1 INT3 PD3 GPIO_8 or UART1 Data Out or Interrupt
11 12 GPIO9 CTS1 ICP1 PD4 GPIO_9 or UART1 CTS Output or Input Capture
12 23 GPIO10 RTS1 ICP3 INT7 CLKO GPIO_10 or UART1 RTS Input or Clock Output Buffer or Interrupt
13 24 GPIO11 ADC0 PF0 GPIO_11 or Analog0
14 25 GPIO12 ADC1 MOSI PF1 GPIO_12 or Analog1 or SPI MOSI
15 26 GPIO13 ADC2 DIG2 SCLK PF2 GPIO_13 or Analog2 or SPI CLK or Antenna Diversity Control
16 18 GPIO14 XCK0 AIN0 MISO PE2 GPIO_14 or SPI MISO or Analog Comparator or External Clock
17 28 GPIO15 ADC4 TCK PF4 GPIO_15 or Analog4 or JTAG Test Clock
18 29 GPIO16 ADC5 TMS PF5 GPIO_16 or Analog5 or JTAG Test Mode Select
19 30 GPIO17 ADC6 TDO SDA PF6 GPIO_17 or Analog6 or JTAG Test Data Out or I2C SDA
20 31 GPIO18 ADC7 TDI SCL PF7 GPIO_18 or Analog7 or JTAG Test Data In or I2C SCL
21 N/A VCC Power Supply
22 19 GPIO19 OC3A AIN1 PE3 GPIO_19 or Analog Comparator or PWM or Output Compare Match
23 N/A RESET* Module Reset, Active Low
24 N/A GND Power Supply

Note

The SPI and I2C locations are different on the RF220 Series than they are on the ATMEL ATmega128RFA1 chip.

Digital IO

The RF220 Series supports 20 digital IO:

SNAPpy IO RF220 Series Pin ATmega128RFA1
5 4 GPIO2
6 3 GPIO1
7 2 GPIO0
10 9 GPIO7
11 10 GPIO8
12 11 GPIO9
16 5 GPIO3
17 6 GPIO4
18 16 GPIO14
19 22 GPIO19
20 7 GPIO5
21 8 GPIO6
23 12 GPIO10
24 13 GPIO11
25 14 GPIO12
26 15 GPIO13
28 17 GPIO15
29 18 GPIO16
30 19 GPIO17
31 20 GPIO18

Wakeup Pins

Nine of the IO pins can be used to wake a sleeping module:

SNAPpy IO RF220 Pin ATmega128RFA1
5 4 GPIO2
6 3 GPIO1
7 2 GPIO0
10 9 GPIO7
11 10 GPIO8
16 5 GPIO3
20 7 GPIO5
21 8 GPIO6
23 12 GPIO10

Note

Setting the unit to wake from an edge-triggered signal using pins 7, 8, or 12 will work, but it will result in higher power consumption during sleep. If you must have an edge-triggered wake signal, it is recommended you use a different pin.

Analog Inputs

Seven of the IO pins can be used as ADC inputs:

readAdc() channel SNAPpy IO RF220 Pin ATmega128RFA1
0 24 13 PF0 ADC0
1 25 14 PF1 ADC1
2 26 15 PF2 ADC2
4 28 17 PF4 ADC4
5 29 18 PF5 ADC5
6 30 19 PF6 ADC6
7 31 20 PF7 ADC7

Serial Port 0

Four of the IO pins can function as UART 0:

SNAPpy IO RF220 Pin ATmega128RFA1
16 5 UART0 Data In
17 6 UART0 Data Out
20 7 UART0 CTS Output
21 8 UART0 RTS Input

If you do not need RTS/CTS signals, then pins 7 and 8 are available for other usage.

Serial Port 1

Four of the IO pins can function as UART 1:

SNAPpy IO RF220 Pin ATmega128RFA1
10 9 UART1 Data In
11 10 UART1 Data Out
12 11 UART1 CTS Output
23 12 UART1 RTS Input

If you do not need RTS/CTS signals, then pins 11 and 12 are available for other usage.

Pulse Width Modulation

Six of the IO pins can optionally be used as Pulse Width Modulation (PWM) outputs:

SNAPpy IO RF220 Pin ATmega128RFA1
5 4 PWM
6 3 PWM
7 2 PWM
19 22 PWM
20 7 PWM
21 8 PWM

SPI

Three of the IO pins can optionally function as a SPI bus:

SNAPpy IO RF220 Pin ATmega128RFA1
18 16 MISO
25 14 MOSI
26 15 SCLK

These are not the hardware SPI pins. SNAPpy SPI is done via software emulation.

You will also need one “SPI Chip Select” pin per external SPI device. Any available IO pin can be used for this purpose.

I2C

Two of the IO pins can optionally function as an I2C bus:

SNAPpy IO RF220 Pin ATmega128RFA1
21 20 SCL
30 19 SDA

These are not the hardware I2C pins. SNAPpy I2C is done via software emulation.

Starting with SNAP 2.5, you can also call i2cInit() with three parameters:

i2cInit(enablePullups, SCL_pin, SDA_pin)

The second and third parameters allow you to “move” the I2C pins to another pair of IO pins on the chip.