Skip to main content
Associate
November 5, 2025
Solved

VD55G1 Differential Mode

  • November 5, 2025
  • 3 replies
  • 747 views

Hi there, I'm trying to figure out how to configure VD55G1 monochrome sensor to differential mode (e.g. disruptive mode, event mode) as branded in user manual. However, after going through https://github.com/STMicroelectronics/stm32-mw-camera, I have no clue. Could you help me with this? Thank you.

Best answer by ST-Chad

This is the frame subtraction function, which is also explained in Appendices B and C.

The difference between them is that Appendix B requires the host to process the subtraction, while Appendix C performs it on the sensor side. Both appendices also include sample code for your reference.

I have attached the sample code to enable the subtraction for you. For more details, please check the sample code in the appendices.

 def enable_normal_internal_BG(self, exposure_mode):
 """
 internal back ground subtraction with single context
 """
 if self.m_bRunning:
 iRet = self.m_dtccm.GrabHold(self.m_iDevID)
 if iRet is None:
 print("GrabHold in internal subtraction failed!")
 
 if exposure_mode == 1:
 self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x00)
 else:
 self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x02)

 self.I2CWrite(VT_MODE_CTX0, 1) # VT_MODE = 1 : Subtraction on CTX0 , 0 : Normal Mode
 self.I2CWrite_16(VT_SUB_WAIT_EXPOSURE_LINES, 0) # wait exposure lines between 2 sub-frames
 self.I2CWrite_16(VT_SUB_WAIT_PIXELS, 0) # wait pixels between 2 sub-frames
 self.I2CWrite_16(DARKCAL_PEDESTAL_CTX0, 0)
 self.I2CWrite(GPIO_1_CTRL_CTX0, 2) # GPIO_1 = 2 (Strobe MODE)

 if self.m_bRunning:
 iRet = self.m_dtccm.GrabRestartWithSkip(0, 0, self.m_iDevID)
 if iRet is None:
 print("Restart frame in internal subtraction failed!")
 time.sleep(0.5)

 

3 replies

ST Employee
November 5, 2025

Hi,

For the event mode, please refer to Appendix G in the user manual. We call it the auto wake-up mode( AWU).

When the event occurs, the sensor will send a signal via the GPIO to the host. The host can then decide the next step, such as waking up the sensor to take a picture or activating other devices to perform certain actions.

I have also attached the sample register configuration for your reference below.

// -----------------------------------------------------------------
// This script has been automatically generated by GPSDK
// 
// For better compatibility between platforms and V2Wreg
// You can force a transfer limit during generation:
// from gpsdk import config
// config.MAX_TRANSFER_SIZE = 64
// -----------------------------------------------------------------

$SCRIPT


SetBank(0x20);


// Set frequencies
WriteAutoIncrement(0x0220, 0x0, 0x1b, 0xb7, 0x0); // (val=12000000) / UI.SENSOR_SETTINGS.EXT_CLOCK.VALUE
WriteAutoIncrement(0x0224, 0x0, 0x8c, 0x86, 0x47); // (val=1200000000) / UI.SENSOR_SETTINGS.MIPI_DATA_RATE.VALUE
WriteAutoIncrement(0x0300, 0x40, 0x5); // (val=1344) / UI.STREAM_STATICS.LINE_LENGTH.VALUE
WriteAutoIncrement(0x0300, 0x68, 0x4); // (val=1128) / UI.STREAM_STATICS.LINE_LENGTH.VALUE
// => External clock = 12.00 MHz, Csi frequency = 1200.00 Mbps, Line time = 7.52 us

