Menu

ASCOM access to USB focuser

Ray Owen
2023-10-13
2023-10-22
  • Ray Owen

    Ray Owen - 2023-10-13

    I'm building a second focuser for a new RC-8 telescope. This one is based on the myFP2M board (v13 PCB) and running the v328 firmware. It is working well with the myFP2 Windows app.

    The issue is with the ASCOM driver (v300). If I try to connect more than one application to the focuser (SharpCap and the ASCOM Device Hub, for example) via ASCOM, I get the windows "unauthorized access exception" that happens when two applications try to access a single serial COM port. Of course, allowing multiple applications to access a single hardware port is what ASCOM is all about. I have to kill one process before attempting to connect the next process to the focuser controller.

    I've attached a log file for the ASCOM test app. In this example, I started SharpCap, then started myFP2ASCOMApp.

    By comparison, I'm running a myFP2ESP32 focuser (v304) on my newt with ASCOM driver 1.2.5.2. It works very well in providing multiple applications with access to focuser controls.

    Thanks,
    Ray

     
  • Ray Owen

    Ray Owen - 2023-10-13

    Correction: the ESP32 ASCOM driver is v301 on my current Newtonian setup. The ESP32 Windows app is 1.2.5.2.

     
  • brownrb

    brownrb - 2023-10-14

    Hi Ray
    If you want multiple access to myFP2 serial, then the ASCOM hub is your only option, which rules out using the myFP2 Windows app at the same time. This is a limitation of Windows OS. The ASCOM hub only supports multiple ASCOM clients, NOT ASCOM + Non-ASCOM clients.

    *Of course, allowing multiple applications to access a single hardware port is what ASCOM is all about. *

    I actually disagree with that statement, because it partly true - only ASCOM clients are allowed, not Windows applications.

    ASCOM Local Server is a work around on the Windows OS serial port access, and hides that implemenation for "ASCOM" devices only, not ASCOM + Windows but ASCOM + ASCOM. It does that by "Virtualising the serial port" - not really - it only opens a single connection to the focuser using the Serial port, but allows multiple clients to connect to the hub - it does not open multiple serial port connections (Windows does not allow that anyway).

    The myFP2 uses the standard ASCOM platform and Serial access, and is not LOCAL Server but the standard ASCOM driver.

    I have to kill one process before attempting to connect the next process to the focuser controller

    Yes, that is correct. The standard ASCOM driver does not "virtualize the serial port", hence access is controlled by Windows, not the ASCOM driver. That limitation exists for all drivers except those implemented as Local Server, which the myFP2 ASCOM driver is not, and passes all ASCOM Conform tests.

    The reason why it works on ESP32 has nothing really to do with ASCOM, and the limitation is easily overcome because the Serial port connection is not used at all, rather a TCPIP connection, and the underlying OS is happy to fork off each client as it connects to the TCPIP server, but there is a limitation of 4 simultaneous connections. So one can have Windows app, ASCOM driver connected over TCPIP without any issues. If the serial port was used to do this, then again, only one connection would be available.

    The ESP32 ASCOM driver latest is v302. The Windows app is v3004. I would reommend running the ALPACA Server on the ESP32 than using a local ASCOM driver on the client device.

    See
    https://www.youtube.com/watch?v=KklTVEl25hs
    for further info on ALPACA Server for myFP2ESP32.

    There is no plan to convert the myFP2 ASCOM driver to LOCAL Server. The majority of development is now concentrated in myFP2ESP32 and myFP2ESP8266.

    There is a firmware update to myFP2 coming shortly. The next firmware update for myFP2ESP32 will be myfp2esp32_309 (very soon).

    Regards
    Robert

     
  • brownrb

    brownrb - 2023-10-14

    myFP2M board (v13 PCB) and running the v328 firmware

    As a precaution, let me add that the myFP2M boards require the myFP2M firmware
    https://sourceforge.net/projects/arduinoascomfocuserpro2diy/files/myFocuserPro2M/

    because myFP2M boards do have different pin connenctions compared to myFP2.
    Hence myFP2 firmware shoud not be used with myFP2M boards. I think you probably known that already :-)

    Regards
    Robert

     
  • Ray Owen

    Ray Owen - 2023-10-14

    Robert,

    Thanks for an enlightening and quick response.

    All of my prior astro projects (myFP2ESP32, mySQM+, OnStep) have been built on the WeMOS ESP32 implementations, and offer TCP/IP webservers. I understood that the ASCOM driver was limited to ASCOM applications, but did not realize the crucial difference between ASCOM driver and ASCOM local server implementations. I have been spoiled by the ease of the TCP/IP vs COM approach.

    For this project, I was looking to implement a small "focuser cube" form factor, and that's why I ordered a handful of myFP2M PCBs instead of going with the PRO2ESP32DRV8825 PCB.

    You were right that I made sure to use the FP2M firmware with its tried-and-true board definitions ;)

    I will look forward to building an ESP32 PCB for the next project (or maybe the dew controller...)

    Regards,
    Ray

     
    • brownrb

      brownrb - 2023-10-14

      Hi Ray
      the mydcp4esp32 has had a major firmware update (I think around version 201+ at present, but no available publicly yet). I have been working on the myfp2esp32/esp8266 mostly as well as the mySQM+, all these will have new updates shortly,

      That work meant I needed to pause the dew controller work, but hope to get back to that in the next month or two. In the meantime Stephen did an update to v110, which works and fixes a dew bugs, to tide over until I can get back to develop the 200x firmware further.

      The main reason why the PCB for the focuser (and especially the esp32 dew controller) is larger than it needs to be is to handle the much higher currents involved. Thin PCB tracks will go up in smoke as they cannot handle the higher currents.

      Regards
      Robert

       

      Last edit: brownrb 2023-10-14
  • Ray Owen

    Ray Owen - 2023-10-17

    Robert,

    The RC-8 focuser project is almost complete. Today, I was testing the hardware as I completed mechanical assembly. I've attached the log file for a Windows COM port issue that popped up this afternoon.

    Between 1:02 and 1:07 pm, I started and stopped the FP2 Windows app several times with no issues. I was holding the temperature probe to verify that the temperature would go up and down. Before the last pass, I disconnected the probe (with the power off), and verified that the probe was not detected and that temperature was fixed at 20C. I also operated via the ASCOM driver without any problem.

    I then shut down all of the hardware and the mini PC, and worked on another project until 1:42 pm. On restarting the focuser controller via the Windows app, I received an "Error SerialPortInvalidState" status message. The log file shows a COMport failure. I can see the focuser appear and disappear on the Device Manager as I connect and disconnect it, but the app does not connect. I've tried a couple of cold restarts, with no success.

    Please let me know if there is any additional info that you need or tests to run.

    Regards,
    Ray

     
  • brownrb

    brownrb - 2023-10-18

    Hi Ray

    Between 1:02 and 1:07 pm, I started and stopped the FP2 Windows app several times with no issues.

    If the focuser connected first without issue this seems to indicate that the code is fine.

    *I then shut down all of the hardware and the mini PC, and worked on another project until 1:42 pm. On restarting the focuser controller via the Windows app, I received an "Error SerialPortInvalidState" *

    That it then failed to connect later (even though the focuser code was not altered) seems to point to the OS. Because nothing related to the controller changed. The log file clearly indicates the controller start sequences are identical. Only difference is first time serial port was ok, then for some reason the serial port could not be opened.

    That could be caused by a bad usb cable.
    I would replace the usb cable for a start.

    Here is something you might be able to do. Perhaps it is related to the way in which power up occurs. Sometimes 12V power to the controller can be an issue. More so with the ESP chips, but I have noticed with Nano as well.

    SEQUENCE 1
    Unplug the controller
    Shut down the PC (not reboot)
    Start the PC
    Connect the Controller to USB
    Power on 12V to the controller
    Run Windows app and attempt connect

    SEQUENCE 2
    Unplug the controller
    Shut down the PC (not reboot)
    Start the PC
    Power on 12V to the controller
    Connect the Controller to USB
    Run Windows app and attempt connect

    That is based on the 12V sometimes being isolated or a little suspect or affected by ripple-noise. So that when 12V comes on it can have the side effect of setting an invalid state.

    If that makes a difference it should be repeatable. And if repeatable, then it would point to the 12V supply either not grounded, or the existence of a ground loop, or high ripple.

    I also do not know how long your USB cable is?
    Is it from a powered or non-powered hub?

    Just an FYI
    When I was running a long 5m USB cable, I used a powered hub just for the focuser, so the hub provided the 5V power and not the PC. Long cables suffer from voltage drop, the data lines are affected less than the power, so the 5V into the cable becomes 4.5V or less when it gets to the controller.

    Regards
    Robert

     
  • Ray Owen

    Ray Owen - 2023-10-18

    Robert,

    In my current setup, the focus controller is connected directly to a mini-PC that also manages the camera(s) and mount. Prior to using the mini-PC, I used a powered hub and a powered 5-meter cable, for the reasons you noted.

    I tried both of your suggested power-on sequences, using three different USB cables (1-meter and two different 2-meter cables). The app consistently does not connect, with the Windows COM port failure.

    Thinking back to yesterday, between the successful sessions and the failed sessions, I had assembled the controller case, and thought perhaps I had broken something in the process. So I disassembled the controller back down to the PCB, then connected it via USB to the laptop that I use for programming Arduino devices. I did not make any 12V connection. I launched the Arduino serial monitor and connected to the USB COM port. When I input several FP2 commands (:02#, :04#, :06#), I received the expected replies from the controller.

    I tried connecting first USB, then 12V power. The controller successfully connected with the serial monitor. I could disconnect and reconnect 12V and continue to successfully use the USB COM port to command the controller. I then connected the temperature probe and was able to see the temperature change over time.

    I then tried connecting first 12V power, then USB. The device manager did not detect the USB COM port, and the serial monitor could not connect to it. When I disconnected 12V power while leaving USB connected, the device manager could now see the USB COM port. However, when I input an FP2 command via the serial monitor, the Arduino IDE displayed a Windows exception regarding a serial port failure.

    So there is definitely an issue with power-on sequence. I used a DC VOM to re-check voltages (I had tested them before installing the Nano). I see 12.5V at the PCB input, 8.03V at the regulator output, and 7.37V past the diode and at the Nano VIN pin.

    To recap, with the power sequence of USB first, then 12V; I could successfully command the controller via the serial monitor. So I installed myFP2Mini on my Arduino laptop and verified the serial monitor commands. Without any other change, I closed the Arduino app and opened the myFP2Mini app. When I tried to connect via myFP2Mini, I received a windows serial port error.

    I'm at a loss to explain why the controller, the Windows app, and the ASCOM app all worked over a period of several days, and then just stopped.

    A second question came up during this process. After using myFP2Mini on my laptop to demonstrate the problem, I tried to uninstall it. After the uninstall, Windows Settings no longer includes myFP2Mini in its list of installed apps. However, there is still a shortcut on the start menu. If I double-click on this shortcut, the app immediately launches. So the uninstall hasn't really uninstalled.

    Thanks for your guidance on all this.

    Regards,
    Ray

     
  • Ray Owen

    Ray Owen - 2023-10-19

    Robert,

    An update... I decided to start fresh with a previously unused Nano, connected only via USB. I programmed the FP2M firmware and verified FP2M commands via the Arduino serial monitor. When I tried to connect with the myFP2W or myFP2Mini app, I still receive the Windows serial port error. So I decided to start over on the Windows side, by reinstalling the CH340 driver (which I had freshly installed only last week). That corrected the problem, and I can now connect via the app or via ASCOM (direct or via the device hub).

    I've attached a photo of the focuser application. Just waiting for the MXL pulley and belt to complete the project.

    Thanks for your suggestions and insights. Looking forward to my next build.

    Regards,
    Ray

     
    • brownrb

      brownrb - 2023-10-19

      That corrected the problem, and I can now connect via the app or via ASCOM (direct or via the device hub).

      All is well then? If so just file the PDF somewhere (rubbish bin?).

      Regards
      Robert

       
    • Woodpeckercz

      Woodpeckercz - 2023-10-22

      Hi, same issue here. Reinstalling the driver helped.
      Seems like there is some new batch of CH340Gs going around on recent boards.
      I ordered new nano with USB C connector, uploaded same sketch that worked on my focuser before (arduino nano with USB mini).
      These new boards have ch340g chip on them without any markings.
      I've also came across some boards with CP2102 chip, though those were mostly ESP boards, but I did have one or two arduino boards with this UART chip.

       
  • brownrb

    brownrb - 2023-10-19

    Hi Ray

    The delay is around the attached document - for details about removing apps.

    I attach the following, concerning the last part of your last message (myfp2mini).

    One click apps are poorly implemented by MS (my opinion) and every MS update seems to make things worse. But one click apps are the only way a small hobby type person can make without paying big dollars going through the signing and approval necessary from MS.

    It could be prudent to remove existing myFP2 apps and ASCOM driver.
    ASCOM driver can be done via control pabel and should uninstall ok.

    After uninstall check
    C:\Program Files (x86)\Common Files\ASCOM\Focuser

    If there is a myFP2 folder delete it
    If there are any ASCOM.myFP2ASCOM.......dll delete them

    THEN see the instructions in the attached PDF to remove one-click app for myFP2

    Regards
    Robert

     
  • Ray Owen

    Ray Owen - 2023-10-19

    Robert,

    The pdf is very welcome, as it helps greatly with understanding the various Windows cleanup tasks. I have a year-old install of myFP2W on my laptop. I uninstalled it but have been unable to update it as Windows complains that there is the earlier version that conflicts. I'm sure the one-click removal instructions will enable me to fix that. Thanks!

    The USB COM issue (the other Windows problem) appears to be resolved with two CH340 driver reinstalls. I'm going to keep a driver install folder on my mini-PC for when something next happens in the middle of a clear night ;)

    Ray

     
  • brownrb

    brownrb - 2023-10-20

    Happy Imaging, Clear Skies etc

    Regards
    Robert

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.