background image

17 / 69

UDP Client Software Configuration

UDP Client Testing Screenshot

Summary of Contents for USR-N520

Page 1: ...1 69 User Manual File Version V1 0 4 ...

Page 2: ...8 3 1 5 TCP and UDP Comparison 19 3 1 6 HTTPD Client 19 3 2 Socket B Communication 21 3 3 USR VCOM Application 23 3 4 Modbus Gateway 24 3 4 1 Transmit modbus protocol in transparent mode 24 3 4 2 Modbus RTU to Modbus TCP 24 3 4 3 Modbus Active Query Function 26 3 4 4 Modbus Polling Function 29 3 5 Value added Functions 32 3 5 1 DHCP 32 3 5 2 DNS 32 3 5 3 Self Defined Heartbeat Function 32 3 5 4 Se...

Page 3: ... 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 AT Command 50 4 2 2 Enter AT Command Mode 52 4 2 3 AT Command details 52 5 Parameter Configuration 56 5 1 Software Configuration 56 5 2 Webpage Configuration 63 5 3 Serial Configuration 68 6 Contact 69 ...

Page 4: ...B to serial cable Connect network interface between USR N520 and PC via RJ45 cable Then supply power for USR N520 with our AC adapter The below picture will show you the connection Hardware Connection Notes AC adapter and connection cable are provided by USR IOT RS232 is involved no connection for RS485 PCs in above picture is the same one 1 2 Network Test Environment Please check PC setting after...

Page 5: ...way 192 168 0 1 Default work dode of port 1 TCP Server Default local port of port 1 23 Default work mode of port 2 TCP Server Default local port of port 2 26 Baud Rate 115200 Parity bit Data bit Stop bit None 8 1 1 4 Data Transmission Test Data transmission test is based on the default parameters please refer to the following steps 1 Open test software USR TCP232 Test exe and do hardware connectio...

Page 6: ...rial Settings Baud Rate 115200 Parity Data bit Stop bit None 8 1 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 The below picture is for your reference Default Parameter Test ...

Page 7: ...istinguish which serial port connect to device via port number 10 Support virtual serial port and provide corresponding software USR VCOM 11 Serial baud rate from 600bps to 230 4K bps Check bit of None Odd Even Mark and Space 12 Support static IP DHCP DNS and search devices within network through UDP broadcast 13 Provide serial and network setting protocol TCP IP socket example code such as VB C D...

Page 8: ...ommunication 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 DC5 36V Working Current 90mA 5V Operating Temp 40 85 C Power 1W Storage Temp 45 105 C 5 95 RH 2 4 Dimension ...

Page 9: ...tor Description Power Indicate power It is on when power is supplied Work Indicate working status It twinkles when N520 works well If it is on or off for a period N520 works improperly you should cut the power and restart TX1 It twinkles when port 1 sends data ...

Page 10: ...ort 2 sends data RX2 It twinkles when port 2 receive data 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 For RS422 port dial switch on the left are up dial switch on the light are down ...

Page 11: ...For RS232 port pin definition is as below For RS485 port pin 3 works as B Pin 7 works as A For RS422 port Pin Definition 2 RX pin of receives data 3 TX 5 GND 7 RTS 8 CTS Pin Definition 2 RX pin of receives data 3 RX 5 GND 7 TX 8 TX ...

Page 12: ...0 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 1 Different from UDP mode in this mode connection has status of disconnection and remaining ...

Page 13: ...Support Modbus TCP function 8 USR N520 work as TCP Client it connects to TCP server Destination IP and port should be cared The IP can be device with same LAN also can be different LAN or cross public network If it connects to server cross public network the server should have public IP 9 USR N520 work under TCP Client It connects to the target IP Port automatically will not accept other connectio...

Page 14: ... 168 0 95 Port number 20108 Click Listening TCP Client Test Screen shot 3 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: ...e Similar RCF2217 which can revise USR N520 serial parameter as baud rate accordingly This function should be combined with USR VCOM 4 It support 8 clients connections at max 32 clients will be improved in the following 5 Support Modbus TCP function 6 Under TCP Server mode USR N520 listens to local port actively and will not monitor connected IP and port When the 9th client is connected the oldest...

