HOME > Support >Developer >
QHY294C Low Level Protocol
2018 年 07 月 15 日
What's this low level protocol? This protocol gives a way to control camera and accuquire the image from QHYCCD camera without any dependence of the SDK. For some new camera like QHY249C,QHY2020,QHY42 etc, The QHYCCD SDK is also using this protocol to control it.
2. LEVEL 1 Interface
The interface is based on two basic vendRequest Control command. COMMAND 0XD1 and COMMAND 0XD2
0XD1 direction is OUT,the host send the command to the camera ,data length is 16bytes
0XD2 direction is IN,the host request some data from the camera. data length is 64byte
The wINDEX and wValue parameter is not used in this command. You can set both of them as 0x0000
3. 0xD1 COMMAND Structure
The first byte of the data in 0xD1 command is called CCC(Camera Control Command),the following data is the detail data (payload).
The data structure is
Byte0 Camera Control Command(CCC)
Byte1......Byte15 Camera Control Parameter(CCP1...15)
Initialize the camera. After run this command. The camera will be initialized into a fixed status.
CCP1 streaming mode or single frame mode 0=streaming mode 1=single frame mode
CCP2...3 hardware binning in X (CCP2=MSB, CCP3=LSB) . not use QHY294C. Set it to 0x0000
CCP4...5 hardware binning in Y (CCP4=MSB,CCP5=LSB). no use in QHY294C. Set it to 0x0000
Note 1. After enter the streaming mode the QHY294C will be initialized to the 8bit, resolution is 4212*2850, which includes the effective image area and some dim image area(black) arround the effective image area and some grey image area on the bottom of the image. The default analog gain is 1500 and default digital Gain is 64 (at value 64 the digtial Gain =1.0)
Note 2. Currently fireware version does not support hardware binning.
Note 3. After enter the single frame mode. The QHY294C will get into the IDLE status. It will not do any capture till CCC=0XA6 CCP1=0X00 command been called. In the single frame mode. The QHY294C has been fixed set to 16bit image output mode, DDR enabled and Re-Read mode, and the 4212*2850 image output. DDR data remain will be zero after initialize the camera.
Camera readout speed set.
CCP1 the value of the setting。
Note 1:Currently QHY294C firmware version it has no use.
set camera resolution or ROI
CCP1 select some sepcially resolution mode (no used for QHY294,set to 0)
CCP2..3 ROI X size (CCP2=MSB CCP3=LSB) no use for QHY294, set to 4212
CCP4..5 ROI X start position no use for QHY294, set to 0
CCP6..7 ROI Y size ( CCP6=MSB CCP7=LSB)
CCP8..9 ROI Y position
Note 1. The QHY294 hardware only support the ROI in Y direction. So the ROI X SIZE and ROI X START have no use. You can set the ROI X SIZE = 4212 and set ROI X start position = 0. The image that QHY294 output is always X=4212.
The ROI Y SIZE and ROI Y START can be set to get the hardware ROI output in Y direction. For X direction crop you need to do it in software. The hardware ROI can increase the frame rate.
Exposure Setting
CCP1..4 32BIT,unit is micro-second CCP1=MSB CCP4=LSB
Gain Setting
CCP1..2 Analog Gain R CCP1=MSB CCP2=LSB
CCP3..4 Digital Gain R
CCP5..6 Analog Gain G No use
CCP7..8 Digitial Gain G
CCP9..10 Analog Gain B No use
CCP11.12 Digital Gain B
Note 1. The QHY294 has a common analog gain for all RGB channel . The range is 0 - 3624. There is the automatic HGC/LGC mode switch. The switch point is analog gain=1600. From 0-1599, the camera will use the Low Gain Mode. From 1600-3624 the camera will use the High Gain Mode. The analog gain can be set through the CCP1..2 (Analog Gain R). 2. The QHY294 has seperated digital RGB gain. Which can be used for color balance. The range of the digital gain is 16 to 255. The digital gain formular is
digital gain ratio = (digital gain value) / 64
When the digital gain value is 64, the digital gain ratio = 1.0 . In DSO imaging and other scientific using. we recommand to set the digital gain value 64.
USB Traffic Setting
CCP1 The value of USB Traffic. When increase this value, it will add the blanking period of each line. Which can reduce the average data bandwidth. It will cause the frame rate reduce also.
CCP1 0X00: Start one frame single image capture (in single capture mode)
0x11: 在一帧拍摄过程中,强行终止曝光,并且读出图像
0x22: 芯片进入SLEEP状态 (SLEEP状态中芯片会省电,不输出图像,但是仍然保持了之前的寄存器状态,唤醒以后不用重新初始化)
0x44: 唤醒芯片
0x66: 复位CMOS/CCD
Set the image output depth.
CCP1=1 16BIT
OFFSET setting
CCP3..4 OFFSET1 G no use
CCP5..6 OFFSET1 B no use
CCP7..8 OFFSET2 R no use
CCP9..10 OFFSET2 G no use
CCP11..12 OFFSET2 B no use
QHY294C has one common offset. You can set it via CCP1..2 (OFFSET1R). The range is 0 - 50.
CCP2..5 The value need to be set (CCP2=MSB CCP5=LSB)
CCP1 is the DDR control command. Please look at the following commands.
0X00= BYPASS DDR (do not use DDR)
0X11= SET DDR TO FIFO MODE(MODE 0) It need to set the CCP2..5 at the same time. (The threshould of the DDR). The unit is 16bit
0X44= Clear DDR(under FIFO mode) or return to zero point(under re-read mode , it will cause the write address pointer and read address pointer to zero)
0x55= Set the re-read start address. It need to set the CCP2..5 at the same time. Unit is 16bit.
0x66= Set the re-read data value. It need to set the CCP2..5 at the same time. Unit is 16bit
0x33= Start one re-read
CFW control
CCP1 define how many byte that will be send from 4PIN CFW socket. (no use in QHY294)
CCP2...15 the uart context
QHYCFW2 and QHYCFW3 connects the camera via standard RS232 port inside the 4PIN CFW socket. You can use this to send the CFW control command to the CFW. The color QHY294C has no this function.
Guide Port Contro. QHY294C has no this function
CCP1: 温控模式 1=自动控制 0=手动设置PWM控制
CCP3: 温度设置单位 0=摄氏度 1=ADU单位
CCP4..5 摄氏度 当CCP3设置为0时候,此数据起效
CCP6..7 ADU单位 当CCP3设置为1时候,此数据起效
3. 0xD2的命令标准说明
0XD2将一次性返回所有相机当前的相关信息,0xD2包含64个字节相机状态信息(Camera Statu Information, CSI)
CSI0 当前的速度设置,对于CMOS相机通常返回值为CMOS主频,对于CCD相机,返回为CCD芯片主频,0为低于1M, 1位1M 2为2M
CSI1..4 距离曝光结束的时间(单位微秒) CSI1=MSB CSI4=LSB 部分相机支持该功能
CSI5..8 设置的曝光时间
CSI9..11 获取固件版本(CSI9:年 CSI10:月 CSI11:日)
CSI12 温度类型标识。0=支持摄氏度读出 1=支持ADU单位读出 2=支持两者。 如果支持ADU单位读出的,在CSI13..14 CSI15..16输出,如果支持摄氏度的,在CSI22..23 CSI24..25读出
CSI13..14 当前温度(以ADU为单位)
CSI15..16 目标温度 (以ADU为单位)
CSI17 当前PWM值
CSI18 当前温控模式 1=自动 0=手动
CSI19...21 DDR当前的存储数据量 CSI19=MSB CSI21=LSB 支持DDR的相机支持该功能
CSI22..23 当前温度(以0.1摄氏度为单位)
CSI24..25 目标温度(以0.1摄氏度为单位)
CSI28..29 输出图像X尺寸
CSI30..31 输出图像Y尺寸
CSI32 输出图像位数
CSI33 相机的USB端口速度 1=USB1.0 2=USB2.0 3=USB3.0
CSI38..45  8 BYTES 滤镜轮缓冲区 用于接受相机的串口缓冲区内前8个字节。
CSI46:  相机子型号
CSI47:  彩色/黑白 0: mono 1: RGB 2: CMYG 3. RGBW
CSI48...63 相机序列号(共16字节)