akej74 / grid-control

Grid Control is a free and open source alternative to the CAM application from NZXT
GNU General Public License v3.0
147 stars 31 forks source link

Response 0x20 #33

Open Clemalamma opened 6 years ago

Clemalamma commented 6 years ago

When attempting to connect to Grid+ v2 using grid control, I receive the following error:

Problem initializing the Grid unit.

Response 0x21 expected, got 0x20.

Please check serial port COM3.

I have confirmed that is the correct com port by unplugging and replugging the grid+ while monitoring device manager. Using Openhardwaremonitor v0.8.0.3alpha and grid control 1.0.9

akej74 commented 6 years ago

Hi, it seems strange that the Grid responds with 0x20 and not the expected 0x21; I have never seen this behaviour when testing with my Grid unit.

Would you be OK with helping me troubleshoot this by running Grid Control from the Python source directly...? If so, I can provide some easy to follow steps to get it up and running by installing Python and the required modules on your machine. I think this is the best way forward to pinpoint the root cause of the problem, please let me know what you think about this idea.

Clemalamma commented 6 years ago

Absolutely. Let me know what I need to do!

On Wed, Oct 10, 2018, 3:46 PM Åke Johansson notifications@github.com wrote:

Hi, it seems strange that the Grid responds with 0x20 and not the expected 0x21; I have never seen this behaviour when testing with my Grid unit.

Would you be OK with helping me troubleshoot this by running Grid Control from the Python source directly...? If so, I can provide some easy to follow steps to get it up and running by installing Python and the required modules on your machine. I think this is the best way forward to pinpoint the root cause of the problem, please let me know what you think about this idea.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akej74/grid-control/issues/33#issuecomment-428706047, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap_d_oC5vF-v3Emb3A3OVXTjq-rxjpMnks5ujk6QgaJpZM4XVkxt .

akej74 commented 6 years ago

Great! Please proceed as follows:

Install Python 3.7 (make sure to select "Add Python to PATH..." in the installer, that allows you to run Python from CMD line easily).

Create a simple Python script ("hello world" or similar) and verify you can run it from CMD line: python my_test_app.py

Verify you can install python modules with "pip" from CMD line, you need the following for running Grid Control:

pip install WMI
pip install PyQt5
pip install pyserial
pip install pypiwin32

Download the source for Grid Control 1.0.9 (see release page), unzip.

Go to the "grid-control" folder and run "gridcontrol.py" as follows:

cd grid-control
python gridcontrol.py

That should do it, let's see how it goes. If everything is OK, Grid Control should launch.

Optional (but recommended), have a look at the free IDE "PyCharm community edition", it's a very nice Integrated Development Environment for Python and is what I'm using for my Python projects.

Clemalamma commented 6 years ago

Oh man, been a hot minute since I've done command line work but I got it going. When running through command line, I received the same error as before. Grid Control starts properly, but when trying to select COM3 as the serial port, I receive the "Response 0x21 expected, got 0x20" again.

On Thu, Oct 11, 2018 at 4:30 AM Åke Johansson notifications@github.com wrote:

Great! Please proceed as follows:

Install Python 3.7 (make sure to select "Add Python to PATH..." in the installer, that allows you to run Python from CMD line easily).

Create a simple Python script ("hello world" or similar) and verify you can run it from CMD line: python my_test_app.py

Verify you can install python modules with "pip" from CMD line, you need the following for running Grid Control:

pip install WMI pip install PyQt5 pip install pyserial pip install pypiwin32

Download the source for Grid Control 1.0.9 (see release page), unzip.

Go to the "grid-control" folder and run "gridcontrol.py" as follows:

cd grid-control python gridcontrol.py

That should do it, let's see how it goes. If everything is OK, Grid Control should launch.

Optional (but recommended), have a look at the free IDE "PyCharm community edition", it's a very nice Integrated Development Environment for Python and is what I'm using for my Python projects.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akej74/grid-control/issues/33#issuecomment-428867671, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap_d_jmCDFyC0NDzRNeIcqWltUneoHA0ks5ujwGlgaJpZM4XVkxt .

Clemalamma commented 6 years ago

For further testing, I reinstalled CAM to see what would happen when selecting that COM port and received the following error:

Could not open serial port COM3.

Is another instance of Grid Control running?

Exception:

could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)

The application will now exit.

Not sure if that gives any insight when combined with the other information or not.

On Thu, Oct 11, 2018 at 4:30 AM Åke Johansson notifications@github.com wrote:

Great! Please proceed as follows:

Install Python 3.7 (make sure to select "Add Python to PATH..." in the installer, that allows you to run Python from CMD line easily).

Create a simple Python script ("hello world" or similar) and verify you can run it from CMD line: python my_test_app.py

Verify you can install python modules with "pip" from CMD line, you need the following for running Grid Control:

pip install WMI pip install PyQt5 pip install pyserial pip install pypiwin32

Download the source for Grid Control 1.0.9 (see release page), unzip.