Page 16: ...roadcast within segment as 192 168 0 255 it can be sent but cannot be received currently 4 Under UDP Client UDP Server mode host PC allow data length 1460 bytes at max to USR N520 5 Test Example 1 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 2 Open USR TCP232 TEST Software set USR N520 as UDP Client destination port 20108 3 Click Se...

Page 17: ...17 69 UDP Client Software Configuration UDP Client Testing Screenshot ...

Page 18: ...the data to the IP and port which communicate latest 2 Test Example 1 Open USR TCP232 M4_ E45 Setup Software Set USR N520 as UDP Server local port 23 2 Open USR TCP232 TEST Software twice Set work mode as UDP remote IP and port same with USR N520 Click Send then the COM receive data Click Send at serial side only the software communicate latest can receive the data UDP Server Test Screenshot ...

Page 19: ... high frequency Inaccurate interval resulted from check and resend mechanism More less under bad network environment 3 1 6 HTTPD Client It is used to transmit data from USR N520 to HTTP server or gain data from HTTP server 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...

Page 20: ...age Configuration Screen shot Note HTTPD Client only support GET to request HTTPD Server POST will be available in the following GET is fixed packet header 1 php data is the visited submitted the page stands for data sent by serial Serial port does not need to send HTTP 1 1 is requested protocol Host is means requested IP address domain Enter twice ...

Page 21: ...setting the parameter of socket B But socket B is only used for transparent transmission and only worked as TCP client or UDP client Set USR N520 as double socket communication mode the data of serial port will be transparently transmitted to socket 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 firstl...

Page 22: ...22 69 2 Set up socket A and socket B by USR TCP232 Test exe and open serial port which connects to server 3 Click Send on the software data will be transmitted from socket A and socket B to serial port ...

Page 23: ...How to connect USR N520 with Virtual COM 1 Set USR N520 as TCP server 2 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 3 Click OK to check whether connection is built Connected sow ready for data transmission More details please refer to http www usriot com s vcom U...

Page 24: ...0 supports the transmission of modbus protocol in transparent mode 3 4 2 Modbus RTU to Modbus TCP USR N520 support Modbus RTU to Modbus TCP setting method as below 1 Open USR TCP232 M4 E45 Setup Software set USR N520 as TCP server or TCP client 2 Select ModbusTCP on the red color 3 Click to save the parameter ...

Page 25: ...25 69 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 ...

Page 26: ...ve and modbus data will also be updated 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 ...

Page 27: ...27 69 2 Set modbus slave software refer to the following ...

Page 28: ...28 69 3 Return result for query command is as drawing ...

Page 29: ...Set USR N520 as Modbus Poll support multiple host polling to check parameter 1 Multiple host polling is realized through virtual com 1 Set parameter of USR N520 via web page make sure to select ModbusTCP Poll and set overtime 2 Open virtual com softarae to setup servel ports and connects to USR N520 ...

Page 30: ...th USR N520 Run modbus Poll software and make port forwarding with this serial port 4 The value of modbus poll will also be changed when you revise the value of modbus slave 2 Conduct Modbus Polling through Modbus TCP to Modbus RTU 1 Set USR N520 via software select Modbus TCP ...

Page 31: ...de and connect with USR N520 3 The value of modbus poll will also be changed when you revise the value of modbus slave 3 Modbus Polling supports 8 host query for the most more in the near future Need set polling time properly when using modbus polling function If polling interval is too shot and baud rate is too low for the process of ...

Page 32: ...ment Note Don t set DHCP when USR N520 connected to PC directly because generally PC don t have the ability of assigning IP Otherwise USR N520 cannot transmit data normally but wait for IP 3 5 2 DNS USR N520 access the domain name or dynamic domain name when work under Client mode The length of domain name must be less than 30 bytes USR N520 will analysis the domain name constantly if cannot conne...

Page 33: ...33 69 Drawing 26 Self Defined Heartbeat Function ...

Page 34: ...s 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 1 Configure the relevant parameters via web page ...

Page 35: ...35 69 2 Testing result ...

Page 36: ...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 Click send ASCII data COM can receive data Click Send in TEST Software webpage can receive data Web to Serial Webpage ...

Page 37: ...37 69 Web to Serial COM Send Receive Data ...

