To simplify use Arduino environment refers to pins via numbers starting from 0. Additionally Arduino environment divides pins into digital ones and analog ones. There are 14 digital pins and 6 or 8 (depending on exact version of Arduino board) analog pins. However, one can use the first 6 analog pins as digital pins, the corresponding number is 14 plus "analog number" of the pin. Correspondence between Arduino numeration and ports is given by the following diagram:
ATMEL ATMEGA8, 168 and 328 / ARDUINO
+-\/-+
PC6 1| |28 PC5 (AI 5)
(D 0) PD0 2| |27 PC4 (AI 4)
(D 1) PD1 3| |26 PC3 (AI 3)
(D 2) PD2 4| |25 PC2 (AI 2)
PWM+ (D 3) PD3 5| |24 PC1 (AI 1)
(D 4) PD4 6| |23 PC0 (AI 0)
VCC 7| |22 GND
GND 8| |21 AREF
PB6 9| |20 AVCC
PB7 10| |19 PB5 (D 13)
PWM+ (D 5) PD5 11| |18 PB4 (D 12)
PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM
(D 7) PD7 13| |16 PB2 (D 10) PWM
(D 8) PB0 14| |15 PB1 (D 9) PWM
+----+
+-\/-+
VCC 1| |20 GND
(A0) P1.0 2| |19 XIN
(RX) (A1) P1.1 3| |18 XOUT
(TX) (A2) P1.2 4| |17 TEST
(A3) P1.3 5| |16 RST#
(A4) P1.4 6| |15 P1.7 (A7) (SCL) (MISO)
(A5) P1.5 7| |14 P1.6 (A6) (SDA) (MOSI)
P2.0 8| |13 P2.5
P2.1 9| |12 P2.4
P2.2 10| |11 P2.3
The TEST and RST pins are used by debugging interface so
normally can not be used for other purpose. However,
if there is no need for debugging, then both can be used
as normal outputs.
There are two LED-s and a two buttons on board attached
as follows:
P1.0 red LED P1.6 green LED P1.3 button S2 RST button S1 (RESET)One can disconnect each of LED-s removing appropriate jumper.
line Energia function
number
PF4 31 SW1
PF0 17 SW2
PF1 30 RGB LED (Red)
PF2 40 RGB LED (Blue)
PF3 39 RGD LED (Green)
Also line PB6 is connected to PD0, and PB7 is connected to PD1.
Line PD7 is connected to +5V from USB connector
via a 10 kOhm resistor (in order to detect voltage on USB).
This means that it is hard to use PD7 for other purpose.
More information, in particular
list of analog pins.
USB connector
Vcc Vcc
GND GND
PB8 but Vbat
PB7 15 14 PC13
PB6 16 13 PC14
PB5 17 12 PC15
PB4 18 reset
PB3 19 11 PA0
PA15 20 10 PA1
PA14 21 9 PA2
PA13 22 8 PA3
PA12 23 7 PA4
PA11 24 6 PA5
PA10 25 5 PA6
PA9 26 4 PA7
PA8 27 3 PB0
PB15 28 2 PB2
PB14 29 1 PB10
PB13 30 0 PB11
PB12 31 Vin
Pin PB1 has number 33 and is connected to the on-board LED, but
has no other connection. Pin PB9 is used to reset USB connection.
Minimal STM32F103C8T6 boards are similar to Maple Mini. However, instead of numbers they use line names. Also they have 32 kHz crystal connected to lines PC14 and PC15. Lines PA13 and PA14 (SWDIO and SWDCLK) are connected to debug connector. The LED on board is connected to line PC13 (to turn on the LED the output must be LOW!). Pin PB2 is connected via 100 kOhm resistor to a jumper. Unlike Maple Mini there is no user button (except for two biggest boards).
In fact, we have three different kinds of minimal STM32F103C8T6 boards. The smallest have four pin debugging connector. The other have 20 pin ARM JTAG connector. Middle one have double row pin headeres on both sides. The biggest have extra user button connected to PA0 and 24C01 eeprom connected to I2C1 (SCL do PB6, SDA do PB7).
----
NRST 1 | | 2 3.3V
5V 3 | | 4 TCK (SWCLK)
SWIM 5 | 6 TMS (SWDIO)
GND 7 | | 8 JTDI
SWIM RST 9 | | 10 JTDO
----
Note: Gap in the frame above corresponds to gap in physical
connector.
Bigger minimal STM32F103C8T6 boards contain 20-pin ARM debugging connector with the following pinout:
----
VREF 1 | | 2 VSUPPLY
nTRST 3 | | 4 GND
TDI 5 | | 6 GND
(SWDIO) TMS 7 | | 8 GND
(SWCLK) TCK 9 | 10 GND
RTCK 11 | 12 GND
TDO 13 | | 14 GND
nRST 15 | | 16 GND
DBGRQ 17 | | 18 GND
DGBACK 19 | | 20 GND
----
Note: Gap in the frame above corresponds to gap in physical
connector.