> For the complete documentation index, see [llms.txt](https://bananapi.gitbook.io/bpi-m2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bananapi.gitbook.io/bpi-m2/zh/bpi-m2_gpio_pin_define.md).

# BPI-M2 GPIO Pin define

Banana Pi has a 40-pin GPIO header that matches that of the Model B+ Raspberry Pi. Following is the Banana Pi GPIO Pinout:

![](/files/-M2HXMW36VzpUJ2du6me)

| GPIO Pin Name | Default Function | Function2：GPIO |
| ------------- | ---------------- | -------------- |
| CN7-P01       | VCC-3V3          |                |
| CN7-P02       | VCC-DC           |                |
| CN7-P03       | TWI2-SDA         | PH19           |
| CN7-P04       | VCC-DC           |                |
| CN7-P05       | TWI2-SCK         | PH18           |
| CN7-P06       | GND              |                |
| CN7-P07       | PWM1-P           | PH9            |
| CN7-P08       | UART5\_TX        | PE4            |
| CN7-P09       | GND              |                |
| CN7-P10       | UART5\_RX        | PE5            |
| CN7-P11       | UART2\_RX        | PG7            |
| CN7-P12       | PWM1-N           | PH10           |
| CN7-P13       | UART2\_TX        | PG6            |
| CN7-P14       | GND              |                |
| CN7-P15       | UART2\_CTS       | PG9            |
| CN7-P16       | PWM2-P           | PH11           |
| CN7-P17       | VCC-3V3          |                |
| CN7-P18       | PWM2-N           | PH12           |
| CN7-P19       | SPI1\_MOSI       | PG15           |
| CN7-P20       | GND              |                |
| CN7-P21       | SPI1\_MISO       | PG16           |
| CN7-P22       | UART2\_RTS       | PG8            |
| CN7-P23       | SPI1\_CLK        | PG14           |
| CN7-P24       | SPI1\_CS0        | PG13           |
| CN7-P25       | GND              |                |
| CN7-P26       | SPI1\_CS1        | PG12           |
| CN7-P27       | TWI3-SDA         | PB6            |
| CN7-P28       | TWI3-SCK         | PB5            |
| CN7-P29       | I2S-MCLK         | PB0            |
| CN7-P30       | GND              |                |
| CN7-P31       | I2S-BCLK         | PB1            |
| CN7-P32       | I2S-DI           | PB7            |
| CN7-P33       | I2S-LRCK         | PB2            |
| CN7-P34       | GND              |                |
| CN7-P35       | I2S-DO0          | PB3            |
| CN7-P36       | UART5\_RTS       | PE6            |
| CN7-P37       | I2S-DO1          | PB4            |
| CN7-P38       | UART5\_CTS       | PE7            |
| CN7-P39       | GND              |                |
| CN7-P40       | 1WIRE            | PM2            |

**CSI Camera Connector Pin specification:**

the CSI Camera Connector is a 40-pin FPC connector which can connect external camera module with proper signal pin mappings. The pin definitions of the CSI interface are shown as below. This is marked on the Banana Pi board as “CN6″.

| CSI Pin Name | Default Function | Function2：GPIO |   |
| ------------ | ---------------- | -------------- | - |
| CN6-P01      | LINEINL          |                |   |
| CN6-P02      | LINEINR          |                |   |
| CN6-P03      | VCC-CSI          |                |   |
| CN6-P04      | AVDD-CSI         |                |   |
| CN6-P05      | GND              |                |   |
| CN6-P06      | VDD-CSI          |                |   |
| CN6-P07      | MIC2P            |                |   |
| CN6-P08      | VCC-CSI          |                |   |
| CN6-P09      | MIC2N            |                |   |
| CN6-P10      | AFVCC-CSI        |                |   |
| CN6-P11      | GND              |                |   |
| CN6-P12      | CSI-IO0          | PM0            |   |
| CN6-P13      | LRADC0           |                |   |
| CN6-P14      | TWI0-SDA         | PH15           |   |
| CN6-P15      | MIC-MBIAS        |                |   |
| CN6-P16      | TWI0-SCK         | PH14           |   |
| CN6-P17      | CSI-D4           | PE8            |   |
| CN6-P18      | CSI0-STBY-EN     | PH27           |   |
| CN6-P19      | CSI-D5           | PE9            |   |
| CN6-P20      | CSI-PCLK         | PE0            |   |
| CN6-P21      | CSI-D6           | PE10           |   |
| CN6-P22      | CSI0-PWR-EN      | PG18           |   |
| CN6-P23      | CSI-D7           | PE11           |   |
| CN6-P24      | CSI-MCLK         | PE1            |   |
| CN6-P25      | CSI-D8           | PE12           |   |
| CN6-P26      | CSI0-RESET#      | PH26           |   |
| CN6-P27      | CSI-D9           | PE13           |   |
| CN6-P28      | CSI-VSYNC        | PE3            |   |
| CN6-P29      | CSI-D10          | PE14           |   |
| CN6-P30      | CSI-HSYNC        | PE2            |   |
| CN6-P31      | CSI-D11          | PE15           |   |
| CN6-P32      | CSI1-STBY-EN     | PH25           |   |
| CN6-P33      | AP-RESET#        |                |   |
| CN6-P34      | CSI1-RESET#      | PH24           |   |
| CN6-P35      | CSI-IO1          | PM1            |   |
| CN6-P36      | HPR              |                |   |
| CN6-P37      | HPL              |                |   |
| CN6-P38      | IPSOUT           |                |   |
| CN6-P39      | GND              |                |   |
| CN6-P40      | IPSOUT           |                |   |

**LVDS Pin specification**

LVDS (LCD display interface)

The LVDS Connector is a 40-pin FPC connector which can connect external LCD panel (LVDS) and touch screen (I2C) module as well. The pin definitions of this connector are shown as below. This is marked on the Banana Pi board as “CN9″.

| DSI Pin Name | Default Function | Function2：GPIO |
| ------------ | ---------------- | -------------- |
| CN9-P01      | IPSOUT           |                |
| CN9-P02      | TWI1-SDA         | PH15           |
| CN9-P03      | IPSOUT           |                |
| CN9-P04      | TWI1-SCK         | PH16           |
| CN9-P05      | GND              |                |
| CN9-P06      | TP-INT           | PG0            |
| CN9-P07      | LCD-PWR-EN       | PG4            |
| CN9-P08      | TP-RST           | PG1            |
| CN9-P09      | LCD0-D00         | PD0            |
| CN9-P10      | LCD0-PWM         | PH13           |
| CN9-P11      | LCD0-D01         | PD1            |
| CN9-P12      | LCD0-BL-EN       | PG3            |
| CN9-P13      | LCD0-D02         | PD2            |
| CN9-P14      | LCD0-DE          | PD25           |
| CN9-P15      | LCD0-D03         | PD3            |
| CN9-P16      | LCD0-VSYNC       | PD27           |
| CN9-P17      | LCD0-D04         | PD4            |
| CN9-P18      | LCD0-HSYNC       | PD26           |
| CN9-P19      | LCD0-D05         | PD5            |
| CN9-P20      | LCD0-CS          | PG2            |
| CN9-P21      | LCD0-D06         | PD6            |
| CN9-P22      | LCD0-CLK         | PD24           |
| CN9-P23      | LCD0-D07         | PD7            |
| CN9-P24      | GND              |                |
| CN9-P25      | LCD0-D08         | PD8            |
| CN9-P26      | LCD0-D23         | PD23           |
| CN9-P27      | LCD0-D09         | PD9            |
| CN9-P28      | LCD0-D22         | PD22           |
| CN9-P29      | LCD0-D10         | PD10           |
| CN9-P30      | LCD0-D21         | PD21           |
| CN9-P31      | LCD0-D11         | PD11           |
| CN9-P32      | LCD0-D20         | PD20           |
| CN9-P33      | LCD0-D12         | PD12           |
| CN9-P34      | LCD0-D19         | PD19           |
| CN9-P35      | LCD0-D13         | PD13           |
| CN9-P36      | LCD0-D18         | PD18           |
| CN9-P37      | LCD0-D14         | PD14           |
| CN9-P38      | LCD0-D17         | PD17           |
| CN9-P39      | LCD0-D15         | PD15           |
| CN9-P40      | LCD0-D16         | PD16           |

**UART Pin specification:**

The header CON4 is the UART interface. For developers of Banana Pi, this is an easy way to get the UART console output to check the system status and log message.

| CN8  Pin Name | Default Function | GPIO |   |
| ------------- | ---------------- | ---- | - |
| CN8 P03       | UART0-TXD        | PH20 |   |
| CN8 P02       | UART0-RXD        | PH21 |   |
| CN8 P01       | GND              |      |   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bananapi.gitbook.io/bpi-m2/zh/bpi-m2_gpio_pin_define.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