Go to the "grid-control" folder and run "gridcontrol.py" as follows:

cd grid-control python gridcontrol.py

That should do it, let's see how it goes. If everything is OK, Grid Control should launch.

Optional (but recommended), have a look at the free IDE "PyCharm community edition", it's a very nice Integrated Development Environment for Python and is what I'm using for my Python projects.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akej74/grid-control/issues/33#issuecomment-428867671, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap_d_jmCDFyC0NDzRNeIcqWltUneoHA0ks5ujwGlgaJpZM4XVkxt .

akej74 commented 6 years ago

Good news that you got it up and running. The "Could not open serial port" problem is as expected when CAM is running, i.e. the CAM software locks the serial port (COM3 in this case). When Grid Control tries to open the serial port, it fails. Solution is to close CAM and make sure no CAM process is running in e.g. System Tray.

Now, let's see what can be done with the "0x20" response... Have a look at file "grid.py" (open in in Notepad++ or PyCharm). In lines 73-80 we have the following:

response = ser.read(size=1)

# Check if the Grid responded with any data
if response:
    # Check for correct response (should be 0x21)
    if response[0] == int("0x21", 16):
        print("Grid initialized")
        return True

    #Incorrect response received from the grid
    else:
        helper.show_error("Problem initializing the Grid unit.\n\n"
                                      "Response 0x21 expected, got " + hex(ord(response)) + ".\n\n"
                                      "Please check serial port " + ser.port +".\n")
        return False

If you add a extra check for "0x20" and return "True" in that case as well, we can see if the Grid works even that it returns the unsuspected "0x20". Code as follows:

response = ser.read(size=1)

# Check if the Grid responded with any data
if response:
    # Check for correct response (should be 0x21)
    if response[0] == int("0x21", 16):
        print("Grid initialized")
        return True

    # Check for the unsuspected 0x20
    elif response[0] == int("0x20", 16):
        print("We got 0x20, lets try anyway...")
        return True

    #Incorrect response received from the grid
    else:
        helper.show_error("Problem initializing the Grid unit.\n\n"
                                      "Response 0x21 expected, got " + hex(ord(response)) + ".\n\n"
                                      "Please check serial port " + ser.port +".\n")
        return False

Note that all blocks in Python must be indented correcty, exactly 4 spaces (or 8, 12 etc depending how deep the code is nested), so make sure the extra "elif" blocks lines up correctly.

Good luck and happy coding :-)

Clemalamma commented 6 years ago

Well I'm remembering why I always disliked coding! I can't seem to get it to run, despite notepad++ holding my hand through it all. This is the code as entered:

[image: image.png]

And this is the error I am getting from my command line: [image: image.png]

Any ideas on this one? I'm certain there is something super easy I'm missing, but I can't see to place it.

On Thu, Oct 11, 2018 at 2:03 PM Åke Johansson notifications@github.com wrote:

Reopened #33 https://github.com/akej74/grid-control/issues/33.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akej74/grid-control/issues/33#event-1898930021, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap_d_u__QI9sgSiW7wgRqpblr9bzNr2aks5uj4fygaJpZM4XVkxt .

Clemalamma commented 6 years ago

Nevermind, I'm an idiot. Switched to spaced and its running. Here's the output:

We got 0x20, lets try anyway... Fan 1 updated Fan 2 updated Fan 3 updated Fan 4 updated Fan 5 updated Fan 6 updated Starting thread... Error reading fan voltage, incorrect response Error reading fan voltage, no data returned Error reading fan voltage, no data returned

etc etc.

Seems to be running now, but with the same pulsing issues I was having with CAM

On Thu, Oct 11, 2018 at 5:16 PM Clem Coleman calamity.clem@gmail.com wrote:

Well I'm remembering why I always disliked coding! I can't seem to get it to run, despite notepad++ holding my hand through it all. This is the code as entered:

[image: image.png]

And this is the error I am getting from my command line: [image: image.png]

Any ideas on this one? I'm certain there is something super easy I'm missing, but I can't see to place it.

On Thu, Oct 11, 2018 at 2:03 PM Åke Johansson notifications@github.com wrote:

Reopened #33 https://github.com/akej74/grid-control/issues/33.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akej74/grid-control/issues/33#event-1898930021, or mute the thread https://github.com/notifications/unsubscribe-auth/Ap_d_u__QI9sgSiW7wgRqpblr9bzNr2aks5uj4fygaJpZM4XVkxt .

akej74 commented 6 years ago

Thanks for the information, as far as I can see, it looks like a HW issue with your grid unit. It responds with "0x20" after the handshake (wrong) and with some error after querying the fan voltage as well.

I suggest you try the following:

  1. Connect it to another USB port on your machine, do you get the same issue?

  2. Connect it to anther PC and see if you still get the same issue. If so, it's a problem with the grid unit. But, it it works OK in another machine, it may be some problem with your setup that needs to be investigated in more detail.