Using GPIOs in Arduino with flipper board

tags: flipper, Arduino, GPIO

If you need to use a flipper GPIO in Arduino, you need to find the arduino name of the GPIO :

To do so, use following table and check for the arduino name of the GPIO you want to use.
The GPIOs are described in the following spreadsheet file: gpio_flipper.xlsx

Header 1 (J402)
expander pin	port	pin	identifier	rôle	name in arduino	PinMap Pos
1	VIN
2	GND
3	VCC
4	BRD_EN
5	VCC_SW_EN
6	3V3_SW_EN
7	0	11	11	I2C0_SDA	PIN_WIRE_SDA	0
8	3V3
9	0	8	8	I2C0_SCL	PIN_WIRE_SCL	1
10	1	8	40	SPI0_MISO	PIN_SPI_MISO	2
11	0	6	6	SPI0_MOSI	PIN_SPI_MOSI	3
12	0	25	25	SPIO_CS1	SS2	4
13	0	4	4	SPIO_SCLK	PIN_SPI_SCK	5
14	0	14	14	UART1_TX	PIN_SERIAL2_TX	6
15	0	16	16	UART1_RX	PIN_SERIAL2_TX	7
16	0	13	13	UART0_TX	PIN_SERIAL1_TX	8
17	0	15	15	UART0_RX	PIN_SERIAL1_RX	9
18	EXT_RST
19	GND
20	VUSB
Header 2 (J401)
expander pin	port	pin	identifier	rôle	PinMap Pos
21	VBAT
22	GND
23	VDD_SW_EN
24	3V3_SW_EN
25	1	1	33	user_defined	EXP_25	10
26	0	12	12	I2C1_SDA	PIN_WIRE1_SDA	11
27	1	11	43	user_defined	EXP_27	12
28	1	9	41	I2C1_SCL	PIN_WIRE1_SCL	13
29	0	30	30	user_defined/AIN6	EXP_29	14
30	1	13	45	user_defined	EXP_30	15
31	0	2	2	user_defined/AIN0	EXP_31	16
32	0	28	28	user_defined/AIN7	EXP_32	17
33	1	10	42	LED_BLUE	LED_BLUE	18
34	0	29	29	user_defined/AIN5	EXP_34	19
35	1	7	39	LED_GREEN	LED_GREEN	20
36	0	3	3	user_defined/EN_EXP	EXP_36	21
37	1	5	37	LED_RED	LED_RED	22
38	1	6	38	USER_BTN	PIN_BUTTON1	23
39	0	9	9	user_defined	EXP_39	24
40	0	10	10	user_defined	EXP_40	25
On Board QSPI FLASH
QSPI pin	port	pin	identifier	rôle	PinMap Pos
6	0	19	19	FLASH_CLK	PIN_QSPI_SCK	26
1	0	17	17	FLASH_CS	PIN_QSPI_CS	27
5	0	20	20	FLASH_IO0/FLASH_MOSI	PIN_QSPI_IO0	28
2	0	21	21	FLASH_IO1/FLASH_MISO	PIN_QSPI_IO1	29
3	0	22	22	FLASH_IO2	PIN_QSPI_IO2	30
7	0	23	23	FLASH_IO3	PIN_QSPI_IO3	31
On Board SD CARD READER
SD pin	port	pin	identifier	rôle	PinMap Pos
5	0	7	7	SD_SPI_SCLK	PIN_SPI1_SCK	32
2	0	5	5	SD_SPI_CS	SS1	33
3	0	27	27	SD_SPI_MOSI	PIN_SPI1_MOSI	34
7	0	26	26	SD_SPI_MISO	PIN_SPI1_MISO	35
TPS	1	15	47	SD_EN_PIN	SDCARD_EN_PIN	36
9	1	14	46	SD_DETECT_PIN	SDCARD_DETECT_PIN	37
Xlbee pins
Xlbee pin	port	pin	identifier	rôle	PinMap Pos
U302(3)	1	3	35	MCU_XLB_EN	XLB_EN	38
5	1	2	34	!XLB_RST!	XLB_RST	39
37	0	31	31	SPI0_CS0	SS	40
Analog Pins
Analog pin	port	pin	identifier	rôle	PinMap Pos
VBAT_MES	0	24	24	AIN7	PIN_A0	41
Output Voltage Enablers
TPS pin	port	pin	identifier	rôle	PinMap Pos
U304(3)	1	12	44	3V3_SW_EN	SW_3V3_EN	42
U305(3)	1	4	36	VDD_SW_EN	SW_VDD_EN	43

Then you can use it and declare it as an INPUT or an OUTPUT using pinMode() function.

If it is an output you can set its state using digitalWrite() function.

For example we want to activate 3V3_SW, it is a power-rail that is commanded by the GPIO : 3V3_SW_EN.

The corresponding arduino name is : SW_3V3_EN.

In our arduino sketch we can write :

This will configure SW_3V3_EN as an output and set its state to high=1. So it will activate our power rail 3V3_SW.