SGP Unable to Start PHD2


I am posting about the protocol between SGP and PHD2. In a session SGP seemed to go through the perpetual “starting autoguider” no matter what I did. I tried having SGP start PHD2 from scratch, start PHD2 and then begin the sequence so at least PHD2 was active, and all became perpetual so I reset SGP to think no guiding is involved and launched PHD2 separately to guide any way.

This is a renewal of a previous post because now I am able to provide the log file.!Ah4OVuGaaPaogc1mcOjKpKNOX9xE5g

Thanks for any feedback on:
[1] What is SGP programmed to do - expect in terms of dealing with PHD2
[2] What is your success story

Thanks a lot


As you might imagine, this is not the usual experience…otherwise it would be all over the forum.

  • When you do ‘connect all’ in SGP does it fire up PHD2 and connect to equipment?
  • Does PHD2 have the server enabled?
  • Do you set up and use PHD2 profiles?


If you look through your logs you will see the following:

SGP successfully connects to the PHD2 server:
[05/05/19 22:27:39.208][DEBUG] [Sequence Thread] Connecting to PHD2…
[05/05/19 22:27:39.211][DEBUG] [Sequence Thread] Waiting for socket connection to PHD2…
[05/05/19 22:27:39.219][DEBUG] [PHD2 Listener Thread] Attempting to connect to PHD2…
[05/05/19 22:27:40.211][DEBUG] [Sequence Thread] Successfully connected to PHD2…

It was able to do so because PHD2 was already open and so it did not have to launch it:
[05/05/19 22:27:40.354][DEBUG] [Sequence Thread] PHD2: PHD2 is already open…

After you start your sequence, SGP tries to get SGPs state:
[05/05/19 22:27:42.724][DEBUG] [Sequence Thread] Checking PHD2 state…
[05/05/19 22:27:42.724][DEBUG] [Sequence Thread] PHD2 GetPhdStatus - Pre-Wait : Selected
[05/05/19 22:27:42.724][DEBUG] [Sequence Thread] Sending to PHD2:
{“method”: “get_app_state”, “id”: 1001}

Attempting to get the state goes on for 9 minutes
[05/05/19 22:27:51.796][DEBUG] [Sequence Thread] PHD2 GetPhdStatus - Post-Wait: Selected
[05/05/19 22:27:51.798][DEBUG] [Sequence Thread] {“method”: “guide”, “params”: [{“pixels”: 0.5, “time”: 10, “timeout”: 600}, false ], “id”: 1003}
[05/05/19 22:27:51.798][DEBUG] [Sequence Thread] Sending to PHD2:
{“method”: “guide”, “params”: [{“pixels”: 0.5, “time”: 10, “timeout”: 600}, false ], “id”: 1003}

It’s not clear to me what happened then, but SGP then tries to start guiding anyway, but settle fails causing the sequence to fail:
[05/05/19 22:27:51.802][DEBUG] [Sequence Thread] PHD2: Attempting to start guiding, waiting for PHD2 settle done message…
[05/05/19 22:27:54.193][DEBUG] [PHD2 Listener Thread] Unknown object from PHD2: {“Event”:“SettleBegin”,“Timestamp”:1557120474.140,“Host”:“AZULLE”,“Inst”:1}
[05/05/19 22:28:55.148][DEBUG] [PHD2 Listener Thread] PHD2: Settle done received: BAD
[05/05/19 22:28:55.836][DEBUG] [Sequence Thread] PHD2 settle failed!

It then looks like you tries to start the sequence again:
[05/05/19 22:29:51.654][DEBUG] [Sequence Thread] Checking PHD2 state…
[05/05/19 22:29:51.654][DEBUG] [Sequence Thread] PHD2 GetPhdStatus - Pre-Wait : Selected
[05/05/19 22:29:51.654][DEBUG] [Sequence Thread] Sending to PHD2:
{“method”: “get_app_state”, “id”: 1001}

Ending in the same result:
[05/05/19 22:30:00.722][DEBUG] [Sequence Thread] PHD2: Attempting to start guiding, waiting for PHD2 settle done message…
[05/05/19 22:30:09.098][DEBUG] [PHD2 Listener Thread] Unknown object from PHD2: {“Event”:“SettleBegin”,“Timestamp”:1557120609.093,“Host”:“AZULLE”,“Inst”:1}
[05/05/19 22:30:48.030][DEBUG] [PHD2 Listener Thread] PHD2: Settle done received: BAD
[05/05/19 22:30:48.744][DEBUG] [Sequence Thread] PHD2 settle failed!

