Homegate (4.6.1 and 4.7.1) and serial

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by desd, Sep 20, 2009.

  1. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    Using logic engine, all but one of our serial connections are at 9600 baud - and all work fine both writing and reading. This includes DVD players, projectors, amplifiers, tuners etc.
    We have a new piece of AV gear, a HT processor, that requires communication at 19200 baud. This does not work.
    Using hyperterminal set at 19200 baud, sending various amplfier commands thru logic displays rubbish. When hyperterm is set to 9600 baud, we start seeing perfectly formed (and appropriate) commands.
    Using Docklite (on the same PC as Homegate, with the same commands as programmed in logic in Homegate, and set to 19200 baud) we can control the Processor perfectly.
    It seems that the only thing we can think of is that logic in Homegate is communicating only at 9600 baud, no matter what is set as the comms initialisation.
    Any suggestions?
     
    desd, Sep 20, 2009
    #1
  2. desd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I just tested with HomeGate V4.7.1 and it worked fine. My setup was as follows:
    1. Null modem (cross-over) cable connecting COM1 and COM2
    2. HyperTerminal on COM2, set to:
    • 19200 Baud
    • 8 Data bits
    • No parity
    • 1 stop bit
    • No flow control
    3. Open serial port 1 in the logic initialisation section:
    Code:
    OpenSerial(1, 1, 19200, 8, 1, scNoFlowControl, scNoParity);
    4. Write to serial port 1 in the logic:
    Code:
    WriteSerial(1, 'Test 123'#13#10);
    delay(1);
    I suggest that you check that all other communication properties are set correctly (such as parity), not just the baud rate.
     
    Darren, Sep 21, 2009
    #2
  3. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    Hi Darren

    Thank you for the reply and testing. For varoius reasons I have had to go back to 4.6.1.
    I have just re-checked everything once again.

    The comm settings for both logic engine and hyperterm are the same:
    OpenSerial(3,1,19200,8,1,0,0);

    The codes for operating the Processor is in the following form:

    once GetCBusState("Local Network", "AV CONTROL 49", "SUNFIRE TGP5 ON") then begin
    WriteSerial(3,'@1POWRON'#13);
    end;

    Hypertem at 19200baud, I get rubbish.
    Changing hyperterm to 9600 baud (no othe changes) I get "@1POWRON"
     
    desd, Sep 21, 2009
    #3
  4. desd

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    I suggest you download this program :

    http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx

    Run this, start it logging the port Homegate is using, then fire up Homegate and run your logic where it tries to connect... it will show you the program initialising the serial port and the settings it is using.

    Nick
     
    NickD, Sep 21, 2009
    #4
  5. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    Hi Nick

    Nice diagnostic tool for serial - thank you.
    When logic engine is set to 19200 baud, Portmon shows as 9600 baud when monitoring the port Homegate is using: OpenSerial(3,1,19200,8,1,0,0);
    Again, this is with 4.6.1

    I may have to try this again with 4.7.1 on a test machine
     
    desd, Sep 21, 2009
    #5
  6. desd

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    So it shows homegate.exe opening the serial port at 9600? Can you post a screenshot?

    Nick
     
    NickD, Sep 21, 2009
    #6
  7. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    Here is a screenshot

    The second connection was with logic engine set at 19200 baud.
    Also shows the '@1MUTON' command being sent successfully
     

    Attached Files:

    desd, Sep 21, 2009
    #7
  8. desd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I would suggest going back to basics. Do a really simple test like I did and see what happens. Then add the extra complexity of your other system.

    I don't suppose you have done something odd like opening serial port 1 more than once have you? That might give odd behaviour. I noticed that you are using port index 3 for COM1. That is a good way to get yourself confused :)
     
    Darren, Sep 21, 2009
    #8
  9. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    I have gone back and checked this a few times.
    4 com ports are being used altogeter - the other 3 are USB to serial.
    Com 1 is, of course, native serial and hence used for this troublsome pup.

    The logic is as following:

    Initialisation

    {Kramer HDMI 6x6}
    OpenSerial(4,11,9600,8,1,0,0);
    {SUNFIRE TGP5}
    OpenSerial(3,1,19200,8,1,0,0);
    {denon 3930 dvd}
    OpenSerial(2,9,9600,8,1,0,2);
    {jvc hd1 projector}
    OpenSerial(1,6,9600,8,1,0,0);

    Example of Control
    {Sets SUNFIRE Amp to ON}
    once GetCBusState("Local Network", "AV CONTROL 49", "SUNFIRE TGP5 ON") then begin
    WriteSerial(3,'@1POWRON'#13);
    end;
    {Sets SUNFIRE Amp to OFF}
    once (GetCBusState("Local Network", "AV CONTROL 49", "SUNFIRE TGP5 OFF")=ON) then
    begin
    {Starts Transmission}
    WriteSerial(3,'@1POWROF'#13) ;
    end;
    etc

    I might try re-installing Homegate 4.6.1 although it has behaved the same on 2 different 'PC's. I might also upgrade one to 4.7.1
     
    desd, Sep 21, 2009
    #9
  10. desd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Seriously, rather than trying stuff at random, start with something really simple like I did above.

    Whether it works or not, it will tell you a lot. If it works, it tells you that HomeGate does work with 19200 baud and that your computer serial port is working, but there is something unusual about your project. If it doesn't work, it tells you that either HomeGate isn't working correctly or there is a problem with your computer serial port. Either way, you will be a big step forward.
     
    Darren, Sep 21, 2009
    #10
  11. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    Hi Darren

    simple is good...
    I tried what you suggested:

    OpenSerial(1,1,19200,8,1,0,0);
    WriteSerial(1,'Test123'#13#10);
    delay(1);
    This worked perfectly with hypertem set at 19200 baud

    The I tried an acutal code:
    WriteSerial(1,'@1POWRON'#13#10);
    delay(1);

    and this worked fine


    The I tried what I had in the project, namely using serial port index 3:

    OpenSerial(3,1,19200,8,1,0,0);
    WriteSerial(3,'@1POWRON'#13#10);
    delay(1);

    and I got rubbish.

    I appears that the issue may be using port index 3 at 19200 baud.
    Are you able to test this?
     
    desd, Sep 21, 2009
    #11
  12. desd

    desd

    Joined:
    Jul 7, 2005
    Messages:
    42
    Likes Received:
    0
    Location:
    NZ
    In addition

    It appears to work fine at 19200 baud on port indexes 1 and 2 -
    but not 3 and 4.
    All ports fine at 9600 baud.
     
    desd, Sep 22, 2009
    #12
  13. desd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Thanks. That is what I needed to know!

    I won't get to test this until Thursday. In the meantime, just rearrange your port usage so that the 19200 baud one is using index 1 or 2 and you should be fine.
     
    Darren, Sep 22, 2009
    #13
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.