Home AMX User Forum AMXForums Archive Threads AMX Hardware

Weird problems with NI700

Hi Guys, i'm still fairly new to AMX and recently i'm taking over from a co worker on an AMX assignment.
We have a code template used for previous similar projects. It is used mainly for Telnet controls and RS232 and it's been working fine so far on our demo NI-700 here in the office.

In the DEFINE_START section of code, we have IP_CLIENT_OPEN to start telnet connections.
For different projects, most of the time the variable for telnet connection would be the IP address and the port number.

Somehow, it just stopped working and the ONERROR feedback that we get is 7. When we check IP STATUS in the master during execute startup code process, it seems to be listening on a different port than what has been declared in code. No matter what we change in the code, this port value remains the same during execute of startup.

Since nothing worked, i did a factory reset on the unit. After that, it seems to get worse. Output LED does not respond to push event, IP_CLIENT_OPEN does not seem to execute at all during execute of startup (no active IP connections). Is my NI-700 dead? Anyway to fix this and get it up and running?

Comments

  • Hi Rogerlai,
    First of, what firmware do you have on the troubled NI-700? You might have even put it to factory firmware and might have to upgrade firmware.
    The error 7 is code for connection timeout, most likely because your port is wrong. Are you able to upload your code sample regarding IP-connection? Also report what findings you have about what port the NI-700 tries to upload on.
    Following is an example sample I use for TCP connections, here to a Digidim light controller, using port 50 000
    PROGRAM_NAME='dvDigidim'
    (***********************************************************)
    (*  FILE CREATED ON: 01/22/2016  AT: 08:48:27              *)
    (***********************************************************)
    (*  FILE_LAST_MODIFIED_ON: 02/15/2016  AT: 22:53:27        *)
    (***********************************************************)
    
    DEFINE_VARIABLE
    
      CHAR sDigidimBuffer[200] = ''
      INTEGER bDigidimOnline = 0
    
    DEFINE_CONSTANT
    
      CHAR dvDigidimIPAdress[15] = '10.254.1.1'
      INTEGER dvDigidimIPPort = 50000
      INTEGER bDigidimKeepOpen = 1
      INTEGER nDigidimRetryTime = 10
      
      
    DEFINE_MUTUALLY_EXCLUSIVE
    
    
      DEFINE_FUNCTION fnConnectToDigidim()
        {IP_CLIENT_OPEN(dvDigidim.port,dvDigidimIPAdress,dvDigidimIPPort,IP_TCP)}
      
    DEFINE_START
    
      CREATE_BUFFER dvDigidim, sDigidimBuffer
    
    DEFINE_EVENT
    
      DATA_EVENT[dvDigidim]
      {
        ONLINE:
        {
          bDigidimOnline = TRUE
          SEND_STRING 0,"'***TRACE - IP CONNECTION SUCCESSFUL Digidim***'"
        }
        OFFLINE:
        {
          bDigidimOnline = FALSE
          SEND_STRING 0,"'***TRACE - IP CONNECTION DISCONNECT Digidim***'"
          IF(bDigidimKeepOpen)
          {
            WAIT nDigidimRetryTime
              fnConnectToDigidim()
          }
        }
        ONERROR:
        {
          bDigidimOnline = FALSE
          SEND_STRING 0,"'***TRACE - IP CONNECTION FAILURE Digidim ***'"
          SWITCH(data.number)
          {
            CASE 2:{SEND_COMMAND 0,"'2:General Failure(Out of Memory)'"}
            CASE 4:{SEND_COMMAND 0,"'4:Unknown host'"}
            CASE 6:{SEND_COMMAND 0,"'6:Connection refused'"}
            CASE 7:{SEND_COMMAND 0,"'7:Connection timed out'"}
            CASE 8:{SEND_COMMAND 0,"'8:Unknown connection error'"}
            CASE 9:{SEND_COMMAND 0,"'9:Already closed'"}
            CASE 14:{SEND_COMMAND 0,"'14:Local port already used'"}
            CASE 16:{SEND_COMMAND 0,"'16:Too many open sockets'"}
            CASE 17:{SEND_COMMAND 0,"'17:Local Port Not Open'"}
          }
          IF(data.number != 9 || data.number != 17)
          {
            IF(bDigidimKeepOpen)
              {
                WAIT nDigidimRetryTime
                  fnConnectToDigidim()
              }
          }
        }
        STRING:
        {
        }
      }
    
  • Seems like its running the latest firmware as per AMX website:

    00000 (00298)NI Master (00001)AMX LLC 00341 v3.60.453
    05001 (00286)NI-700 (00001)AMX LLC 00346 v1.30.8

    When i was still able to get some feedback (before factory reset), the port value that appears is always 7003. As you can see in code, it is declared as 23. No matter what value is declared, feedback is 7003.


    DEFINE_DEVICE
    
    dvVistrol = 5001:2:0
    dvPanel = 10001:1:0
    vdvPanel = 33001:1:0
    dvVistrol_IP     = 0:3:0
    
    
    DEFINE_COMBINE (vdvPanel,dvPanel)
    
    tl_Feedback     = 10
    tl_Deqeue    = 11
    
    //IP Address
    char IP_Vistrol[15] = '10.4.0.158'
    integer pVistrol = 23
    
    DEFINE_VARIABLE
    
    
    LONG arrTlFeedBack[]    = { 1000 }
    LONG arrTlDeQueue[]    = { 100 }
    
    VOLATILE CHAR cVistrolQueue[255]
    INTEGER Vistrolcts
    CHAR Vistrolstack[1000]
    CHAR Vistrolsend[50]
    
    INTEGER ipVistrolcts
    CHAR ipVistrolstack[1000]
    CHAR ipVistrolsend[50]
    
    VOLATILE INTEGER TP_BUTTONS[]=
                    {
                    100,101,103,104,105,106,107,108,109,110
                    }
    INTEGER nVistrolConnect    = 0    
    CHAR cVistrolData[64]    = ''    
    LONG nVistrolError    = 0
    
    DEFINE_CALL'Vistrol Add Stack'(CHAR cmd[15])
    {
        Vistrolstack = "Vistrolstack,cmd,$0D"
    }
    
    DEFINE_CALL'ipVistrol Add Stack'(CHAR cmd[12])
    {
        ipVistrolstack = "ipVistrolstack,cmd,$0D"
    }
    DEFINE_CALL'OPEN IP CLIENT'
    {
        IP_CLIENT_OPEN(dvVistrol_IP.Port, IP_Vistrol, pVistrol, 1)
    }
    DEFINE_CALL'CLOSE IP CLIENT'
    {
        IP_CLIENT_CLOSE(dvVistrol_IP.Port)
    }
    
    DEFINE_START
    
    SEND_COMMAND dvVistrol,"'SET BAUD 115200,N,8,1 485 DISABLE'"
    ON[Vistrolcts]
    
    IP_CLIENT_OPEN(dvVistrol_IP.Port, IP_Vistrol, pVistrol, 1)
    
    timeline_create(tl_Feedback,arrTlFeedBack,length_array(arrTlFeedBack),timeline_relative,timeline_repeat)
    timeline_create(tl_Deqeue,arrTlDeQueue,length_array(arrTlDeQueue),timeline_relative,timeline_repeat)
    
    DEFINE_EVENT
    DATA_EVENT[dvVistrol]
    {
        ONLINE:
        {
        SEND_COMMAND dvVistrol,"'SET BAUD 115200,N,8,1 485 DISABLE'"
        ON[Vistrolcts]
        }
        STRING:
        {
        SEND_STRING 0,"'Vistrol Says >>>',DATA.TEXT"
        }
    }
    
    DATA_EVENT[dvVistrol_IP]
      { 
        ONLINE: 
            { 
            nVistrolConnect = 1;
            ON[ipVistrolcts]
                }
        OFFLINE: 
            { 
            nVistrolConnect = 0;
            }
        STRING: 
            { 
            cVistrolData = DATA.TEXT;
            SEND_STRING 0,"'Vistrol Says >>>',cVistrolData"
            }
        ONERROR: 
            { 
            nVistrolConnect = 0;
                nVistrolError = DATA.NUMBER;
                SEND_STRING 0, "'VISTROL IP Error = ',ITOA(nVistrolError)";
            }
      }
    TIMELINE_EVENT[tl_Deqeue]
    {
        IF(length_string(Vistrolstack) && Vistrolcts)
        {
        OFF[Vistrolcts]
        Vistrolsend = remove_string(Vistrolstack,"$0D",1)
        SEND_STRING dvVistrol,Vistrolsend
        WAIT 1 ON[Vistrolcts]
        
        SEND_STRING 0,"'CURRENTLY SENDING TO VISTROL >>> ',Vistrolsend"
        }
        
        IF(length_string(ipVistrolstack) && ipVistrolcts)
        {
        OFF[ipVistrolcts]
        ipVistrolsend = remove_string(ipVistrolstack,"$0D",1)
        SEND_STRING dvVistrol_IP,ipVistrolsend
        WAIT 3 ON[ipVistrolcts]
        
        SEND_STRING 0,"'CURRENTLY SENDING TO VISTROL IP >>> ',ipVistrolsend"
        }
    }
    
    
    
    
    What do you mean by what port the NI-700 tries to upload on? How do i check on that?
  • I am sorry for my bad english :) I was talking about the TCP Port number, and you answered it :)

    Try changing the D:P:S for the dvVistrol_IP from 0:3:0 to 0:6:0 as some ports are already in use as a standard. This information seems to be hard to find, but I found something in a manual:
    "A range of numbers is reserved for local port numbers to make sure that this IP device-naming
    convention does not interfere with future naming schemes. The program can only assign local port
    numbers at or above the value of the keyword, FIRST_LOCAL_PORT. All port numbers below
    FIRST_LOCAL_PORT are reserved for future use."
    http://www.amx.com/assets/manuals/NetLinx.LanguageReferenceGuide.pdf

    Newer firmware (If you have a 64-BIT controller, verify before attempting upgrade)
    http://www.amx.com/techcenter/downloadConfirm.asp?fn=/assets/firmwareFiles/SW2105-90_Master_v4_1_419.zip

    Other stuff I've found unrelated to your problem directly, but might cause other errors:
    I do not know if you did a full copy+paste or have cut out parts of the code, as I see the defined IP and PORT is under DEFINE_COMBINE, they should be under DEFINE_CONSTANT.
    Also, the SEND_COMMAND of the dvVistro (D:P:S 5001:2:0) should not be under the online event of the connection, but an online event on the RS-232 port itself, like this:
    DATA_EVENT[dvVistrol]
      {
        ONLINE:
        {
          SEND_COMMAND dvVistrol,"'SET BAUD 115200,N,8,1 485 DISABLE'"
        }
      }
    
    Allthough it is highly unlikely the TCP connection comes online before the RS-232 comes online.
Sign In or Register to comment.