And finally you tried running the sequence a 3rd time, but at this point SGP could not even connect to the PHD2 server (was PHD2 still running at this point?)
[05/05/19 22:31:09.244][DEBUG] [Sequence Thread] PHD2: failed to receive status in 7 seconds, sending message again…
[05/05/19 22:31:09.244][DEBUG] [Sequence Thread] Sending to PHD2:
{“method”: “get_app_state”, “id”: 1001}

Unfortunately what we can’t tell from the SGP logs is what state PHD2 was actually in during all of these attempts to use it? Was it just launched? Was it connected to equipment? Looping? Guide star selected? Already guiding?

Here’s what I would suggest:
Just let SGP launch PHD2 for you. If that doesn’t work, share both your SGP and PHD2 debug logs here so we can try figure out why it did’t work.


SGPro trying to launch PHD2 for you has always been janky. As a result, your experience may not be great. Have considered many times removing that functionality and just requiring that PHD2 be open.

@Ken - in this case he already had PHD2 open and that is the scenario causing problems.

My personal experience is that it works best when I let SGP launch PHD2.

Thanks. And I don’t know what :HD log might be saying either. I can say that I am sitting here, going back and forth and don’t see that PHD is aware of SGP or being active with guiding. When I have it running and connected before starting SGP it then looks like it works.

I have tried it several nights. And yes, server is enabled.


As long as we know what the right process it should be fine. It is better to start PHD before anyway because of all the calibration and Guiding Assistance, star finding (in case of OAG), etc. that need to be done before a sequence can get started.


Not necessarily, as it happens automatically with SGP. I would still recommend do the calibration at low declination, telling it to re-use it and then shut PHD2 down and let SGP fire it up.

@Ken - does the PHD2/SGP communication go through a firewall - could it be some over attentive scanner?

Well, to me starting phd2, calibrating wherever, slewing to the target and finding a guide star and then starting the sequence is the best thing to do.

I have tried different ways and the one that always works for me is to start PHD2 and connect the equipment. I have PHD2 set to use the previous calibration, so then I just start the sequence. Works every time.

If I ever have to reset the calibration, use guiding assistance etc, I do it separately in PHD2 - not as part of the sequence.

That is the way I have been recently able to get it done.

SGPro talks to PHD2 over the HTTP protocol. Anything that monitors this traffic (a lot of things do) cal alter or block it. Most of these scanners allow traffic that does not leave the local machine to proceed unmolested, but I cannot speak for every type of monitoring software out there. If something seems weird, you can certainly try to disable that software, but more than likely this is an all or nothing proposition… meaning, it wouldn’t work sometimes and not others.

This is very interesting. How could this be checked and monitored?

I.m also having trouble getting SGP to connect to PHD2. I’ve tried pre-connecting PHD2 a,d letting SGP connect with connect all. I always get the same error and SGP terminates:

[07/02/19 13:40:42.827][DEBUG] [Telescope Thread] Telescope Dispatch loop: Received SGM_TELESCOPE_CONNECT…
[07/02/19 13:40:42.873][DEBUG] [Telescope Thread] Disconnecting ASCOM Telescope:
[07/02/19 13:40:42.875][DEBUG] [Telescope Thread] GlobalExceptionHandler caught : Creating an instance of the COM component with CLSID {E09E5EA3-18C9-4AAD-96C9-F474E4C374B3} from the IClassFactory failed due to the following error: 800a01a9 Exception from HRESULT: 0x800A01A9.
[07/02/19 13:40:42.875][DEBUG] [Telescope Thread] Runtime terminating: True

I’m using an LX200ACF, with the ASCOM driver, PHD2 2.6.6 and SGP
sg_logfile_20190702133932.txt (23.9 KB)

Steven - those errors and exceptions appear to be associated with the ASCOM telescope driver. Does your ASCOM driver allow multiple connections? It is unlikely but it could be that when SGP and PHD2 try and connect to your mount at the same time, the driver sends an error

Thanks Buzz,
That’s apparently the case. I need to use something called ASCOM POTH, which is a hub which allows multiple connections to the ASCOM driver. Would be nice if SGP didn’t hard crash when it can’t connect to the telescope.

I know this may sound odd but check and see if you have one or the other running as Administrator. What I have found is they both need to be the same setting, I think windows does some strange things around letting other apps call on each other if this is off, or A not Run as Admin Program tries to talk to a Run as Admin Program . I have SGP and PHD2 set to Run as Admin, once I did that a lot of my problems stopped.