ALINX AN5640
Contents
ALINX AN5642 Dual Lens Camera Module User Manual
This manual provides detailed instructions for the ALINX AN5642 Dual Lens Camera Module. It covers product specifications, hardware connections, power-on sequences, register configurations, and operational procedures for various display modes.
1. Product Overview
The ALINX AN5642 is a dual-lens camera module that utilizes two OV5640 CMOS chip image sensors from OmniVision Corporation. It supports both independent and simultaneous display functions. Images are transmitted via the DVP interface for connection with an FPGA.

2. Product Specifications
The ALINX AN5642 Dual Lens Camera Module features the following parameters:
2.1. General Parameters
- Module Interface: 40-pin 0.1 inch spacing female header, 2-way camera with separate DVP interface
- Photosensitive Chip: 2 pieces of OV5640
- Hardware Pixel: 5 Million (5MP)
- Sensitive Size: 1/4"
- Lens Parameters: 5MP/M12 Interface, Focal Length 3.6mm, Monitoring angle 80-96 degrees
- Spacing: 40mm between the two cameras
- Module Content: OV5640 Power Supply Circuit and Clock (Flash Drive Circuit also mentioned in listing)
- Functional Support: Auto focus, Automatic Exposure Control (AEC), Automatic White Balance (AWB)
- Image Format: RAW RGB, RGB565/555/444, CCIR656, YUV422/420, YCbCr422, and compression
- Typical Application Fields: Smart Cameras and Vision Hardware
- Battery Included: No
- High-concerned chemical: None
2.2. Maximum Image Transfer Rate
- QSXGA (2592 x 1944): 15 fps
- 1080p: 30 fps
- 1280 x 960: 45 fps
- 720p: 60 fps
- VGA (640 x 480): 90 fps
- QVGA (320 x 240): 120 fps
2.3. Working Temperature
- Operating Temperature Range: -30°C to 70°C (PDF)
- Stable Working Temperature: 0°C to 50°C (PDF and Listing)
3. Hardware Connection
The AN5642 module connects to an FPGA development kit via its 40-pin female header. An ALINX AX516 development board is used as an example for connection.

3.1. Pin Assignment
The 40-pin female header pinout is detailed below:

| Pin | Pin Name | Pin | Pin Name |
|---|---|---|---|
| Pin1 | Ground | Pin2 | +5V |
| Pin3 | CMOS2_D9 | Pin4 | CMOS2_SDA |
| Pin5 | CMOS2_D6 | Pin6 | CMOS2_SCL |
| Pin7 | CMOS2_D7 | Pin8 | CMOS_D2 |
| Pin9 | CMOS2_HREF | Pin10 | CMOS2_D8 |
| Pin11 | CMOS2_D3 | Pin12 | CMOS2_RESET |
| Pin13 | CMOS2_D4 | Pin14 | CMOS2_D5 |
| Pin15 | CMOS2_D1 | Pin16 | CMOS2_D0 |
| Pin17 | CMOS2_VSYNC | Pin18 | CMOS2_PCLK |
| Pin19 | NC | Pin20 | CMOS1_SDA |
| Pin21 | CMOS1_D9 | Pin22 | CMOS1_D8 |
| Pin23 | CMOS1_SCL | Pin24 | CMOS1_D5 |
| Pin25 | CMOS1_D3 | Pin26 | CMOS1_D4 |
| Pin27 | CMOS1_D6 | Pin28 | CMOS1_D0 |
| Pin29 | CMOS1_D7 | Pin30 | CMOS1_D1 |
| Pin31 | CMOS1_D2 | Pin32 | CMOS1_PCLK |
| Pin33 | CMOS1_HREF | Pin34 | CMOS1_VSYNC |
| Pin35 | CMOS1_RESET | Pin36 | NC |
| Pin37 | Ground | Pin38 | Ground |
| Pin39 | +3.3V (or NC) | Pin40 | +3.3V (or NC) |
Signal Descriptions:
- CMOSx_D0~D9: Video image data captured by the OV5640 camera. For RGB format, only the upper 8 bits (D2~D9) are typically needed.
- CMOSx_PCLK: Pixel clock signal. Data is collected on the rising edge of this clock.
- CMOSx_HREF: Line valid signal. When high, one line of data is valid.
- CMOSx_VSYNC: Column sync signal.
3.2. Connection to FPGA Board
Simply plug the camera module directly into the expansion port of the development board. Ensure correct alignment of PIN1. For AX515 or AX530 development boards, it may need to be plugged into the J3 port.
4. Chip OV5640 Power-on Requirements
The OV5640 chip has specific power-on timing requirements:
4.1. Power-on Sequence Diagram

