grid-control icon indicating copy to clipboard operation
grid-control copied to clipboard

Response 0x20

Open Clemalamma opened this issue 5 years ago • 9 comments

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

Clemalamma avatar Oct 10 '18 15:10 Clemalamma

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.

akej74 avatar Oct 10 '18 19:10 akej74

Absolutely. Let me know what I need to do!

On Wed, Oct 10, 2018, 3:46 PM Åke Johansson [email protected] 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 .

Clemalamma avatar Oct 10 '18 19:10 Clemalamma

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.

akej74 avatar Oct 11 '18 08:10 akej74

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 [email protected] 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 avatar Oct 11 '18 13:10 Clemalamma

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 [email protected] 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 avatar Oct 11 '18 13:10 Clemalamma

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 :-)

akej74 avatar Oct 11 '18 18:10 akej74

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 [email protected] 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 avatar Oct 11 '18 21:10 Clemalamma

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 [email protected] 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 [email protected] 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 avatar Oct 11 '18 21:10 Clemalamma

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.

akej74 avatar Oct 12 '18 09:10 akej74