Low-level driver for the ST VD55G1 global-shutter image sensor family.
This driver is an implementation of the img-sensor low-level
API (ll_img_sensor.h).
| Part number | Variant |
|---|---|
| VD55G1 | Monochrome |
| VD55G4 | Monochrome |
| VD65G4 | RGB |
The optical revision is auto-detected by the driver.
- Resolution: Native 804x704 (or any sub-selection)
- Pixel Depth: 8 or 10 bits per pixel
- Timing: Configurable line length and frame length
- Exposure & gain: Manual exposure with analog and digital gains; auto exposure
- GPIO: Pin control (input / output), VSYNC, PWM and strobe outputs, pin read-back and sync mode
The driver exposes the following streams:
| Stream | Type | Description |
|---|---|---|
| IMG | LL_IMG_SENSOR_STREAM_TYPE_IMG |
Image data |
| ISL | LL_IMG_SENSOR_STREAM_TYPE_ISL |
Intelligent Status Lines (cf. user manual) |
Up to 4 contexts can be enabled. Each context exposes one IMG and one ISL stream, selected with
the context index in stream_id.id. Enabled contexts are always sequenced in ascending order,
starting from context 0, which cannot be disabled.
- mcu-img-sensor — Image sensor abstraction layer (
img_sensor.h,ll_img_sensor.h,img_sensor_type.h)
#include "img_sensor.h"
#include "img_sensor_type.h"
#include "interface_device_is.h"
#include "vd55g1.h"
extern I2C_HandleTypeDef hi2c1;
// Caller-allocated contexts (no malloc in the driver)
ll_img_sensor_vd55g1_ctx_t vd55g1_ll_ctx;
img_sensor_ctx_t vd55g1;
img_sensor_hw_config_t vd55g1_hw_config;
img_sensor_io_t io_ctrl;
// Wire the VD55G1 vtable
vd55g1_new(&vd55g1, &vd55g1_ll_ctx);
// Assign IO functions (provided by the platform)
io_ctrl = (img_sensor_io_t){
.control_pin = interface_device_control_pin,
.read = interface_device_read,
.write = interface_device_write,
.delay = interface_device_delay,
};
// VD55G1 hardware configuration
vd55g1_hw_config = (img_sensor_hw_config_t) {
.comm.i2c.address = 0x20,
.comm.i2c.address_size = 2,
.comm.bus = BUS_TYPE_I2C,
.comm.bus_handler = &hi2c1,
.ext_clock = 12000000U,
.mipi = {
.lane_count = 1,
.clock_lane = { .phys_id = 0, .swap_polarity = true },
.data_lanes = {
{ .phys_id = 1, .swap_polarity = true },
},
.bitrate = 1200000000
},
};
// Initialise
img_sensor_init(&vd55g1, &vd55g1_hw_config, &io_ctrl);
// Configure: ROI, frame rate and manual exposure / gains
img_sensor_set_frame_size(&vd55g1, 800, 700);
img_sensor_set_frame_rate(&vd55g1, 30.0f);
img_sensor_set_exposure_gain(&vd55g1, 0, 0, 0, IMG_SENSOR_EXPOSURE_MODE_AUTO);
// Start streaming
img_sensor_start(&vd55g1);