Menu

S7-200 Communication Problem

Help
serkan
2006-02-13
2013-05-09
  • serkan

    serkan - 2006-02-13

    Hello...
    I'm trying to connect with S7-226 CPU. When I executed NodaveDemo.exe (written in delphi) program I received this error message: "Error[-1025] : Time out when waiting PLC response"
    Then I tried testppi.exe program. The result was the same: "result of exchange: -1025"

    Thanks for your help...

    PS: testppi.exe -d com4 expression gives that result:

    setPort com4
    setPort 9600
    setPort E
    PDU header:
    0:0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,
    plen: 8 dlen: 0
    Parameter:
    0:0xF0,0x00,0x00,0x01,0x00,0x01,0x03,0xC0,
    _daveExchange PDU number: 65535
    I send:
    0:0x68,0x15,0x15,0x68,
    I send:
    0:0x68,0x15,0x15,0x68,
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0xFF,0xFF,0x00,0x08,0x00,0x00,0xF0,0x00,0x00,
    10:0x01,0x00,0x01,0x03,0xC0,0x5C,0x16,
    send 21
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0xFF,0xFF,0x00,0x08,0x00,0x00,0xF0,0x00,0x00,
    10:0x01,0x00,0x01,0x03,0xC0,0x5C,0x16,
    i:1 res:0
    got:
    0:0xCA,
    I send:
    0:0x10,
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    send 3
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    i:0 res:0
    result of exchange: -1025
    Trying to read 64 bytes (32 words) from data block 1.
    This is V memory of the 200.
    Press return to continue.
    PDU header:
    0:0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,
    plen: 14 dlen: 0
    Parameter:
    0:0x04,0x01,0x12,0x0A,0x10,0x02,0x00,0x40,0x00,0x01,0x84,0x00,0x00,0x00,
    _daveExchange PDU number: 65536
    I send:
    0:0x68,0x1B,0x1B,0x68,
    I send:
    0:0x68,0x1B,0x1B,0x68,
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x04,0x01,0x12,
    10:0x0A,0x10,0x02,0x00,0x40,0x00,0x01,0x84,0x00,0x00,0x00,0xA7,0x16,
    send 27
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x04,0x01,0x12,
    10:0x0A,0x10,0x02,0x00,0x40,0x00,0x01,0x84,0x00,0x00,0x00,0xA7,0x16,
    i:1 res:0
    got:
    0:0x10,
    I send:
    0:0x10,
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    send 3
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    i:1 res:1
    i:1 res:2
    i:1 res:3
    i:0 res:3
    result of exchange: -1025
    Trying to read 16 bytes from FW0.
    Press return to continue.
    PDU header:
    0:0x32,0x01,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,
    plen: 14 dlen: 0
    Parameter:
    0:0x04,0x01,0x12,0x0A,0x10,0x02,0x00,0x10,0x00,0x00,0x83,0x00,0x00,0x00,
    _daveExchange PDU number: 65537
    I send:
    0:0x68,0x1B,0x1B,0x68,
    I send:
    0:0x68,0x1B,0x1B,0x68,
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0x00,0x01,0x00,0x0E,0x00,0x00,0x04,0x01,0x12,
    10:0x0A,0x10,0x02,0x00,0x10,0x00,0x00,0x83,0x00,0x00,0x00,0x76,0x16,
    send 27
    I send:
    0:0x02,0x00,0x6C,0x32,0x01,0x00,0x00,0x00,0x01,0x00,0x0E,0x00,0x00,0x04,0x01,0x12,
    10:0x0A,0x10,0x02,0x00,0x10,0x00,0x00,0x83,0x00,0x00,0x00,0x76,0x16,
    i:1 res:0
    got:
    0:0x10,
    I send:
    0:0x10,
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    send 3
    I send:
    0:0x02,0x00,0x5C,0x5E,0x16,
    i:1 res:1
    i:1 res:2
    i:0 res:2
    result of exchange: -1025

     
    • Nobody/Anonymous

      It seems that nothing ever comes back from the CPU. You are using COM4, while most computers do have 1 or 2 conventional serial ports. Is it a USB device or a virtual com port, e.g. redirected via ethernet?
      If so can you try to use a conventional one?

      Thomas

       
    • Nobody/Anonymous

      Yes It's a USB-Serial converter. But I can successfully download and upload with Microwin 4.0 with this USB-Serial convertor.

       
    • Nobody/Anonymous

      Ok, I believe you that Microwin can use it but I never tried such thing with Libnodave.
      Can you try a conventional com port, maybe on another computer?
      Another thing: Which PPI-cable do you use?
      You may NOT set to PPI / Multimaster those which can do that.

       
    • Nobody/Anonymous

      I tried a conventional comport. "testppi.exe -d com1" It's OK. It's running properly. But NodaveDemo.exe written in delphi didn't work.
      My connection parameters were like below:
      remote adress :2
      MPI Local adress: 0
      MPI speed: 9.6 kbit per second
      I'm trying to read datablock 1

      result : Error [-1025] Timeout when waiting PLC responce.
      What's the problem here?

      I use RS232/PPI Multimaster cable. I executed testpi.exe while the cable was in PPI mode.

      Serkan

       
      • afk

        afk - 2006-02-15

        I think the problem is the COMport-setup in the TNoDave component, which is fixed to 38.4kBit/sec. and no Parity. I never tried the Component with PPI because I didn't have any PPI-hardware, thus I've not recognized that there is a difference to the MPI-adapters (which I also didn't use). I must include a property for the COMport-parameters in the component to fix this.

        I don't know much about the adapters so I must ask the folowing questions to fix this problem properly:

        Is it possible to set the PPI-adapter to an other baud-rate and/or parity ?

        Do the serial/MPI-adapters also have different COMport-settings ?

        Which baud-rates are possible (with PPI and MPI) ?

        Axel

         
    • Nobody/Anonymous

      > which is fixed to 38.4kBit/sec. and no Parity.
      Didn't look it up but parity is odd for MPI as far as I remember...
      >Is it possible to set the PPI-adapter to an >other baud-rate and/or parity ?
      Yes, but that means that you must also set the PLC to that baudrate, which is maybe a bad idea, as I read every once in a time about S7-200 PLCs people cannot communicate with after doing that...
      >Do the serial/MPI-adapters also have different
      > COMport-settings ?
      Yes. 19.2 and 38.4 kBaud for Siemens models. Other manufacturers support up to 115.2. Note that in case of MPI the baudrate is independent of that between adapter and CPU.
      And teleservice adapters use different parity when used with a modem.

      Thomas

       
    • serkan

      serkan - 2006-02-15

      Axel >  I think the problem is the COMport-setup in the TNoDave component, which is fixed to 38.4kBit/sec. and no Parity

      I opened "nodavecomponent.pas" file and  replaced this line:

            DaveFDS.rfd:=SetPort(@Address[1], '38400', 'O');

      with this one:

            DaveFDS.rfd:=SetPort(@Address[1], '9600' , 'E');

      when I executed demo program. It worked.

      PPI/Multimaster Cable has a DIP Switch.  So we can select baudrate and packet size with this switch.
        The cable supports  115.2,  57.6, 38.4,  19.2, 9.6,  4.8,  2.4,  1.2 KBaud rate
        and have a 10 or 11 bit selection.

        I add a new property FPortSpeed to set boudrate.
                  
                  FPortSpeed: PChar;
                   ...
                   ...
                          ...
                  DaveFDS.rfd:=SetPort(@Address[1], FPortSpeed , 'E');

      testppi.c opens comport with 9600 baud but it uses daveSpeed187K while connecting PLC   with daveNewInterface. These two speeds are different. Why?  Is it normal?

         fds.rfd=setPort(argv[adrPos],"9600",'E');
         fds.wfd=fds.rfd;
         if (fds.rfd>0) {
          di =daveNewInterface(fds, "IF1", localPPI, daveProtoPPI, daveSpeed187k);
          dc =daveNewConnection(di, plcPPI, 0, 0);
                           daveConnectPLC(dc);

      TNoDaveSpeed = (               
                       daveSpeed9k,
                       daveSpeed19k,
                       daveSpeed187k,
                       daveSpeed500k,
                       daveSpeed1500k,
                       daveSpeed45k,
                       daveSpeed93k
      )

      setport function in setport.c
        if (0==strncmp(baud,"115200",6))
            newtio.c_cflag = B115200;
          else if (0==strncmp(baud,"57600",5))
            newtio.c_cflag = B57600;
          else if (0==strncmp(baud,"38400",5))   
            newtio.c_cflag = B38400;
          else if (0==strncmp(baud,"19200",5))
            newtio.c_cflag = B19200;
          else if (0==strncmp(baud,"9600",4))
            newtio.c_cflag = B9600;
          else if (0==strncmp(baud,"4800",4))
            newtio.c_cflag = B4800;
          else if (0==strncmp(baud,"2400",4))
            newtio.c_cflag = B2400;
          else if (0==strncmp(baud,"1200",4))
            newtio.c_cflag = B1200;
          else if (0==strncmp(baud,"600",3))
            newtio.c_cflag = B600;
          else if (0==strncmp(baud,"300",3))
            newtio.c_cflag = B300;

      Does it mean, Comport baudrates and MPI speeds are different things?

      I can only read DB1. How can I read inputs, outputs, timer values and M words?

                        

       
    • Nobody/Anonymous

      >Does it mean, Comport baudrates and MPI speeds
      >are different things?
      Yes. In PPI, the PPI adapter is more or less a level converter that converts unipolar voltage of RS232 levels do differential voltage of RS485 levels. Additionally, for PPI bus, it determines when it has to drive the bus (determine and provide the voltage actively).
      In MPI, the adapter is a device containing it's own microcontroller which talks to the RS232 side using one speed and to the MPI/Profibus side at another. Both communications happen at different times with data buffered in the adapter.
      > I can only read DB1. How can I read inputs, >outputs, timer values and M words?
      Don't know now with the component, but as far as I remember just chose from some list. Please note the following:
      S7 300 and 400 families can have several DB areas, depending on which DBs you did create in or copy to PLC.
      In S7 200 the V memory area just is "mapped" as one DB with number 1. This is NOT a property of Libnodave or a thing you could choose. It is just a so that Siemens made the 200s address V memory internally whenever S7 communication refers to DB1.
      There are no other DBs and DB1 is present from scratch with no need to create it.

      Thomas

       

Anonymous
Anonymous

Add attachments
Cancel