Page 38: ...stomized 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 socket binaryType arraybuffer catch e alert error return socket onopen sOpen socket onerror sError socket onmessage sMessage socket onclose sClose 2 Receive Data Function function sMessage msg 3 Send data function function ...

Page 39: ...radeHtml exe set USR_N520 IP Select product M4 and upload revised webpage file Then upgrade Customized Webpage Upgrade 3 5 7 Network Printing Function Network printing function is similar to printer server it can be realized by the previous serial printer through the existed printing driver Testing Method 1 Configure the parameter set work mode as TCP Server local port number 9100 and have to choo...

Page 40: ...40 69 2 Set Printer Driver ...

Page 41: ...t 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: ...is smaller than 0 1ms packaging time can be calculated as 0 1ms T 1 baud rate 10 4 3 5 9 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 Example ...

Page 43: ...s of header and ignore the high bit 115200 N 8 1 55 AA 55 01 C2 00 03 46 9600 N 8 1 55 AA 55 00 25 80 03 28 Serial parameter bit Bit Explanation Value Description 1 0 Data bit selection 00 5 bits 01 6 bits 10 7 bits 11 8bits 2 Stop Bit 00 1 bit 01 2bits 3 Parity Enable 00 Disable Parity 01 Enable Parity 5 4 Parity Type 00 ODD 01 EVEN 10 Mark 11 Clear 8 6 NC 000 0 Using methods 1 USR TCP232 M4 E45 ...

Page 44: ...tware s MAC address USR N520 MAC is Globally Unique Also it support customized MAC 3 5 15 Firmware Upgrade Firmware upgrade is fulfilled via network For details please refer to Chapter 5 1 configure parameter with configuration software 3 5 16 Hardware Flow Control RTS CTS XON XoFF RTS CTS USR N520 supports serial RTS CTS Hardware flow control function It is disabled by default Don t enable it if ...

Page 45: ... send searching command 2 USR N520 returns IP address and MAC 3 The network read USR N520 s parameter 4 Organize setting command according to MAC known user name password and parameter to be configured 5 Send setting command 6 USR N520 returns correct setting 7 Host PC send save setting command 8 USR N520 returns correct 9 Restart command 10 USE N520 returns correct setting 4 1 2 Setting Command C...

Page 46: ...te including length to adding before checking not including checking result is check value only low byte is remained 1 Command examples 1 Search command example Search command is set to FF 01 01 02 Sum check 02 01 01 2 Reset command example FF 13 02 d8 b0 4c 00 04 c9 61 64 6d 69 6e 00 61 64 6d 69 6e 00 c8 Sum check C8 13 02 6E 00 User name and password both are 5 bytes 00 bits 0 for the lack 3 Rea...

Page 47: ...F FF Subnet Mask ucModName 16 55 53 52 2D 54 43 50 32 33 32 2D 45 00 00 00 00 USR N520 name username 6 61 64 6D 69 6E 00 username password 6 61 64 6D 69 6E 00 password ucNetSendTim e 1 Write the read values uiId 2 01 00 Device ID ucIdType 1 0 Device ID type 0 3 0 no use 1 send id when connect 2 send id when send data 3 both ucUserMAC 6 FF FF FF FF FF FF MAC ucReserved 8 Unused Example FF 56 05 AC ...

Page 48: ...00 00 00 00 00 00 00 00 IP address send in ASCII Example 192 168 0 1 ulTelnetIPAddr 4 00 00 00 00 Not adopted ucFlags 1 02 Enable MODBUSTCP 0x010 bit2 Enable 2217 0x08 bit3 Enable USR cloud 0x010 bit4 ucWorkMode 1 03 Working mode 0 UDP 1 TCP Client 2 UDP Server 3 TCP Server 4 HTTPD Client uiPackLen 4 C8 00 00 00 COM pack length ucPackTime 1 0A COM pack time ucTimeCount 1 91 Write the read values T...

Page 49: ...cation_title 55 53 52 2D 54 43 50 32 33 32 2D 35 30 30 00 00 Device name 35 checksum F0 checksum Example Return results of search command 36 bytes FF 24 01 00 4B C0 A8 00 4D D8 B0 4C 00 04 C9 DD 07 01 00 55 53 52 2D 54 43 50 32 33 32 2D 34 30 31 00 00 EF The method of the check is as follow 0xEF 00 FF 24 01 00 4B 31 00 00 2 Return results of reset command Response 4 bytes FF 01 02 4B if user name ...

