Can't connect/download image from QHY9M ASCOM

Issue #193 closed
Samuel Roehr created an issue

Hardware:

QHY9M using ASCOM driver.

Camera using ASCOM has been tested and working in SharpCap.

Issue in NINA:

Issue exists in 1.8.1, 1.9.0.1021 and 1.9.0.1023 (32bit versions, as QHY doesn’t supply a 64-bit ASCOM driver for the QHY9M).

Attempting to connect the camera in NINA via ASCOM results in the following error message:

Please reconnect camera!

CheckDotNetExceptions.QHY9.Camera

connectedSet

System.NullReferenceException

: Objection reference not set to an 

instance of an object. (See

Inner Exception for details)

This error does not appear in NINA’s logs, even at Trace level.

I have came up with a hacky method to get the camera to connect:

  1. Unplug the camera’s USB cable
  2. In NINA on the camera equipment tab, click the ‘Refresh’ button
  3. Select the QHY ASCOM entry from the drop down list
  4. Plug in the camera’s USB cable
  5. Click ‘Connect’

The camera will then connect, can be cooled and will allow me to connect the QHYCFW filterwheel using its ASCOM driver.

If I try to capture an image, NINA will attempt to download the frame before throwing another “Object reference not set to an instance of an object” error (with the frame not successfully being downloaded). This time the error is captured by NINA’s logs, which show “[Message] Property read ASCOM.QHY9.Camera SensorType is not implemented in this driver.” when the frame download was attempted.

Workarounds:

QHY’s universal ASCOM driver (used for its CMOS cameras) will recognise and drive the QHY9M, including allowing me to connect to the QHYCFW filterwheel and successfully download frames. However using the TEC cooler from NINA causes the ASCOM driver to ramp up cooler power at crazy rate no matter what the min. duration is set to, or what NINA tells it the target temperature is (resulting in NINA targetting 5 degrees below ambient, while the camera has hit -15 celcius and rapidly dropping and the ASCOM is keeping the cooler at 60% power, all within 30 seconds of clicking the ‘Cool Camera’ button).

The native QHY driver also works, but as per my other issue, this won’t enable the driving of the connected filterwheel.

Logs:

Trace level logs attached. As mentioned, they don’t show the original connection issue, but they do the image download. I’m hopeful that the issues are related.

