QHYCCD

Does QHY SDK support 47M read mode for QHY294M-Pro?

Does QHY SDK support 47M read mode for QHY294M-Pro?
« on: February 04, 2021, 02:51:07 PM »
I am trying to capture images in the 47M read mode with my QHY294M-Pro via communicating with the camera through the QHY SDK but so far with little success. From what I can tell is that the SDK will not allow me to specify a 47M specific frame resolution through SetQHYCCDResolution() when the camera is operating in this mode although the specified frame resolutions are well within the maximum resolution as reported by GetQHYCCDReadModeResolution(). To confirm, please take a look at the attached application that I am running which is based on the 'SingleFrameMode' example that comes with the SDK. The communication sequence implemented is roughly as follows:

1) connect to camera via OpenQHYCCD(..)
2) query firmware version via GetQHYCCDFWVersion(...)
3) query read modes via GetQHYCCDNumberOfReadModes(...), GetQHYCCDReadModeName(...), GetQHYCCDReadModeResolution(...)
4) set to read mode 47M via SetQHYCCDReadMode(...)
5) confirm correct read mode via GetQHYCCDReadMode(...)
5) get current read mode resolution via GetQHYCCDReadModeResolution(...)
6) set ROI resolution via SetQHYCCDResolution(...)
7) set exposure parameters (gain, offset, exposure time)
8) expose single frame via ExpQHYCCDSingleFrame(...)
9) get image buffer size from SDK/camera via GetQHYCCDMemLength()
10) grab frame via GetQHYCCDSingleFrame(...)
11) write raw image buffer to disk

This works well for frames with a resolution that are within the 11M frame dimensions, but fails in step 6) (SetQHYCCDResolution(...)) as soon as frame width or height will exceed the CCD dimensions as obtained by GettCCDInfo(...)

I noticed that the image buffer size in each of the read modes is 98083872 bytes thus looks big enough to hold a 47M frame. But analysis of my saved image buffer shows that in both modes the received image will only be the size of the frame in 11M read mode or smaller.

Attached are my program code and console output for a successful example (Mode 47M, frame size 4212x2850) and a failed run (Mode47M, frame size 6000x4000)

SDK versions tested: 21.2.1.10 for OSX, 21.2.1.10 for ARM32, 2020.12.11.15 for OSX
FW version: 2020_12_27
OS: OSX 11.1 (Big Sur)
ARM: Raspberry Pi Buster

Please kindly advise how to modify this program to obtain frames in the 47M resolution.

With Best Regards
Niels










ma_rs

Re: Does QHY SDK support 47M read mode for QHY294M-Pro?
« Reply #1 on: February 04, 2021, 08:30:21 PM »
Try move "read mode" part before InitQHYCCD()
If you change a read mode, The camera need to do some init operation

If this does not work, please let me know, I will try your code on your platform.

Re: Does QHY SDK support 47M read mode for QHY294M-Pro?
« Reply #2 on: February 04, 2021, 10:56:12 PM »
OK, I see. That does actually make a lot of sense and seems to do the trick.

Testing with the call to InitQHYCCD() moved to just after setting the read mode and before querying the sensor info with GetQHYCCDChipInfo() the camera is now reporting the sensor layout for the 47M mode and also my exposure with a larger image frame (6000x4000) passes. Very nice!

I think that this is actually also something which could help the current Indi_qhy code (https://github.com/indilib/indi-3rdparty/blob/master/indi-qhy/qhy_ccd.cpp, lines 1936 onward).  The 47M readout mode looks like it isn't working the way it should in KStars/ECOS either and as far as I can tell the driver code there has the same problem. I have an open post around this topic in their forum, too and will share this finding.

With the updated code my console output looks like this now:

<----------------------- SetQHYCCDReadMode ----------------------->
SetQHYCCDReadMode:
modeNumber : 1
sleep 1s...
<----------------------- GetQHYCCDReadMode ----------------------->
GetQHYCCDReadMode:
modeNumber : 1
sleep 1s...
<----------------------- GetQHYCCDReadModeResolution ----------------------->
GetQHYCCDReadModeResolution:
modeNumber : 1
width : 8336
height : 5648
sleep 1s...
InitQHYCCD success.
<********************** Chip Info **********************
GetQHYCCDChipInfo:
Effective Area startX x startY: 0 x 0
Chip  size width x height     : 19.520 x 13.075 [mm]
Pixel size width x height     : 2.315 x 2.315 [um]
Image size width x height     : 8432 x 5648  [px]
GetQHYCCDOverScanArea:
Overscan Area (startX , startY): (80 , 0)
Overscan Area sizeX x sizeY    : 8336 x 5
GetQHYCCDEffectiveArea:
Effective Area (startX , startY): (80 , 0)
Effective Area sizeX  x sizeY   : 8336 x 5622
This is a mono camera.
SetQHYCCDParam CONTROL_USBTRAFFIC set to: 10, success.
SetQHYCCDParam CONTROL_GAIN set to: 10, success
SetQHYCCDParam CONTROL_GAIN set to: 140, success.
SetQHYCCDParam CONTROL_EXPOSURE set to: 20000, success.
try set CCD resolution (roiStartX , roiStartY): 50 x 50
try set CCD Resolution roiSizeX  x roiSizeY   : 6000 x 4000
SetQHYCCDResolution (roiStartX , roiStartY): 50 x 50
SetQHYCCDResolution roiSizeX  x roiSizeY   : 6000 x 4000
SetQHYCCDBinMode set to: binX: 1, binY: 1, success.
SetQHYCCDParam CONTROL_GAIN set to: 10, success.
ExpQHYCCDSingleFrame(pCamHandle) - start...
ExpQHYCCDSingleFrame(pCamHandle) - end...
ExpQHYCCDSingleFrame success.
Allocated memory for frame: 98083872 [uchar].
GetQHYCCDSingleFrame: 6000 x 4000, bpp: 16, channels: 1 ....
Received single frame of 6000 x 4000 px, bpp: 16, channels: 1.
CancelQHYCCDExposingAndReadout success.
Close QHYCCD success.
SDK resources released.
 
Thank you much for your help and for looking at this. Your forum's been very helpful!