> For the complete documentation index, see [llms.txt](https://bananapi.gitbook.io/banana-pi-bpi-m2-magic-iot-development-board/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/banana-pi-bpi-m2-magic-iot-development-board/chapter1/bpi-m2-magic-csi-camera-interface.md).

# BPI-M2 Magic CSI camera interface

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 “CSI″.

\
**BPI-M2 Magic CSI camera accessories**

note: for BPI-M2 Magic , camera is same as BPI-M2+, it support OV5640 module, not need extend board. you just can direct use OV5640 modue on CSI interface.

![](/files/-M2HXGUifh4857hNaL8N)

**CSI Camera Connector 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 “Camera”.

**CSI Pin Name**

|         | **Default Function** | **Function2：GPIO** |
| ------- | -------------------- | ------------------ |
| CN3-P01 | NC                   |                    |
| CN3-P02 | GND                  |                    |
| CN3-P03 | CSI0-SDA             | PE13               |
| CN3-P04 | CSI0-AVDD            |                    |
| CN3-P05 | CSI0-SCK             | PE12               |
| CN3-P06 | CSI0-Reset           | PE14               |
| CN3-P07 | CSI0-VSYNC           | PE3                |
| CN3-P08 | CSI0-PWDN            | PE15               |
| CN3-P09 | CSI0-HSYNC           | PE2                |
| CN3-P10 | CSI0-DVDD            |                    |
| CN3-P11 | CSI0-DOVDD           |                    |
| CN3-P12 | CSI0-D7              | PE11               |
| CN3-P13 | CSI0-MCLK            | PE1                |
| CN3-P14 | CSI0-D6              | PE10               |
| CN3-P15 | GND                  |                    |
| CN3-P16 | CSI0-D5              | PE9                |
| CN3-P17 | CSI0-PCLK            | PE0                |
| CN3-P18 | CSI0-D4              | PE8                |
| CN3-P19 | CSI0-D0              | PE4                |
| CN3-P20 | CSI0-D3              | PE7                |
| CN3-P21 | CSI0-D1              | PE5                |
| CN3-P22 | CSI0-D2              | PE6                |
| CN3-P23 | GND                  |                    |
| CN3-P24 | CSI0-AFVCC           |                    |

**OV5640 driver:**

This is my modified OV5640 driver for the CMOS camera that incorporates many image resolutions and/or image quality. You can take advantage of a higher FPS, Image Quality (Preview or Capture) or Window size, choosing the one that best fit your needs.

This is expected to work with reasonable quality for AW platform (32 bit and 64 bit).

Working window sizes and expected FPS (preview mode)

* QSXGA: 2592x1936 (7.5 FPS)
* QXGA: 2048x1536 (7.5 FPS)
* 1080P: 1920x1080 (7.5 FPS, 15 FPS)
* UXGA: 1600x1200 (7.5 FPS, 15 FPS)
* UXGA: 1280x960 (7.5 FPS, 15 FPS)
* 720P: 1280x720 (7.5 FPS, 15 FPS)
* XGA: 1024x768 (7.5 FPS, 15 FPS)
* SVGA: 800x600 (15 FPS, 30 FPS)
* VGA: 640x480 (15 FPS, 30 FPS)
* QVGA: 320x240 (30 FPS)
* QCIF: 176x144 (30 FPS with some artifacts)

The OV5640 has been updated to work on M64 (<https://github.com/avafinger/ov5640/tree/A64>)

from Alex of camera developer., thank Alex do this cool work.


---

# 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/banana-pi-bpi-m2-magic-iot-development-board/chapter1/bpi-m2-magic-csi-camera-interface.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.