Comments (7)

  1. Dale Ghent

    Hey Samuel, sorry you’re having this issue.

    To give me a better idea about what might be going on here, would you be willing to run the ASCOM Conformance checker against the QHY driver when it’s connected to the QHY9M?

    1. Download and install it from here: https://github.com/ASCOMInitiative/Conform/releases
    2. Go to Options and make sure Check Camera is checked.
    3. Go to Options and choose Select Driver
    4. In the “ASCOM Camera Chooser” window that pops up, select the normal QHY ASCOM driver you use (I’m guessing it is QHYCCD-Cameras-Capture)
    5. It may urge you to click on the Properties button. Just do that and look over the settings to make sure everything looks normal to you.
    6. Click OK
    7. Now go to File and select Check Conformance

    At this point, the Conformance Checker will test all the properties and actions of the ASCOM driver. It will make sure the correct errors are thrown where there are expected to be, and all that. When the test is done, could you please copy and paste the result text into this ticket? I’m looking for 1 of 2 things:

    1. It may be that the QHY ASCOM driver does not completely adhere to the ASCOM API rules and I need to let them know this so it can be fixed (and we can institute at temporary work-around)
    2. It might be that we are expecting the wrong conditions for an obscure property in the NINA ASCOM client code. Unlikely, but a possibility.

    Thanks for your help and let me know if you have any questions about the above.

  2. Samuel Roehr reporter

    Thanks for looking into this Dale. In this case the ASCOM driver is the one released by QHY specifically for the QHY9 (found here), version 206 (beta 2), which has a file created date from 20 April 2018. Oddly the previous version of the driver is version 208 (beta 2), but it has an earlier file created date of 11 April 2018, so I think there was something lost in the filename translation.

    As you suspect, the ASCOM driver doesn’t fully comply with the API rules. Conformance Checker output below:

    ConformanceCheck ASCOM Device Conformance Checker Version 6.4.64.0, Build time: 7/06/2019 2:06:40 PM

    ConformanceCheck Running on: ASCOM Platform 6.4 SP1 6.4.1.2695

    ConformanceCheck Driver ProgID: ASCOM.QHY9.Camera

    Error handling

    Error number for "Not Implemented" is: 80040400

    Error number for "Invalid Value 1" is: 80040405

    Error number for "Value Not Set 1" is: 80040402

    Error number for "Value Not Set 2" is: 80040403

    Error messages will not be interpreted to infer state.

    19:01:38.009 Driver Access Checks OK

    19:01:38.695 AccessChecks OK Successfully created driver using late binding

    19:01:43.718 AccessChecks OK Successfully connected using late binding

    19:01:43.718 AccessChecks INFO The driver is a COM object

    19:01:44.483 AccessChecks INFO Driver does not expose interface ICamera

    19:01:44.842 AccessChecks INFO Device exposes interface ICameraV2

    19:01:44.888 AccessChecks OK Successfully created driver using driver access toolkit

    19:01:45.200 AccessChecks OK Successfully connected using driver access toolkit

    Conform is using ASCOM.DriverAccess.Camera to get a Camera object

    19:01:45.263 ConformanceCheck OK Driver instance created successfully

    19:01:45.637 ConformanceCheck OK Connected OK

    Common Driver Methods

    19:01:45.684 InterfaceVersion OK 2

    19:01:45.715 Connected OK True

    19:01:45.746 Description OK QHY9 CCD Camera.

    19:01:45.778 DriverInfo OK Information about the driver itself. Version: 2.0

    19:01:45.809 DriverVersion OK 2.0

    19:01:45.840 Name OK Short driver name - please customise

    19:01:45.871 CommandString INFO Conform cannot test the CommandString method

    19:01:45.871 CommandBlind INFO Conform cannot test the CommandBlind method

    19:01:45.871 CommandBool INFO Conform cannot test the CommandBool method

    19:01:45.887 Action INFO Conform cannot test the Action method

    19:01:45.918 SupportedActions OK Driver returned an empty action list

    Can Properties

    19:01:45.996 CanAbortExposure OK True

    19:01:46.012 CanAsymmetricBin OK False

    19:01:46.012 CanGetCoolerPower OK True

    19:01:46.027 CanPulseGuide OK False

    19:01:46.027 CanSetCCDTemperature OK True

    19:01:46.043 CanStopExposure OK True

    19:01:46.043 CanFastReadout OK False

    Pre-run Checks

    Last Tests

    19:01:46.136 LastExposureDuration OK LastExposureDuration correctly generated a COM exception before an exposure was made

    19:01:46.136 LastExposureStartTime OK LastExposureStartTime correctly generated a COM exception before an exposure was made

    Properties

    19:01:46.183 MaxBinX OK 4

    19:01:46.214 MaxBinY OK 4

    19:01:46.246 BinX Read OK 1

    19:01:46.277 BinY Read OK 1

    19:01:46.308 BinX Write ERROR Invalid value 0 written but no exception generated

    19:01:46.308 BinX Write ERROR Invalid value 5 written but no exception generated

    19:01:46.324 BinY Write ERROR Invalid value 0 written but no exception generated

    19:01:46.324 BinY Write ERROR Invalid value 5 written but no exception generated

    19:01:46.339 BinXY Write OK Successfully set symmetric xy binning: 1 x 1

    19:01:46.339 BinXY Write OK Successfully set symmetric xy binning: 2 x 2

    19:01:46.339 BinXY Write OK Successfully set symmetric xy binning: 3 x 3

    19:01:46.355 BinXY Write OK Successfully set symmetric xy binning: 4 x 4

    19:01:46.355 CameraState OK cameraIdle

    19:01:46.402 CameraXSize OK 3336

    19:01:46.433 CameraYSize OK 2496

    19:01:46.464 CCDTemperature OK 24.0169461618086

    19:01:46.511 CoolerOn Read OK False

    19:01:46.542 CoolerOn Write OK Successfully changed CoolerOn state

    19:01:46.542 CoolerPower OK 0

    19:01:46.589 ElectronsPerADU OK Optional member threw a PropertyNotImplementedException exception.

    19:01:46.620 FullWellCapacity OK Optional member threw a PropertyNotImplementedException exception.

    19:01:46.651 HasShutter OK True

    19:01:46.698 HeatSinkTemperature OK Optional member threw a PropertyNotImplementedException exception.

    19:01:46.776 ImageReady OK False

    19:01:46.807 ImageArray OK Exception correctly generated when ImageReady is false

    19:01:46.823 ImageArrayVariant OK Exception correctly generated when ImageReady is false

    19:01:46.823 IsPulseGuiding OK False

    19:01:46.870 MaxADU OK 20000

    19:01:46.901 NumX Read OK 3336

    19:01:46.932 NumX write OK Successfully wrote 1668

    19:01:46.932 NumY Read OK 2496

    19:01:46.963 NumY write OK Successfully wrote 1248

    19:01:46.963 PixelSizeX OK 5.4

    19:01:46.994 PixelSizeY OK 5.4

    19:01:47.026 SetCCDTemperature Read OK -10

    19:01:47.057 SetCCDTemperature Write OK Successfully wrote 0

    19:01:47.072 SetCCDTemperature Write ISSUE Setpoint could be set below absolute zero!

    19:01:47.072 SetCCDTemperature Write ISSUE Setpoint could be set to 100 degrees!

    19:01:47.088 StartX Read OK 0

    19:01:47.119 StartX write OK Successfully wrote 1668

    19:01:47.119 StartY Read OK 0

    19:01:47.150 StartY write OK Successfully wrote 1248

    19:01:47.150 SensorType Read ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification.

    19:01:47.150 BayerOffset Read INFO Unable to read SensorType value; assuming that the sensor is Monochrome

    19:01:47.166 BayerOffsetX Read OK Sensor type is Monochrome and a PropertyNotImplementedException exception was generated as expected

    19:01:47.182 BayerOffsetY Read OK Sensor type is Monochrome and a PropertyNotImplementedException exception was generated as expected

    19:01:47.182 ExposureMax Read OK 31536000

    19:01:47.197 ExposureMin Read OK 0

    19:01:47.197 ExposureMin OK ExposureMin is less than or equal to ExposureMax

    19:01:47.213 ExposureResolution Read ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification.

    19:01:47.213 ExposureResolution OK ExposureResolution is less than or equal to ExposureMax

    19:01:47.228 FastReadout Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.244 FastReadout Write OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.244 GainMin Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.260 GainMax Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.275 GainMinMax OK Both GainMin and GainMax are readable or both throw exceptions

    19:01:47.275 Gains Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.291 Gain Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.306 PercentCompleted Read OK Optional member threw a PropertyNotImplementedException exception.

    19:01:47.322 ReadoutModes Read OK Fast

    19:01:47.322 ReadoutModes Read OK Normal

    19:01:47.338 ReadoutMode Read OK 0

    19:01:47.338 ReadoutMode Index OK ReadReadoutMode is within the bounds of the ReadoutModes ArrayList

    19:01:47.353 ReadoutMode Index INFO Current value: Fast

    19:01:47.369 SensorName Read ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification.

    Methods

    19:01:47.416 AbortExposure OK No exception generated when camera is already idle

    19:01:47.431 PulseGuide OK CanPulseGuide is false and PulseGuide is not implemented in this driver

    19:01:47.447 StopExposure OK No exception generated when camera is already idle

    Take image full frame 1 x 1 bin

    19:02:04.420 StartExposure OK Asynchronous exposure found OK: 2 seconds

    19:02:04.420 LastExposureDuration OK LastExposureDuration is: 2 seconds

    19:02:04.435 LastExposureStartTime OK LastExposureStartTime is correct to within 2 seconds: 2019-06-20T19:01:47 UTC

    19:02:05.574 ImageArray OK Successfully read 32 bit integer array (1 plane) 3336 x 2496 pixels

    19:02:13.000 ImageArrayVariant OK Successfully read variant array (1 plane) with System.Int32 elements 3336 x 2496 pixels

    Take image full frame 2 x 2 bin

    19:02:19.942 StartExposure OK Asynchronous exposure found OK: 2 seconds

    19:02:19.942 LastExposureDuration OK LastExposureDuration is: 2 seconds

    19:02:19.957 LastExposureStartTime OK LastExposureStartTime is correct to within 2 seconds: 2019-06-20T19:02:13 UTC

    19:02:20.363 ImageArray OK Successfully read 32 bit integer array (1 plane) 1668 x 1248 pixels

    19:02:22.188 ImageArrayVariant OK Successfully read variant array (1 plane) with System.Int32 elements 1668 x 1248 pixels

    Take image full frame 3 x 3 bin

    19:02:26.884 StartExposure OK Asynchronous exposure found OK: 2 seconds

    19:02:26.884 LastExposureDuration OK LastExposureDuration is: 2 seconds

    19:02:26.899 LastExposureStartTime OK LastExposureStartTime is correct to within 2 seconds: 2019-06-20T19:02:22 UTC

    19:02:27.040 ImageArray OK Successfully read 32 bit integer array (1 plane) 1112 x 832 pixels

    19:02:27.757 ImageArrayVariant OK Successfully read variant array (1 plane) with System.Int32 elements 1112 x 832 pixels

    Take image full frame 4 x 4 bin

    19:02:31.829 StartExposure OK Asynchronous exposure found OK: 2 seconds

    19:02:31.829 LastExposureDuration OK LastExposureDuration is: 2 seconds

    19:02:31.844 LastExposureStartTime OK LastExposureStartTime is correct to within 2 seconds: 2019-06-20T19:02:27 UTC

    19:02:31.922 ImageArray OK Successfully read 32 bit integer array (1 plane) 834 x 624 pixels

    19:02:32.484 ImageArrayVariant OK Successfully read variant array (1 plane) with System.Int32 elements 834 x 624 pixels

    StartExposure error cases

    19:02:32.546 StartExposure OK Exception correctly generated for negative duration

    19:02:32.593 StartExposure Test: X size larger than binned chip size, Bin 1x1

    19:02:32.593 StartExposure ERROR Expected an exception and didn't get one - BinX:1 BinY:1 StartX:0 StartY:0 NumX:3337 NumY:2496

    19:02:32.656 StartExposure Test: Y size larger than binned chip size, Bin 1x1

    19:02:32.656 StartExposure ERROR Expected an exception and didn't get one - BinX:1 BinY:1 StartX:0 StartY:0 NumX:3336 NumY:2497

    19:02:32.702 StartExposure Test: X start outside binned chip size, Bin 1x1

    19:02:32.702 StartExposure ERROR Expected an exception and didn't get one - BinX:1 BinY:1 StartX:3337 StartY:0 NumX:3336 NumY:2496

    19:02:32.765 StartExposure Test: Y start outside binned chip size, Bin 1x1

    19:02:32.765 StartExposure ERROR Expected an exception and didn't get one - BinX:1 BinY:1 StartX:0 StartY:2497 NumX:3336 NumY:2496

    19:02:32.812 StartExposure Test: X size larger than binned chip size, Bin 2x2

    19:02:32.812 StartExposure ERROR Expected an exception and didn't get one - BinX:2 BinY:2 StartX:0 StartY:0 NumX:1669 NumY:1248

    19:02:32.858 StartExposure Test: Y size larger than binned chip size, Bin 2x2

    19:02:32.858 StartExposure ERROR Expected an exception and didn't get one - BinX:2 BinY:2 StartX:0 StartY:0 NumX:1668 NumY:1249

    19:02:32.905 StartExposure Test: X start outside binned chip size, Bin 2x2

    19:02:32.905 StartExposure ERROR Expected an exception and didn't get one - BinX:2 BinY:2 StartX:1669 StartY:0 NumX:1668 NumY:1248

    19:02:32.952 StartExposure Test: Y start outside binned chip size, Bin 2x2

    19:02:32.952 StartExposure ERROR Expected an exception and didn't get one - BinX:2 BinY:2 StartX:0 StartY:1249 NumX:1668 NumY:1248

    19:02:32.999 StartExposure Test: X size larger than binned chip size, Bin 3x3

    19:02:32.999 StartExposure ERROR Expected an exception and didn't get one - BinX:3 BinY:3 StartX:0 StartY:0 NumX:1113 NumY:832

    19:02:33.046 StartExposure Test: Y size larger than binned chip size, Bin 3x3

    19:02:33.046 StartExposure ERROR Expected an exception and didn't get one - BinX:3 BinY:3 StartX:0 StartY:0 NumX:1112 NumY:833

    19:02:33.092 StartExposure Test: X start outside binned chip size, Bin 3x3

    19:02:33.092 StartExposure ERROR Expected an exception and didn't get one - BinX:3 BinY:3 StartX:1113 StartY:0 NumX:1112 NumY:832

    19:02:33.139 StartExposure Test: Y start outside binned chip size, Bin 3x3

    19:02:33.139 StartExposure ERROR Expected an exception and didn't get one - BinX:3 BinY:3 StartX:0 StartY:833 NumX:1112 NumY:832

    19:02:33.186 StartExposure Test: X size larger than binned chip size, Bin 4x4

    19:02:33.186 StartExposure ERROR Expected an exception and didn't get one - BinX:4 BinY:4 StartX:0 StartY:0 NumX:835 NumY:624

    19:02:33.342 StartExposure Test: Y size larger than binned chip size, Bin 4x4

    19:02:33.342 StartExposure ERROR Expected an exception and didn't get one - BinX:4 BinY:4 StartX:0 StartY:0 NumX:834 NumY:625

    19:02:33.389 StartExposure Test: X start outside binned chip size, Bin 4x4

    19:02:33.389 StartExposure ERROR Expected an exception and didn't get one - BinX:4 BinY:4 StartX:835 StartY:0 NumX:834 NumY:624

    19:02:33.436 StartExposure Test: Y start outside binned chip size, Bin 4x4

    19:02:33.436 StartExposure ERROR Expected an exception and didn't get one - BinX:4 BinY:4 StartX:0 StartY:625 NumX:834 NumY:624

    Post-run Checks

    19:02:33.545 PostRunCheck OK Camera returned to initial cooler temperature

    Conformance test complete

    Your driver had 20 errors, 0 warnings and 5 issues

  3. Dale Ghent

    Thanks for providing this, Samuel. This confirmed my suspicion as well as indicates a few other issues with the QHY ASCOM driver.

    19:01:47.150 SensorType Read ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification.
    

    As that indicates, the SensorType property of a camera ASCOM driver is mandatory, and we rely on it to know if the camera is monochrome or color. Because the ASCOM API spec says it is a mandatory property, we fail the camera connect if it is not present.

    We could put in a workaround to default to Monochrome in cases that the property fails as is does here, but optimally, QHY would need to fix their driver to conform properly to what the API demands. I looked at the other issues noted by the Conform test and those will not impact NINA, although they should be fixed as well.

    I will contact QHY and let them know about these issues and point them to your test results so that they can address these issues in their driver. In the mean time I will confer with the other NINA developers if we want to deviate from the API and put a failsafe in here (ie, default to Mono if the property fails)

  4. Samuel Roehr reporter

    No problem Dale, I appreciate the work you are doing trying to find a solution for my hardware.

    I suspect other software has a workaround like you suggest (or there is some non-standard attribute that QHY put in ASCOM drivers for their older cameras?). Hopefully you reaching out to QHY will prompt them to clean it up and bring the driver in line with the ASCOM standard - that would be the best outcome for everyone!

  5. Dale Ghent

    Hi Samuel, I received a reply from QHY.

    They explained that the QHY9 has two ASCOM drivers: an old one that is specific to the QHY9, and a new “All-in-one” driver that covers all of their camera models. Their recommendation is to use the new one. Judging from this line in the Conform output:

    ProgID: ASCOM.QHY9.Camera

    It might be that you’re still using the old QHY9-specific driver. That line is the ASCOM driver class being reported. You can download the latest All-in-One driver here:

    https://www.qhyccd.com/index.php?m=content&c=index&a=show&catid=141&id=30

    Would you mind giving this a try?

  6. Samuel Roehr reporter

    Thanks for reaching out to QHY Dale. I have actually tried the all-in-one ASCOM, and it does allow NINA to connect and take pictures (yay!), but when controlling the TEC cooler the power and temps go on an insane see-saw ride. Watching NINA tell the camera to drop half a degree from ambient, only for it to respond by cranking the TEC power up to 80% was not confidence inspiring!

    I put that down to the ASCOM driver though, not NINA. Using the ‘old’ QHY9 ASCOM and the native support in NINA sees the TEC cooling respond sensibly with a nice gradual increase in power and decrease in temps.

    I started to think I may just need to give up on the ASCOM driver for the QHY9, and use native support (I have a ZWO EFW and the vignetting isn’t terrible with 1.25” filters - I can live with it). Only now I am trying to use the native support seriously, rather than just seeing if it connects up, it seems it wont capture images either! When taking a capture the mechanical shutter doesn’t operate, and NINA instantly downloads (as a CCD the QHY9 is not a quick downloader) a blank image with zero for each pixel value. I think I need to put in another issue…

    I’m not having much luck here!

  7. Log in to comment