Timing Delays:
- t0: >= 0ms. Delay from DOVDD stable to AVDD stable.
- t2: >= 5ms. Delay from AVDD stable to sensor power up stable.
- t3: >= 1ms. Delay from sensor power up stable to Reset# pull high.
- t4: >= 20ms. Delay from Reset pull high to SCCB initialization.
4.2. Power-on Steps
- Step 1: Pull ResetB low to reset AN5640, and pull PWDN high.
- Step 2: Power up both DOVDD and AVDD simultaneously (implemented in the module's power supply design).
- Step 3: After AVDD stabilizes for 5ms, pull PWDN low.
- Step 4: After PWDN goes low for 1ms, pull ResetB high.
- Step 5: After 20ms, initialize OV5640 via SCCB.
5. Register Configuration of CMOS Chip OV5640
The OV5640's registers are configured through the I2C interface of the FPGA (or other CPU). Users must configure the correct register values for the desired image format. For example, to output 720P (1280x720) video in RGB565 format at 30fps.
5.1. Internal Test Images for Debugging
The OV5640 can generate internal test images like color bars and color squares for debugging purposes.
5.1.1. Color Bar
write_i2c(0x503d, 0x80);write_i2c(0x4741, 0x00);5.1.2. Color Square
write_i2c(0x503d, 0x82);write_i2c(0x4741, 0x0);5.2. Data Format Configuration
The data format of the OV5640 camera output is configured in the 0x4300 registers. For RGB565 output format, refer to the OV5640 application guide or datasheet for detailed register descriptions.
6. Operating Instructions: Binocular Display Experiments
6.1. Binocular Switching Display Experiment
This experiment displays the image from one of the two cameras on a VGA display. The displayed video image can be switched between cameras using the KEY1 button on the development board. Each video image is displayed at 720P resolution.
6.1.1. Programming Logic
The FPGA program design involves several modules:

Program Flow:
- After power-on, the FPGA configures the binocular camera registers via the I2C bus, setting the OV5640 to 720P 30-frame video output.
- The camera signal selection module selects one video stream from the two cameras to enter the camera data acquisition module.
- The camera data acquisition module converts the video image into 32-bit or 64-bit wide data and stores it in a write FIFO.
- When the write FIFO data reaches a threshold, a burst write signal is sent to the DDR read/write control module, which writes data from the FIFO to the DDR chip.
- If the read FIFO data falls below a threshold, a burst read signal is sent to the DDR read/write control module, which reads data from the DDR into the read FIFO.
- The VGA display module reads data from the read FIFO and displays the video image on the VGA display.
Key Modules:
- power_on_delay.v: Ensures OV5640 power-on timing requirements are met.
- reg_config.v: Configures OV5640 registers via I2C for both chips (e.g., RGB565 format, 1280x720 resolution).
- cmos_select.v: Detects KEY1 button presses to switch between CMOS1 and CMOS2 video signals (default is CMOS1).
- COMS_Capture.v: Converts 8-bit image data from OV5640 to 32-bit or 64-bit width, generating FIFO write signals. For RGB565, 16 bits of data require two 8-bit outputs (2 clocks), so a 720P image row needs 1280 * 2 PCLK clocks.
- dcfifo_ctrl.v: Manages two FIFOs (write and read) for buffering data between the camera, DDR, and VGA display.
- mem_ctrl.v: Converts external burst read/write requests into DDR IP Local Bus signals, simplifying DDR access.
- ddr3_top.v: DDR controller module generated by Xilinx/Altera IP.
- vga_disp.v: Implements VGA display, generating sync signals and timing for image data (e.g., 1280x768@79.5MHz, 60Hz). It also centers the 1280x720 image within the 1280x768 VGA display by leaving the first and last 24 lines black.
- bank_switch.v: Manages DDR read/write operations across different memory banks to prevent image distortion.
- system_ctrl.v: Generates camera clock (24MHz), VGA image clock (79.5MHz), and system reset signals.
6.1.2. Experiment Procedure
- Write the FPGA program.
- Assign the pins of the FPGA.
- Recompile the project.
- Connect the AN5642 camera module to the development board.
- Connect a VGA display to the VGA interface of the development board.
- Download the .sof file to the FPGA.
- Observe the 1280x768 video images on the VGA display. By default, CMOS1 video is displayed.
- Press the development board button KEY1 to switch to the CMOS2 video image.

6.2. OV5642 Binocular Display Simultaneously Experiment
This experiment simultaneously displays video images from both cameras on a VGA display. The CMOS1 camera image is shown on the left side, and the CMOS2 camera image is shown on the right side. The VGA output resolution remains 1280x768, while each camera (CMOS1 and CMOS2) outputs at 640x480 resolution.
6.2.1. Programming Logic
For simultaneous display, additional read and write data FIFOs are required for the second camera's video storage. Multi-port arbitration programs for DDR read and write (ddr multiple port read arbitration and ddr multiple port write arbitration) are also added.
Key Modules:
- mem_read_arbi.v (Multi-port DDR read arbitration module): Polls four input ports (ch0~ch3). If a port has a read request and a non-zero read burst length, it enters the read state for that port and outputs the burst read request. This ensures no read requests are lost.
- mem_write_arbi.v (Multi-port DDR write arbitration module): Operates on the same polling principle as the read arbitration module.
6.2.2. Experiment Procedure
- Write the FPGA program.
- Assign the pins of the FPGA.
- Recompile the project.
- Connect the AN5642 camera module to the development board.
- Connect a VGA display to the VGA interface of the development board.
- Download the .sof file to the FPGA.
- Observe the video images from both cameras displayed simultaneously on the VGA monitor.
6.2.3. Picture-in-Picture Effect
Users can modify the program to display different video image sizes (e.g., CMOS1 at 1280x720, CMOS2 at 640x480) and achieve a picture-in-picture effect on the VGA display.
7. Troubleshooting and Adjustments
7.1. Adjusting Focus
If the captured video image appears unclear, rotate the corresponding camera lens to adjust its focus.
8. Safety Information
- Be careful not to connect the wrong power supply.
- Pay attention to anti-static precautions when handling the module.
9. Technical Support and Customer Service
For any errors, technical assistance, or instant quotes, please use the following contact information:
- Wechat/Skype/WhatsApp/Teams: (+86) 15026866269
- Technical Email: support@aithtech.com
- Instant Quote Email: sales@aithtech.com
Seller-listed specifications
| Specification | Seller values |
|---|---|
| Battery Included | no |
| Typical Application Fields | Smart Cameras and Vision Hardware |
| High-concerned chemical | None |
| Model Number | AN5640 |
| Origin | Mainland China |
| FPGA Module | AN5642 |
| Interface | 40-pin 0.1 inch spacing female header |
| Pixel | Hardware Pixel 5 Million |
| Photosensitive Chip | 2 Pieces of OV5640 |
| Sensitive Size | 1/4 |
| Lens Parameters | 5MP/M12 Interface, Focal Length 3.6mm, Monitoring angle 80-96 degrees |
| Module Content | OV5640 Power Supply Circuit and Flash Drive Circuit |
| Functional Support | Auto focus, Automatic Exposure Control (AEC), Automatic White Balance (AWB) |
| Image Format | RAW RGB, RGB565/555/444, CCIR656, YUV422/420,YCbCr422 and compression |
| Capture Picture | QSXGA (2592 x 1944),1080p,1280 x 960, VGA(640 x 480), QVGA(320 x 240) |
| Working Temperature | '0℃~50℃ |
| Spacing | 40mm between Two Cameras |
Documents and downloads
Ask a question about this manual
Ask about setup, troubleshooting, compatibility, parts, safety, or missing instructions. Manuals+ will review the question and use this page’s manual context to help answer it.