> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Camera

The IQ9-EVK supports camera sensor connectivity through four MIPI CSI interfaces, supporting both C-PHY and D-PHY modes.

## Hardware Architecture

### CSI Interface Mapping

| CSI Interface | Analog Switch     | Camera Connector | B2B Connector       |
| ------------- | ----------------- | ---------------- | ------------------- |
| CSI0          | U45 (TMUX646ZECR) | JCAM0            | JEXP4, Pins 111–120 |
| CSI1          | U42 (TMUX646ZECR) | JCAM1            | JEXP4, Pins 51–60   |
| CSI2          | U44 (TMUX646ZECR) | JCAM2            | JEXP4, Pins 40–49   |
| CSI3          | U43 (TMUX646ZECR) | JCAM3            | JEXP4, Pins 29–38   |

<img src="https://mintcdn.com/qualcomm-prod/T1k4QQ7G3l_dE-rX/Linux/images/peripheral-interfaces/Camera_mipi.png?fit=max&auto=format&n=T1k4QQ7G3l_dE-rX&q=85&s=da6d88b91077189bca43222ee6402b71" width="551" height="649" data-path="Linux/images/peripheral-interfaces/Camera_mipi.png" />

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/IQ9075_camera_interface_configuration.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=a5055ada65f31abacc0afe1c66f9b9b4" width="930" height="1059" data-path="Linux/images/peripheral-interfaces/IQ9075_camera_interface_configuration.png" />

### DIP Switch Configuration

The four CSI PHYs can be routed to either MIPI camera ports or GMSL camera ports (via mezzanine board) using DIP switches.

<img src="https://mintcdn.com/qualcomm-prod/T1k4QQ7G3l_dE-rX/Linux/images/peripheral-interfaces/Camera_dipswitch.png?fit=max&auto=format&n=T1k4QQ7G3l_dE-rX&q=85&s=1cbfefdb85187a2ee7f3517e77ab9335" width="416" height="145" data-path="Linux/images/peripheral-interfaces/Camera_dipswitch.png" />

| Switch | ON                    | OFF (default)    |
| ------ | --------------------- | ---------------- |
| SW1-5  | CSI0 → GMSL mezzanine | CSI0 → mainboard |
| SW1-6  | CSI1 → GMSL mezzanine | CSI1 → mainboard |
| SW1-7  | CSI2 → GMSL mezzanine | CSI2 → mainboard |
| SW1-8  | CSI3 → GMSL mezzanine | CSI3 → mainboard |

## Supported MIPI CSI Camera Sensors

### ov9282 Camera Sensor

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/ov9282_camera_sensor.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=251c28f9fe222ee1b2da74313b16b2ad" width="292" height="184" data-path="Linux/images/peripheral-interfaces/ov9282_camera_sensor.png" />

### Arducam imx577 Camera Sensor

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/Rasberrypi_imx577_camera_sensor.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=fa6ca72957514682ed8864477cc269ff" width="388" height="315" data-path="Linux/images/peripheral-interfaces/Rasberrypi_imx577_camera_sensor.png" />

**Arducam sensor requires an additional converter board(Arducam 22-pin to Qualcomm 30-pin CSI adapter)**

<img src="https://mintcdn.com/qualcomm-prod/T1k4QQ7G3l_dE-rX/Linux/images/peripheral-interfaces/BoardSide_Flexi_cable_converter_for_RasberryPi_based_Camera.png?fit=max&auto=format&n=T1k4QQ7G3l_dE-rX&q=85&s=09c089d96a881f224570dbc8ea42dbd9" width="656" height="253" data-path="Linux/images/peripheral-interfaces/BoardSide_Flexi_cable_converter_for_RasberryPi_based_Camera.png" />

<img src="https://mintcdn.com/qualcomm-prod/T1k4QQ7G3l_dE-rX/Linux/images/peripheral-interfaces/Cameraside_Flexi_cable_converter_for_RasberryPi_based_Camera.png?fit=max&auto=format&n=T1k4QQ7G3l_dE-rX&q=85&s=b05b14760cd350bb9c877485ec35c5d1" width="874" height="354" data-path="Linux/images/peripheral-interfaces/Cameraside_Flexi_cable_converter_for_RasberryPi_based_Camera.png" />