Page 50: ... E 4 2 Serial Setting Protocol 4 2 1 AT Command AT Command List Table 1 AT Command List Command Instruction blank Blank Command E Open close echo function Z Re start device VER Query version number ENTM Enter to transparent transmission mode MAC Query set MAC UART Set query serial port parameter SOCKMN Set SOCK parameter DHCPEN Open close automatic obtaining IP address WANN Open close WAN port par...

Page 51: ...K1 Set query port 1 network SOCKETA parameter SOCKB Set query port 0 network SOCKETB parameter SOCKB1 Set query port 1 network SOCKETB parameter MAC Query MAC parameter WRMAC Set MAC parameter DNS Set query domain name analyzing address WANN Set query module IP address gateway subnet mask parameter ...

Page 52: ...ter 1 on Open echo function and input AT command Echo on 2 off Close echo function Echo off 2 AT ENTM Function Enter transparent transmission mode Exit command mode Format Set AT ENTM CR CR LF OK CR LF Parameter N M Change work mode from command mode to transparent transmission mode after run this command correctly 3 AT Z Function Re start USR N520 Format Set AT Z CR CR LF OK CR LF Parameter N M N...

Page 53: ...r s ID number 5 AT MAC Function Query MAC Format Query AT MAC CR CR LF OK mac CR LF Parameter mac MAC Address of USR N520 Example 01020304050A 6 AT WRMAC Function Set MAC Format Set AT WRMAC mac CR CR LF OK CR LF Parameter mac MAC Address of USR N520 Example 01020304050A 7 AT WEBU Function Set query user s name and password of web page Format Query AT WEBU CR CR LF OK username password CR LF Set A...

Page 54: ...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 CR LF OK CR LF Parameter N M 10 AT UART Function Set query the parameter of UART0 Format Query AT UART CR CR LF OK baudrate data_bits stop_bit parity flowctrl uartnum CR LF Set...

Page 55: ...number A H N corresponding serial port number 1 8 Omit MN numbers for single serial port and single socket Function Set query network protocol parameter format Query AT SOCKMN CR CR LF OK protocol IP port CR LF Set AT SOCKMN protocol IP port CR CR LF OK CR LF Parameter Protocol protocol type TCPS TCP server TCPC TCP client UDPS UDP server UDPC UDP client TCPA TCP auto WEBUART websocket tranmission...

Page 56: ...address IP address mask subnet mask gateway gateway address 5 Parameter Configuration It is setup software configuration webpage configuration and serial configuration How to configure Revise user name password set IP access method serial parameter USR N520 work mode work mode related parameter 5 1 Software Configuration To make sure setup software normal running please check the below firstly 1 U...

Page 57: ...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 If not it pops up retype window click Confirm User name and password is admin by default ...

Page 58: ...58 69 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 ...

Page 59: ...59 69 Software Configuration Full Show ...

Page 60: ...ing ID type 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 USR N520 static IP same segment with router Subnet Mask 255 255 255 0 by default Gateway it is router IP generally can transmit cross network segment and DNS if...

Page 61: ...are 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 Client for connection with Random port TCP Server Type No Modbus TCP set this when Modbus TCP to Modbus RTU is needed Serial pack...

Page 62: ...62 69 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 ...

Page 63: ...63 69 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 ...

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: ...configuration after revise Then restart Local IP Configuration IP address gaining methods Local IP Subnet Mask Gateway Webpage Configuration Local IP Configuration 3 PORT1 1 Basic Parameter as below Baud Rate Data Bit Parity Bit Stop Bit Flow hardware and RS485 Local Port Remote Port Work Mode Remote server address Serial pack time Serial pack length ...

Page 66: ...dress 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 Registry type User defined registration packet 3 Socket B Parameters Configuration ...

Page 67: ... to Serial 5 Misc Config Advanced configuration Module Name USR N520 User can modify it Websocket Port Webserver Port User Name Password For webpage user can modify it 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 ...

Page 68: ... 69 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 ...

Page 69: ...69 69 ...

Reviews: