Skip to main content

Using iMX6 Camera Interface in Windows CE

Hardware Interfaces

Colibri and Apalis iMX6 support the parallel camera interface and the Apalis iMX6 supports additionally a MIPI-CSI camera interfaces. Currently Windows CE supports only the parallel interface.
To use camera interface you need at least release 1.3b2 of the IMX6 image or BSP.
It's possible to test parallel camera modules using the Colibri EVB (3.2 or newer) and the Apalis EVB.
The Ixora carrier board since release 1.1 provides a MIPI/CSI connector.
To be able to actually capture video you need to connect an image sensor or a camera module to the SOC, this may require using or developing an additional software plugin that initializes the image sensors and configures it in a way that is compatible with the IMX6 CSI interface.

OS Configuration

By default, the camera driver is included in the image but not loaded at boot. Since it needs an external sensor and a software plugin to configure it, it does not make sense to load the driver by default. To enable the driver you just need to add the following entries to your registry:

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera]
"Dll"="_ipuv3camera.dll"
[HKEY_LOCAL_MACHINE\Software\Microsoft\DirectX\DirectShow\Capture1]
"Dll"="_ipuv3camera.dll"

This will load the driver at boot time.
You also need to configure a plugin that will take care of the camera module or video converted that is going to generate the video data captured by the camera interface driver.
Three plugins are provided out of the box and may be used to test this feature. Two of those plugins require some additional hardware.

CSI Test mode plugin

This plugin leverages a diagnostic feature of the IMX6 camera interfaces. It can generate fixed patterns that can be acquired as if they come from an external sensor. This plugin has been developed for test only but may be useful if you want to integrate camera features in your application but your actual hardware or software plugin is not ready yet.
To enable it you have to add the following entry to your registry:

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera]
"PluginDll"="CSITESTMODE.dll"

Once enabled the sensor will return a checkered red and white pattern.

ADV7X80 plugin

This plugin supports the Analog Camera Adapter and can be used to capture analog video in PAL or NTSC format. Is it not possible to switch between PAL and NTSC sources, but the driver may work even when a camera is not connected to the input channels.
To enable the driver you need to add the following registry entries:

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera]
"PluginDll"="ADV7X80.dll"

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera\ADV7X80]
"DLL"="ADV7X80.DLL"
"Prefix"="ADV"

The driver supports some additional configuration parameters that can be added under the HKEY_LOCAL_MACHINE\Drivers\IPU\Camera\ADV7X80 registry key.

NameValues
I2CBusOptional index of the I2C bus used to communicate with the sensor, if not specified the driver will use I2C1 on Colibri and I2C3 on Apalis
I2CAddressI2C address of the device, by default is 0x21 (used on the ACA)
TestModeOptional, the device will generate a test pattern instead of acquiring video.

Lower 4 bits: video mode
4 NTSC J
5 NTSC M
6 PAL 60
7 NTSC 4.42
8 PAL B/G/H/I/D
9 PAL N
10 PAL M
12 PAL combination N

Higher 3 bits: pattern
0 single color
1 100% color bars
2 luma ramp
5 boundary box
InputVideo input channel (0-3 on the ACA board)
UsePALasDefaultIf set to 1 (default) the driver will work at PAL resolution if no valid video input is connected at boot, otherwise it will use NTSC

OV5640 plugin

This plugin can be used to support OmniVision OV5640 sensor, connected via parallel interface.
To enable it you'll have to add the following registry entries:

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera]
"PluginDll"="OV5640.dll"

[HKEY_LOCAL_MACHINE\Drivers\IPU\Camera\OV5640]
"DLL"="OV5640.DLL"
"Prefix"="OV5"

To test the interface you may use a camera module like this one.
You need to check that the module is actually exposing the parallel interface at 3.3V and not just the MIPI/CSI or serial interfaces.

NameValues
I2CBusOptional index of the I2C bus used to communicate with the sensor, if not specified the driver will use I2C1 on Colibri and I2C3 on Apalis
I2CAddressI2C address of the device, by default, is 0x3c (default address for the sensor)
PWDNPinPin used as PWDN signal (needs to be connected to a GPIO)
Default is SO-DIMM 69 on Colibri and MXM3 2 on Apalis (pins available on the camera connector of the EVB/Ixora)
ResetPinPin used as Reset signal (needs to be connected to a GPIO)
Default is SO-DIMM 77 on Colibri and MXM3 1 on Apalis (pins available on the camera connector of the EVB/Ixora)

Software support

It's possible to access the camera driver to show an on-screen preview, capture video or single frames using the DirectShow API.
This API is complex, but to start understanding it and integrating it into your application we provide some sample applications.
Those are command-line tools that can be used to test your hardware and as a starting point to understand how to integrate a specific feature in your code.

Preview

Launched without any command line parameter will generate a list of available resolutions. The list will look like:

YUYV@640x480
RGB565@640x480
...

To start preview at a specific resolution and for a defined timeout you have to pass resolution and (optional) timeout on the command line.
For example:

preview RGB565@640x480 30

Will show a VGA preview window for 30 seconds.

StillCapture

This tool can be used to capture a single frame.
When launched with no parameters will show the list of available capture resolutions, to capture a frame you need to specify the resolution and an optional filename. If you specify no filename then a PNG file named as the specified resolution will be generated in the root folder. You can use PNG, BMP or JPG extension to specify the format of the output file.
For example:

stillcapture UYUV@720x576 \\FlashDisk\\snapshot.jpg

Will save a jpeg image at PAL resolution.

Capture

This tool can be used to capture a compressed video.
When launched with no parameters will show the list of available capture resolutions, to capture a frame you need to specify the resolution and an optional filename. If you specify no filename then a ASF file named as the specified resolution will be generated in the root folder.
For example:

capture UYUV@720x480 \\FlashDisk\\video.asf

Will save an ASF video at NTSC resolution.

Camera

This utility can be used to show preview and capture a video or show preview and capture a still frame.
It's not possible to capture video and still frames at the same time.
When launched with no parameters will show the list of available capture resolutions.
Command line syntay is the following:

 usage: camera -s/c <capture res> [filename] -p <preview res> - t [seconds]
-s still capture
-c video capture
-p show preview
[filename] is optional and must be the full path of saved video or image, if no path is specified \<capture res>.ASF or \<capture res>.png will be used.
Video capture/preview is going to be run for [seconds], or 30 seconds if no value is provided.

When capturing single frames the frame will be captured at the end of the timeout.

Source code download

iMX6 DirectShow Samples



Send Feedback!