USRIOT USR-N520 User Manual

USRIOT USR-N520 User Manual

2 ports serial device server

Advertisement

Quick Links

User Manual
File Version: V1.0.4
1 / 69

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the USR-N520 and is the answer not in the manual?

Questions and answers

Summary of Contents for USRIOT USR-N520

  • Page 1 User Manual File Version: V1.0.4 1 / 69...
  • Page 2: Table Of Contents

    Contents 1. Quick Start..................................4 1.1. Hardware Testing Environment........................4 1.2. Network Test Environment..........................4 1.3. Default Parameter ............................5 1.4. Data Transmission Test............................. 5 2. Overview..................................7 2.1. Brief Introduction..............................7 2.2. Features................................7 2.3. Basic Parameter..............................8 2.4. Dimension................................8 2.5. Indicators and Dial switch..........................9 2.6.
  • Page 3 3.5.13. Webpage Port............................44 3.5.14. Revise MAC............................44 3.5.15. Firmware Upgrade..........................44 3.5.16. Hardware Flow Control RTS/CTS & XON/XoFF................44 3.5.17. Reload..............................44 4. Setting Protocol................................45 4.1. Network Setting Protocol..........................45 4.1.1. Set Parameter Process........................45 4.1.2. Setting Command Content........................45 4.1.3. Commands’ Return Content........................49 4.2. Serial Setting Protocol............................. 50 4.2.1.
  • Page 4: Quick Start

    Disable PC Firewall and anti-virus software. Disable the network card nothing to do with testing and just leave one local connection. As for USR-N520 connect with PC directly, should set static IP for PC, which in the same network 4 / 69...
  • Page 5: Default Parameter

    USR-N520, like 192.168.0.201. PC Local Connection Configuration 1.3. Default Parameter Default parameter is as below: User name admin Password admin IP address 192.168.0.7 Subnet mask 255.255.255.0 Default gateway 192.168.0.1 Default work dode of port 1 TCP Server Default local port of port 1...
  • Page 6 Click “Open” to enable the COM. Then we can test data transmission between COM and network. Data from serial to network is: PC’ COM->USR-N520’ COM->USR-N520 Ethernet port->PC Network; Data from network to serial is: PC Network->N520’ Ethernet port->N520 COM-> PC’s COM.
  • Page 7: Overview

    2. Overview 2.1. Brief Introduction USR-N520 is used to transmit data transparently between TCP/UDP data packet and RS232/RS485/RS422 interface. It carries ARM processor, low power, fast speed, high stability and two serial port can work as RS232 or RS485 or RS422 serial interface which comfort to industrial standard.
  • Page 8: Basic Parameter

    and serial side 23. Power supply in two mode, DC adapter or 5.08-2 terminal pin 24. Communication indicator light of two serial port: RX/TX 25. UPD broadcast function, can receive/send data to all IP in the same network 2.3. Basic Parameter Parameter Value Input Voltage...
  • Page 9: Indicators And Dial Switch

    2.5. Indicators and Dial switch <Indicator light> Indicator Description Indicate power. It is on when power is supplied ①Power Indicate working status. It twinkles when N520 works well. If it is on or off for a period, N520 works ②Work improperly, you should cut the power and restart.
  • Page 10 It twinkles when port 1 receive data ④RX1 It twinkles when port 2 sends data ⑤TX2 It twinkles when port 2 receive data ⑥RX2 <Dial Switch> For RS232 port, dial switch are down, such as the below picture.  For RS485 port, dial switch are up, such as the below picture. ...
  • Page 11: Db9 Pin Definition

    2.6. DB9 Pin Definition For RS232 port, pin definition is as below  Definition RX, pin of receives data For RS485 port, pin 3 works as “B(-)”, Pin 7 works as “A+”  For RS422 port  Definition RX+, pin of receives data 11 / 69...
  • Page 12: Product Function

    3. Product Function The following is function diagram of USR-N520 USR-N520 Function Diagram Each serial port corresponds to two socket: socket A and socket B. Socket B can be opened or closed. 3.1. Socket A Communication 3.1.1. TCP Client Model 4.1.1 TCP Client Mode...
  • Page 13 Once there is an interrupt, it can be detected rapidly then make USR-N520 disconnect from former connection and reconnect. It will connect to same source port when USR-N520 try to connect server and local port is not “0”. It supports USR Synchronous baud rate (Similar RCF2217), which can revise USR-N520’s serial parameter as baud rate accordingly.
  • Page 14 Open “USR-TCP232-TEST” software: Need to connect to PC’s TCP Server, its IP: 192.168.0.95, Port number: 20108, Click “Listening” TCP Client Test Screen shot USR-TCP232-TEST software: Configure serial parameter. Click to open the port. Test software network part shows connection message:192.168.0.7:49153(port# assigned randomly). Click “send”, you can gain data from each side.
  • Page 15: Tcp Server Mode

    USR-N520 does not send data. USR-N520 listens to local port set firstly, respond and build connection when there is a connection request. Serial port will send data to all client which connected with USR-N520 at the same time once serial port received data.
  • Page 16: Udp Client Mode

    Broadcast within segment as 192.168.0.255, it can be sent but cannot be received currently. Under UDP Client/ UDP Server mode, host PC allow data length 1460 bytes at max to USR-N520. Test Example: Open USR-TCP232-M4, E45 Setup Software: build a UDP firstly. PC’s IP is 192.168.0.95. Port to be listened is 20108.
  • Page 17 UDP Client Software Configuration UDP Client Testing Screenshot 17 / 69...
  • Page 18: Udp Server Mode

    3.1.4. UDP Server Mode Base on normal UDP, it doesn't verify source IP address. Every time USR-N520 receive one UDP data packet, it changes destination IP to where data comes and it sends the data to the IP and port which communicate latest.
  • Page 19: Tcp And Udp Comparison

    USR-N520 can handle complex HTTP protocol so user just do programming for serial, and not need to worry about HTTP. When USR-N520 sends data to HTTP server via serial port, it only needs to send the header of requested data; All the returned data will be transmitted by USR-N520, user need to analyze the packets.
  • Page 20 Test Example: http://192.168.0.7 1) Entry (N520’s IP) to open its web page 1. SetUSR-N520 as HTTPD Client. 2. Set HTTPD packet Header. HTTPD Client Web page Configuration Screen shot <Note>: HTTPD Client only support GET to request HTTPD Server. POST will be available in the following. ...
  • Page 21: Socket B Communication

    A and socket B at one time. When data comes from socket A and socket B simultaneously, USR-N520 will transmit the data of socket A to serial port firstly, and then transmit the data of socket B once the data of socket A finished.
  • Page 22 Set up socket A and socket B by “USR-TCP232-Test.exe”, and open serial port which connects to server. Click “Send” on the software, data will be transmitted from socket A and socket B to serial port. 22 / 69...
  • Page 23: Usr-Vcom Application

    Open USR-VCOM software, click “Add COM’ and select COM2 (Avoid existed COM). Net Protocol: TCP Client Remote IP and port is the same one with USR-N520 Remarks: Can write the name of device Click “OK’ to check whether connection is built. “Connected” sow ready for data transmission.
  • Page 24: Modbus Gateway

    3.4.2. Modbus RTU to Modbus TCP USR-N520 support Modbus RTU to Modbus TCP, setting method as below: Open USR-TCP232-M4,E45 Setup Software, set USR-N520 as TCP server or TCP client. Select “ModbusTCP” on the red color Click to save the parameter...
  • Page 25 Modbus TCP Configuration 4. Check and verify Modbus RTU to Modbus TCP through modbus Poll and Modbus Slave 5. Setting modbus software is as below: 25 / 69...
  • Page 26: Modbus Active Query Function

    3.4.3. Modbus Active Query Function Modbus active query function can be realized through the serial heartbeat packet function of USR-N520. 1. Open serial heartbeat packet function via web page, query command is heartbeat packet data, example: 26 / 69...
  • Page 27 2. Set modbus slave software, refer to the following: 27 / 69...
  • Page 28 3. Return result for query command is as drawing: 28 / 69...
  • Page 29: Modbus Polling Function

    1. Multiple host polling is realized through virtual com. Set parameter of USR-N520 via web page, make sure to select ModbusTCP Poll and set overtime Open virtual com softarae to setup servel ports and connects to USR-N520...
  • Page 30 Open modbus slave software, choose the serial port which connected with USR-N520. Run modbus Poll software and make port-forwarding with this serial port. The value of modbus poll will also be changed when you revise the value of modbus slave.
  • Page 31 Open modbus slave software, choose the serial port which connected with USR-N520. Run modbus polling softare to select network mode and connect with USR-N520. The value of modbus poll will also be changed when you revise the value of modbus slave.
  • Page 32: Value-Added Functions

    3.5. Value-added Functions 3.5.1. DHCP DHCP is obtaining IP address automatically. USR-N520 IP obtaining have 2 types: DHCP and static IP. It is static IP192.168.0.7 by default. DHCP is effective after change to DHCP and restart. When USR-N520 connects to router or device assigning IP, it require IP address from host within network, which takes about 5-15 seconds.Then you can...
  • Page 33 Drawing 26 - Self-Defined Heartbeat Function 33 / 69...
  • Page 34: Self-Defined Registration Package Function

    3.5.4. Self-Defined Registration Package Function USR-N520 supports self-defined registration package function and also supports to send self-defined registration package after connection establishment, meanwhile, it supports to send registration package when sending data. One example as blow: Configure the relevant parameters via web page...
  • Page 35 Testing result: 35 / 69...
  • Page 36: Web To Serial

    3.5.5. Web to serial Web to serial function can make interaction between webpage and serial. 1. Set port 6432 as default. 2. Open webpage and click “web to serial”. It pops up “connect success” then can send/receive data. Open USR-TCP232-TEST Software, configure serial parameter and click “Open”. 3.
  • Page 37 Web to Serial COM Send/Receive Data 37 / 69...
  • Page 38 Web to serial needs user’s webpage programming ability. Design webpage, request own device’s data and process data then reveal the results on webpage. According to chapter4.1.17 Customized Webpage, can download revised webpage into USR-N520 . 1. Build a connection and connect to USR-N520 function connectx(){ try{ socket=new WebSocket('ws://'+window.location.host+':6432');...
  • Page 39: Customized Webpage

    3.5.6. Customized Webpage User can make revision as LOGO/NAME on the basis of USR-N520’s webpage to realize the personalized applications. 1. Download Upgrade 2. http://www.usriot.com/e45-m4-seriesk3-self-defined-webpage/ 3. Revise webpage code 4. Open “UpgradeHtml.exe”, set USR_N520’ IP, Select product M4 and upload revised webpage file.
  • Page 40 Set Printer Driver 40 / 69...
  • Page 41: Serial Port Packaging Mechanism

    Serial port connects to the printer, open a word file to print 3.5.8. Serial Port Packaging Mechanism USR-N520 can configure serial port packaging time and serial port packaging length. USR-N520 will make packaging for the data of serial port according to the packaging length and packaging time in the transparent...
  • Page 42: Flow Calculation

    Flow Calculation When USR-N520 receives data from network and then send to serial port, as the limit of serial port speed, user have to control the flow, if not the problem of data overflow on serial port side will occur. So data flow is required to calculated when sending data from network to serial port.
  • Page 43 Parity Type Mark Clear Using methods: 1. USR-TCP232-M4,E45 Setup software, click “Synchronous baud rate (RFC2217)”. 2. When serial parameter changes is needed, it send RFC 2217 packet. USR-N520 receive the command from network and revise serial parameter accordingly. 43 / 69...
  • Page 44: Keepalive

    3.5.13. Webpage Port USR-N520 has built-in webpage server and the port is 80. Also the port can be revised and visit the web via revised port. 3.5.14. Revise MAC User can check software’s MAC address.
  • Page 45: Setting Protocol

    Reload 4. Setting Protocol USR-N520 includes two protocol: network setting protocol and serial port setting protocol. 4.1. Network Setting Protocol 4.1.1. Set Parameter Process Build SOCKET: Build UDP SOCKET, destination IP: 55.255.255.255, destination port: 1901. Low is in front. Setting command process:...
  • Page 46 search reset [MAC] [usrname] [password] read [MAC] [usrname] settings [password] Save [MAC] [usrname] settings [password] Basic [MAC] [usrname] Basic settings [password] parameter [MAC] [usrname] settings [password] parameter [MAC] [usrname] settings [password] parameter [MAC] [usrname] settings [password] parameter 0x10 [MAC] [usrname] Cloud [password] Notice: Check bit is sum check, starts from length byte (including length) to adding before checking (not...
  • Page 47 01 00 A8 C0 Gateway ulSubnetMask 00 FF FF FF Subnet Mask ucModName 55 53 52 2D 54 43 50 USR-N520 name 32 33 32 2D 45 00 00 00 00 username 61 64 6D 69 6E 00 username password...
  • Page 48 Port settings parameter command Port parameter: Name bytes example Explanation ulBaudRate 00 C2 01 00 Baud Rate ucDataSize COM data bits (0X05/0x06/0x07/0x08) COM parity ucParity 1: no, 2: odd, 3: even, 4: mark, 5: space ucStopBits COM stop bit (0x01/0x02) ucFlowControl COM flow control ( 0x01;...
  • Page 49: Commands' Return Content

    FF 01 02 45, if user name and password are wrong, 45 = 'E' Return results of read command Description: Return all parameter of USR-N520 network. 193 bytes in total, no parity, no protocol, return parameter directly. 49 / 69...
  • Page 50: Serial Setting Protocol

    Returned content: 193 (basic parameter+serial parameter+serial parameter) Return results of save settings command If settings are correct, it returns: FF 01 04 4B Return results of basic settings command FF 01 05 4B Others return results Sum check fault returns 'E' + right parity Correct execution: FF 01 CMD 'K' User name/password fault returns: FF 01 CMD 'P' Others faults return: FF 01 CMD 'E'...
  • Page 51 UART1 Set/query serial port 1 parameter SOCK Set/query port 0 network SOCKETA parameter SOCK1 Set/query port 1 network SOCKETA parameter SOCKB Set/query port 0 network SOCKETB parameter SOCKB1 Set/query port 1 network SOCKETB parameter Query MAC parameter WRMAC Set MAC parameter Set/query domain name analyzing address Set/query module IP address, gateway, subnet mask WANN...
  • Page 52: Enter At Command Mode

    3. AT+Z Function: Re-start USR-N520  Format:   Set AT+Z<CR> <CR><LF>+OK<CR><LF> Parameter: N/M <Notice>: USR-N520 will re-start after run this command correctly.  Date xxxx.xx.xx (For example 2014.01.02 stands for January 2 , 2014). 52 / 69...
  • Page 53 AT+VER<CR> <CR><LF>+OK=<ver><CR><LF> Parameter:   ver: Set/Query the firmware version of USR-N520 Gerenal version: AA.BB.CC: AA stands for big version, BB stands for small version  number, CC stands for hardware version C.C Custom version: AA.BB.CC.DD-ID; DD stands for customer’s version, ID stands for ...
  • Page 54  Set AT+ SEARCH <CR> <CR><LF>+OK =< port,keywords><CR><LF> Parameter:   port: serching port of USR-N520, default 48899  keywords: searching key words of USR-N520, Default: www.usr.cn (Max 20 bytes). 9. AT+CLEAR Function: Restore factory setting  Format:   Set AT+CLEAR<CR>...
  • Page 55  TCPA: TCP auto  WEBUART: websocket, tranmission from webpage to serial port   IP: Server’s IP address when USR-N520 works as “CLIENT’  Port: Protocol port, decimal number, smaller than 65535 13. AT+DHCPEN Function: Open/close DHCP Server; ...
  • Page 56: Parameter Configuration

    AT+DHCPGW=<Type><CR> <CR><LF>+OK<CR><LF> Parameter   Type: On: open DHCP server function  Off: close DHCP server function (USR-N520 works as wireless switch at this time)  14. AT+WANN Function: Set/query obtained WAN port IP (DHCP/STATIC);  Format:   Query AT+WANN<CR>...
  • Page 57 Search device and all USR-N520 device within LAN can be found. It includes IP, name, MAC and version. Software Configuration—Search 1. Click ‘Device’ on the top of the program and then check user name/password via ‘User config’. If it is correct, it reveals USR-N520 information.
  • Page 58 Software Configuration-Password 2. Basic parameter configuration Click “Full Show” and all basic parameter is revealed. Set the parameter as needs and click “Base Save” then can set successfully. 58 / 69...
  • Page 59 Software Configuration --Full Show 59 / 69...
  • Page 60 User name: Authentication Code for revising parameter to avoid other users within same LAN  revising it. Password: same as user name.  Device Name: USR-N520 ’s name an be revised.  MAC address: USR-N520 ’ MAC  IP address type: Static and DHCP ...
  • Page 61  control, XON/XOFF for software hardware flow. Work Mode: TCP Server /TCP Client/HTTPD Client/UDP Client/UDP Server  Destination IP/Port: IP connected when USR-N520 works as client (TCP Client/HTTPD Client/UDP  Client) Local Port: port USR-N520 to connect. Advice to set it to “0’’ when USR-N520 works under TCP ...
  • Page 62 4. Firmware Upgrade If USR-N520 need to upgrade with new firmware, please contact USR sales. During firmware upgrade, USR-N520 connects to PC directly. PC Upgrade via Wi-Fi is prohibited. 62 / 69...
  • Page 63: Webpage Configuration

    Firmware Upgrade 5.2. Webpage Configuration Open browser and type in USR-N520 ’ IP (192.168.0.7 by default) Then user name: admin and password: admin. 63 / 69...
  • Page 64 Webpage Log In 1. Current Status - reveals basic information: USR-N520 name  Firmware version  Current IP address  MAC address  Total running time: from be powered  Count of data sending: how many data sent from powered ...
  • Page 65 Count of data receiving: how many data received from powered  USR-N520 connection status: check whether connection is built.  2. Local IP Config Save configuration after revise. Then restart. Local IP Configuration  IP address gaining methods  Local IP ...
  • Page 66 Similar RCF2217  Socket A Parameters Configuration Work Mode  Remote Server Address  Local/Remote Port number  Timeout reconnection  Disonnect time  Print: Function for network printing  ModbusTCP Poll: Function for Modbus Polling  Enable Net Heartbeat Packet: user-defined heartbeat packet ...
  • Page 67 MAC Address (can be revised)  Buffer data before connected: whether serial and network data are cached if disconnection.  Reset timeout: how long USR-N520 reset when no data from COM or Network. Set to “0” then no  rest. 67 / 69...
  • Page 68: Serial Configuration

    6. Reboot Save all data then click restart to take effect. Webpage configuration- Restart 5.3 Serial Configuration Serial configuration use AT command, please refer to Chapter 4.2 Serial setting Protocol. 68 / 69...
  • Page 69: Contact

    69 / 69...

Table of Contents