**Arducam imx577 sensor + 22 pin flex cable + converter board**

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/arducam_flexcable_frontside.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=af6fc4bf916edbdd9c6b37494472e3c8" width="1164" height="308" data-path="Linux/images/peripheral-interfaces/arducam_flexcable_frontside.png" />

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/arducam_flexcable_backside.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=20b5b02cb052f360102cfc21cf89cde0" width="1197" height="382" data-path="Linux/images/peripheral-interfaces/arducam_flexcable_backside.png" />

### Arducam imx577 Camera Sensor connection to iq9075

<img src="https://mintcdn.com/qualcomm-prod/jy6NQT2Y7J_sAxdX/Linux/images/peripheral-interfaces/rb8_with_arducam_imx577.png?fit=max&auto=format&n=jy6NQT2Y7J_sAxdX&q=85&s=d31c86b1f7a031d3491c45e4ef7f7ef4" width="689" height="775" data-path="Linux/images/peripheral-interfaces/rb8_with_arducam_imx577.png" />

### ov9282 Camera Sensor connection to iq9075

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/ov9282_camera_sensor_connection.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=327ba9cc8e9102fd932b263cdae3fb41" width="719" height="873" data-path="Linux/images/peripheral-interfaces/ov9282_camera_sensor_connection.png" />

## Supported Resolutions

| Resolution  | Aspect Ratio | IMX577 | OV9282 |
| ----------- | ------------ | ------ | ------ |
| 4000 × 3000 | 4:3          | Yes    | No     |
| 3840 × 2160 | 16:9         | Yes    | No     |
| 1920 × 1080 | 16:9         | Yes    | No     |
| 1280 × 720  | 16:9         | Yes    | Yes    |
| 1024 × 768  | 4:3          | Yes    | Yes    |
| 800 × 600   | 4:3          | Yes    | Yes    |
| 640 × 480   | 4:3          | Yes    | Yes    |
| 320 × 240   | 4:3          | Yes    | Yes    |

<Note>
  * Advanced features such as SHDR, LDC, and EIS are not supported on IQ-9075.
  * There is no hardware JPEG encoder — snapshots use a software encoder running on the CPU.
</Note>

## Camera Streaming

### Single Camera Stream

```bash theme={null}
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! 'video/x-raw,format=NV12,\
width=1280,height=720,framerate=30/1' ! fakesink
```

The above command starts the camera with 720p at 30 FPS configuration.
The frame coming from the camera sensor is thrown away by fakesink.
If the gst pipeline status is changed to “PLAYING” as shown below, this indicates that the camera is running.
Since this command dumps camera frames to fakesink, nothing will be saved on the device.
If the pipeline status changes to `PLAYING`, the camera is running. Press `Ctrl+C` to stop.

```bash theme={null}
gbm_create_device(187): Info: backend name is: msm_drm
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
```

### Video Encoding

```bash theme={null}
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! \
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4
```

This command starts the camera with 720p at 30 FPS configuration and saves it as a video file after h264 video encoding. If the gst pipeline status is changed to “PLAYING”, this indicates the camera is running.

To stop the camera, press CTRL+C.
/opt/mux\_avc.mp4 is generated on the device. The recorded content can be pulled from the device by running the following scp command on the host PC:

```bash theme={null}
scp -r root@[ip-addr]:/opt/mux_avc. mp4 .
```

### Video Encoding + Snapshot

<Steps>
  <Step title="Start the pipeline">
    ```bash theme={null}
    gst-pipeline-app -e qtiqmmfsrc name=camsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,\
    framerate=30/1,interlace-mode=progressive,colorimetry=bt601 ! queue ! v4l2h264enc capture-io-mode=4 \
    output-io-mode=5 extra-controls="controls,video_bitrate_mode=0,video_bitrate=6000000;" ! queue ! \
    h264parse ! mp4mux ! queue ! filesink location="/opt/mux_720_avc.mp4" camsrc.image_1 ! "image/jpeg,\
    width=1280,height=720,framerate=30/1" ! multifilesink location=/opt/frame%d.jpg async=false sync=true \
    enable-last-sample=false
    ```
  </Step>

  <Step title="Take a snapshot">
    From the interactive menu: **(1) Ready → (3) Playing → (p) Plugin Mode → (11) camerasrc → (37) capture-image → (1) Snapshot → enter count**
  </Step>

  <Step title="Stop and retrieve files">
    Press Enter → `b` (Back) → `q` (Quit).

    ```bash theme={null}
    scp -r root@[ip-addr]:/opt/<file name> .
    ```
  </Step>
</Steps>

## Multi-Camera with Offline IFE

