QHYCCD

QHY5III224C Low Level (1) USB Protocol

robz

QHY5III224C Low Level (1) USB Protocol
« on: March 07, 2017, 02:02:26 AM »
1.QHY5III224C LOW LEVEL PPROTOCOL  (LEVEL 1)

LEVEL 0 refers to our original FIREWARE interface
LEVEL 1 is more unified interface is based on LEVEL 0.

2. LEVEL 1 INTERFACE DESCRIPTION

This interface include command 0xD1 and 0xD2 whitch are basic Vender Request commands.
0xD1: Direction is out (computer send command to camera)
          Length is 16 bytes
0xD2:Direction is IN (computer requrest camera to submit it's some status)
         Length is 64 bytes.

Their Index and Value in vender request are not used. So you can set to 0X0000.

3. COMMAND 0xD1 DESCRIPTION

Camera Control Command:
It is defined as command type . It tell camera do what.  It locate in 1th byte in transfer data(16 bytes).
Camera Control Parameter:
This is command parameter. It locate in the 2th to 16th

Data Format:
Byte0                        Camera Control Command(CCC)
Byte1......Byte15        Camera Control Parameter(CCP1...15)


3.1.  CCC=0XA0
Camera Initialization, After perform this command,The camera will be set to a known status.

CCP1        0=streaming.    current firmware does not support 1=single frame
CCP2...3   Pixel Binning is In X direction (CCP2=MSB, CCP3=LSB)    current  firmware does not support binning
CCP4...5   Pixel Binning is In Y direction   (CCP4=MSB,CCP5=LSB)     current  firemware does not support binning


3.2. CCC=0XA1 

Set Camera Readout Speed.
You can use this command to optimize readout noise and balance the transfer speed
whitch let the camera and computer have a normal transfer.

CCP1 : Readout Speed value
0x00:80Mhz
0x01:160Mhz

3.3. CCC=0XA2 
Select Camera Resolution and set the ROI.

CCP1     Reserved , no use,  can be set to 0x00
CCP2..3  ROI X size (CCP2=MSB  CCP3=LSB)
CCP4..5  ROI X start
CCP6..7  ROI Y size( CCP6=MSB   CCP7=LSB)
CCP8..9  ROI Y start

3.4. CCC=0XA3
Set Exposure Time

CCP1..4   32BIT exposure time,the unit is microsecond(us)    CCP1=MSB  CCP4=LSB


3.5. CCC=0XA4
Gain Setting

Analog Gain R(CCP1..CCP2)
The Analog Gain have 73 levels: 0x0000  to 0x0048
Digital Gain R(CCP3..CCP4)
value:0x0000 to 0x00FF

Analog Gain G(CCP5..6)
Analog Gain G is allways equal to  Analog Gain R
Digital Gain G(CCP7..CCP8)
value:0x0000 to 0x00FF

Analog Gain B(CCP9..10)
Analog Gain B is allways equal to Analog Gain R
Digital Gain B(CCP11..CCP12)
value:0x0000 to 0x00FF

3.6. CCC=0XA5
usb traffic setting

CCP1  USB  tarffic value:
min 0  max 255

Increase the USB traffic will increase the line period and reduce the average USB bandwidth. In some slow computer , there is a lot bad frame and cause the FPS is very small. When increase this usb traffic the bad frame will become less and the FPS will increase.


3.7. CCC=0XA6
   CCP1 0X00: Start streaming
          0x11:   (not avalible)
          0x22: enter sleep (in SLEEP,we can save power, holding the register value,need not to        initialize the cmos after wake up)
          0x44: wake up
          0x66: reset CMOS  (not avalible)
          0xFF: Stop Continuous streaming  (not avalible)

3.8. CCC=0XA7
Set Image depth

CCP1=0    8BIT
CCP1=1  16BIT

3.9. CCC=0XA8
Set offset
CCP1..2  9 bit OFFSET

3.10. CCC=0XAB
Guiding port control
meaning    CCP1 | CCP2
RA+               01  |  80
RA-                01  |  10
DEC+            02  |  40
DEC-             02  |  20
RA+,DEC+     03  |  C0
RA+,DEC       03  |  A0
RA-,DEC+      03  |  50
RA-,DEC        03  |  30
ALL OFF         03  |  00



4. COMMAND 0xD2 DESCRIPTION
Return camera status
0xD2 include 64 bytes Camera Statu Information(CSI)
CSI0     cmos speed,uint is Mhz
CSI1..4   The remaining exposure time,the unit is us. CSI1=MSB  CSI4=LSB   (not avalible)
CSI5..8  target exposure time

CSI46:  camera sub type
CSI47      sensor color/mono type
COLOR/MONO define
0: mono
1: RGB
2: CMYG
3. RGBW
CSI48...63  camera serial number(16 bytes)
« Last Edit: March 07, 2017, 02:07:22 AM by robz »

robz

QHY5III224C Firmware ver 20170307
« Reply #1 on: March 07, 2017, 02:12:07 AM »
QHY5III224C Firmware ver 20170307

Re: QHY5III224C Low Level (1) USB Protocol
« Reply #2 on: May 04, 2017, 04:33:44 PM »
Thank you for the informations. I am currently writing a gstreamer plugin and have some questions about configuring the QHY5 III 224 using libusb and the new protocol.

* setting the camera to 1280x960 will result in images of 1284x984
* setting the camera to 1276x936 will result in images of 1280x960
--> it seems only steps of 24 are allowed for y
Is this intended or a bug in the firmware? I also get a border of 4 vertical / 16 horizontal no matter which frame size and x/y offset is used. Are these the optical black pixels which are always returned? Is it possible to turn them off?

The very first line has some data encoded. Is it possible to get the format? It is probably a counter.

At the moment I get ~147 fps for true 1280x960 and no frame drops. The old SDK does ~154 and does not display the 16 black lines at the top. Is there a hidden feature I am missing?
 
Best
Alex

QiuHY

  • *****
  • 5000
    • View Profile
    • Email
Re: QHY5III224C Low Level (1) USB Protocol
« Reply #3 on: May 05, 2017, 11:08:10 AM »
Hello,
           In our SDK we should crop the image so the image is no the black borders. But for the Low Level protocol it can not be crop by the camera hardware. So you have to crop it in the software.

Best regards,
Qiu Hongyun
Qiu Hongyun

Re: QHY5III224C Low Level (1) USB Protocol
« Reply #4 on: May 08, 2017, 06:04:56 AM »
I do not mind cropping it. However I am a bit puzzled why the camera is running with a slower speed than it does with your SDK.

I still only get ~144fps instead of 154fps (same resolution / exposure / usb transfer speed =0)
* usb total received bytes per frame 1250568 = 2x4+1280*(960+17)
* no frame drops using 64 Bit counter encoded in the image data
* 2x4 = magic bytes of the header (one 4 Byte transfer message at the beginning + 4 extra bytes at the end)
* cpu load with low level libusb implementation < 18 %


Any ideas?

Alex

Re: QHY5III224C Low Level (1) USB Protocol
« Reply #5 on: May 08, 2017, 08:31:10 PM »
Is it possible that the sensor chip is set to window cropping mode instead of operating in the all pixel scan mode (Quad VGA)? Is there a way to force all pixel scan mode?

Alex

QiuHY

  • *****
  • 5000
    • View Profile
    • Email
Re: QHY5III224C Low Level (1) USB Protocol
« Reply #6 on: May 08, 2017, 09:14:28 PM »
Hello,

          I will check of this reason. Maybe crop mode is has a little different.


Best regards,
Qiu Hongyun
Qiu Hongyun