WriteAutoIncrement(0x0370, 0x0, 0x6); // (val=6) / UI.STREAM_STATICS.AWU_DETECTION_THRESHOLD.INTEGER
WriteAutoIncrement(0x036c, 0x42, 0x11, 0x0, 0x0); // (val=4418) / UI.STREAM_STATICS.AWU_CTRL
WriteAutoIncrement(0x0372, 0xbe, 0x1); // (val=446) / UI.STREAM_STATICS.EXPOSURE_USER_MAX_COARSE_INTEGRATION_LINES.VALUE
WriteAutoIncrement(0x036c, 0x42, 0x11, 0xa8, 0x8); // (val=2216) / UI.STREAM_STATICS.AWU_CTRL.FRAME_LENGTH_FOR_CONVERGENCE
WriteAutoIncrement(0x0312, 0x0); // (val=0) / UI.STREAM_STATICS.EXPOSURE_USE_CASES.ENABLE_MULTI_CONTEXT
WriteAutoIncrement(0x03e4, 0x10, 0x11); // (val=0) / UI.STREAM_STATICS.CONTEXT_NEXT_CONTEXT.CTX0
WriteAutoIncrement(0x03e4, 0x10, 0xf1); // (val=255) / UI.STREAM_STATICS.CONTEXT_NEXT_CONTEXT.CTX3
WriteAutoIncrement(0x03dc, 0x0, 0x0); // (val=0) / UI.STREAM_STATICS.CONTEXT_REPEAT_COUNT_CTX0.VALUE
WriteAutoIncrement(0x03e2, 0x0, 0x0); // (val=0) / UI.STREAM_STATICS.CONTEXT_REPEAT_COUNT_CTX3.VALUE
WriteAutoIncrement(0x0500, 0x0); // (val=0) / UI.STREAM_CTX0.EXPOSURE_MODE.MODE
WriteAutoIncrement(0x050c, 0xa8, 0x8, 0x0, 0x0); // (val=2216) / UI.STREAM_CTX0.FRAME_LENGTH.VALUE
WriteAutoIncrement(0x051d, 0x2); // (val=2) / UI.STREAM_CTX0.GPIO_0_CTRL.Mode
WriteAutoIncrement(0x051e, 0x5); // (val=5) / UI.STREAM_CTX0.GPIO_1_CTRL.Mode
WriteByte(0x0537, 0x00); // (val=0) / UI.STREAM_CTX0.MASK_FRAME_CTRL
WriteAutoIncrement(0x05fc, 0xe3, 0x67, 0x0, 0x0); // (val=26595) / UI.STREAM_CTX3.FRAME_LENGTH.VALUE
WriteAutoIncrement(0x060d, 0x2); // (val=2) / UI.STREAM_CTX3.GPIO_0_CTRL.Mode
WriteAutoIncrement(0x060e, 0xd); // (val=13) / UI.STREAM_CTX3.GPIO_1_CTRL.Mode
WriteByte(0x0627, 0x01); // (val=1) / UI.STREAM_CTX3.MASK_FRAME_CTRL

 

Associate
November 5, 2025

I guess I made it ambiguous. This is what I'm looking for.

Screenshot 2025-11-05 at 2.43.11 PM.png

ST-ChadBest answer
ST Employee
November 5, 2025

This is the frame subtraction function, which is also explained in Appendices B and C.

The difference between them is that Appendix B requires the host to process the subtraction, while Appendix C performs it on the sensor side. Both appendices also include sample code for your reference.

I have attached the sample code to enable the subtraction for you. For more details, please check the sample code in the appendices.

 def enable_normal_internal_BG(self, exposure_mode):
 """
 internal back ground subtraction with single context
 """
 if self.m_bRunning:
 iRet = self.m_dtccm.GrabHold(self.m_iDevID)
 if iRet is None:
 print("GrabHold in internal subtraction failed!")
 
 if exposure_mode == 1:
 self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x00)
 else:
 self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x02)

 self.I2CWrite(VT_MODE_CTX0, 1) # VT_MODE = 1 : Subtraction on CTX0 , 0 : Normal Mode
 self.I2CWrite_16(VT_SUB_WAIT_EXPOSURE_LINES, 0) # wait exposure lines between 2 sub-frames
 self.I2CWrite_16(VT_SUB_WAIT_PIXELS, 0) # wait pixels between 2 sub-frames
 self.I2CWrite_16(DARKCAL_PEDESTAL_CTX0, 0)
 self.I2CWrite(GPIO_1_CTRL_CTX0, 2) # GPIO_1 = 2 (Strobe MODE)

 if self.m_bRunning:
 iRet = self.m_dtccm.GrabRestartWithSkip(0, 0, self.m_iDevID)
 if iRet is None:
 print("Restart frame in internal subtraction failed!")
 time.sleep(0.5)

 

Will_Robertson
Associate III
December 1, 2025

Hi @ST-Chad 

Thank you very much for your explanation "The difference between them is that Appendix B requires the host to process the subtraction, while Appendix C performs it on the sensor side. Both appendices also include sample code for your reference."

Will