The IQ-9075 has two IFEs for real-time bayer-to-YUV processing. A maximum of two cameras can operate concurrently with real-time IFE
The **Offline IFE** feature allows a single IFE to process two cameras in offline mode, enabling concurrent streaming upto four cameras.

<img src="https://mintcdn.com/qualcomm-prod/Bh7DlgudKfjY_3Wf/Linux/images/peripheral-interfaces/camera_offline_IFE.png?fit=max&auto=format&n=Bh7DlgudKfjY_3Wf&q=85&s=27bdd20c96954bd94a6e4122f073c82c" width="709" height="361" data-path="Linux/images/peripheral-interfaces/camera_offline_IFE.png" />

Each Sensor is connected to one IFE-Lite hardware instance and data is dumped to DDR using the RDI port.
A single IFE hardware is being used to read data from two IFE-Lites using bus fetch engine SFE Lite and processing data in Offline mode.
With this approach, instead of directly feeding the camera frames to IFE, frames are routed from IFE\_LITE and dumped in DDR. Then they’re provided to IFE using the fetch engine SFE Lite for bayer-to-YUV processing.

### Verify Multi-Camera Operation

Conenct Four OV9292 MIPI cameras connected to four MIPI CSI slots (0, 1, 2, and 3)

Run a GST command with **multicamera-hint=true** for each camera to enable this feature. For example:

```bash theme={null}
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 multicamera-hint=true ! \
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4
```

**Check for below print in user log to confirm offline ife feature is enabled**

```
CamX: [CORE_CFG]3509 3556 [CORE   ] camxpipeline.h:4222 SetPipelineStatus() RealTimeFeatureZSLPreviewRawOfflineIFE_0_cam_0 status is now PipelineStatus::STREAM_ON

```

## Troubleshooting

<AccordionGroup>
  <Accordion title="Camera App Not Working">
    <Steps>
      <Step title="Check camera module connection and DIP switch settings" />

      <Step title="Restart cam-server">
        ```bash theme={null}
        systemctl restart cam-server
        # or
        pkill cam-server
        ```
      </Step>

      <Step title="Run a single-stream test">
        ```bash theme={null}
        gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! 'video/x-raw,format=NV12,\
        width=1280,height=720,framerate=30/1' ! fakesink
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Camera Sensor Not Probing">
    Collect logs and search for `probe success`:

    ```bash theme={null}
    journalctl -f > /opt/user_log.txt
    ```

    **Expected probe success log:**

    ```
    CAM_INFO: CAM-SENSOR: Probe success, slot:0, slave_addr: 0x34, sensor_id:0x577
    ```

    If no probe success appears, check the flex cable connection or camera module.
  </Accordion>

  <Accordion title="Camera Not Streaming">
    Enable CSI debug logs and collect dmesg:

    ```bash theme={null}
    echo 3 > /sys/kernel/debug/camera/ife/ife_csid_debug
    dmesg -w > /opt/kernel_log.txt
    ```

    Start the camera and check for SOF/EOF IRQ messages in the log.
    **Expected logs:**

    ```
    CAM_INFO: CAM-ISP: cam_ife_csid_irq: 5288 CSID:1 IPP SOF received
    CAM_INFO: CAM-ISP: cam_ife_csid_irq: 5300 CSID:1 IPP EOF received
    CAM_INFO: CAM-ISP: cam_ife_csid_irq: 5288 CSID:1 IPP SOF received
    CAM_INFO: CAM-ISP: cam_ife_csid_irq: 5300 CSID:1 IPP EOF received
    ```
  </Accordion>
</AccordionGroup>

### Collect Debug Logs

```bash theme={null}
journalctl -f > /opt/user_log.txt   # User space logs
dmesg -w > /opt/kernel_log.txt      # Kernel logs
```

## Resources

| Topic                                  | Link                                                                                                                                    |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Camera Architecture                    | [Camera Architecture](https://docs.qualcomm.com/doc/80-70023-17A/topic/camera-architecture.html)                                        |
| Camera Sensor Driver Development       | [Camera Sensor Driver Development](https://docs.qualcomm.com/doc/80-70023-17A/topic/camera-sensor-driver-development.html)              |
| Customize Camera Use Case and Pipeline | [Customize Camera Use Case and Pipeline](https://docs.qualcomm.com/doc/80-70023-17A/topic/customize-camera-use-case-and-pipelines.html) |
| Customize Advanced Camera Features     | [Customize Advanced Camera Features](https://docs.qualcomm.com/doc/80-70023-17A/topic/customize-advanced-camera-features.html)          |
