16
User Module AT Modem Emulator APPLICATION NOTE

User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

User Module

AT Modem EmulatorAPPLICATION NOTE

Page 2: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

USED SYMBOLS

Used symbolsDanger – important notice, which may have an influence on the user’s safety or the functionof the device.

Attention – notice on possible problems, which can arise in specific cases.

Information, notice – information, which contains useful advice or special interest.

Conel s.r.o., Sokolska 71, 562 04 Usti nad Orlici, Czech Republic

Manual issued in CZ, May 3, 2016

i

Page 3: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

CONTENTS

Contents

1 User Module Description 1

2 Status 2

2.1 AT Modem Emulator Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.2 System Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Configuration 4

3.1 Configuration Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

4 AT Modem Emulator Protocol 7

4.1 AT Commands Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 Initial Status and Connection Establishment . . . . . . . . . . . . . . . . . . . . 104.3 Communication and Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.4 Connection Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Recommended Literature 12

ii

Page 4: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

LIST OF FIGURES

List of Figures1 AT Modem Emulator in the router enabling the communication . . . . . . . . . 12 User module menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 AT Modem Emulator Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 AT commands for switching AT modes . . . . . . . . . . . . . . . . . . . . . . . 35 System Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 AT Modem Emulator Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 47 Typical connection establishment . . . . . . . . . . . . . . . . . . . . . . . . . . 10

List of Tables1 AT Modem Emulator Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 52 AT Commands Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

iii

Page 5: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

1. USER MODULE DESCRIPTION

1. User Module Description

User module AT Modem Emulator is not a part of the router’s firmware. Uploading of theuser module is described in the Configuration Manual (see [1, 2]). This user module is v2 andv3 router platform compatible. This user module will only work properly if the serial expansionport RS-232 is installed in the router.

The AT Modem Emulator user module to emulate telephone modem behavior. The modemcan receive a dial-up request via the serial port and convert it to a TCP/IP connection. A deviceconnected to the Conel router serial interface sees the router as a HAYES-compatible modem.The device can use the standard AT commands to establish the connection, configure theparameters and terminate the connection. A connection with another AT Modem Emulator (inthe router) or with any TCP server listening on the proper port can be established. For the ATModem Emulator supported commands and protocol specifications, see Chapter 4.

Figure 1: AT Modem Emulator in the router enabling the communication

This user module enables the router to connect the parts of the distributed system withoutadjustments in its software. This is typically for older equipment that is out in the field andstill functioning well, but is only equipped with an RS-232 connection, (e.g. water-treatmentstations), secured transmission of data between a shop and its remote stock, database updateat a remote workplace, etc.

To access the user module Web interface, click the User Modules and then AT ModemEmulator in the router Web interface. You will see the menu as on the Fig. 2.

Figure 2: User module menu

• The Status section shows the status and the system log(see Chapter 2).

• In the Configuration section (chapter 3) you can config-ure the serial and TCP communication parameters, setthe S-registers, choose the action on DTR signal andwrite a Configuration Script – this is a feature for sub-stitution rules – e.g. to substitute a telephone numberwith an IP address (some old devices can not dial an IPaddress) or to define your own responses to some com-mands – see Chapter 3.1

• In the Customization section you may select the Returnitem to return to the router’s Web interface.

1

Page 6: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

2. STATUS

2. Status

2.1 AT Modem Emulator Status

Figure 3: AT Modem Emulator Status

The Status page will display this information:

• Firmware Versions

– Router FW version. A connected device can view this via AT command ATI2.

– User module version. A connected device can view this via AT command ATI3.

• Status Variables and S-registers

– Status variables E (ECHO), Q (responses), V (responses format), &D (action onDTR signal - can be set in Configuration). These can be set from the connecteddevice via AT commands – see the table in Chapter 4 for details.

– S-registers S0 to S25 defining the behavior of the AT Modem Emulator (auto re-sponse, characters and time intervals) – some of them can be set in Configuration,all of them can be set via AT commands – see the table in Chapter 4.

• Connection Status

– On-line:No – Operating mode (disconnected), or Command mode for AT commands only(off-line for data communication).Yes – On-line mode for serial data communication.See figure 4 for explanation of modes and how to switch them.

– Connected: No for Operating mode (disconnected), IP address for On-line modeand Command mode (connected). See Figure 4.

2

Page 7: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

2. STATUS

To understand the AT Modem Emulator modes, see the figure below. Operating Mode isthe initial AT Modem Emulator status after enabling it in the Configuration section. There areAT commands to switch the modes and Status page messages in the figure. For details on ATcommands, see Ch. 4.

Figure 4: AT commands for switching AT modes

2.2 System Log

Figure 5: System Log

The System Log page displays log messages. It is the same system log as the one inthe main menu of the router. User module messages are indicated by atmodemd string. Youcan check out the operation of the user module in the log or view the messages if thereare problems with configuration. You can download the messages and save them to yourcomputer as a text file (.log) by clicking the Save Log button. You can also download a detailedreport (.txt) for communication with support by clicking the Save Report button.

3

Page 8: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

3. CONFIGURATION

3. ConfigurationClick the AT Modem item in the Configuration section to enable and configure the AT Mo-

dem Emulator. This is the landing page from the router Web interface. Check the Enable ATModem box at the top and click the Apply button at the bottom. All changes in the configu-ration will take effect after clicking the Apply button. Configuration items are explained in thetable below.

Figure 6: AT Modem Emulator Configuration

Item DescriptionExpansion Port Choose the serial expansion port PORT1 or PORT2 (RS-232) the

AT Modem Emulator will communicate on.Baudrate Serial parameter – communication speed. 300 to 115200.Data Bits Serial parameter – number of data bits. 7 or 8.Parity Serial parameter – control parity bit. None, even or odd.Stop Bits Serial parameter – number of stop bits. 1 or 2.

To be continued on the next page

4

Page 9: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

3. CONFIGURATION

Continued from the previous page

Item DescriptionTCP Port Port the TCP side will communicate on. TCP server has to listen

on this port or the remote modem emulator has to communicateon this port.

Check TCPconnection

Disabled or TCP Keepalive. If TCP Keepalive set, the check ofthe link will be performed to prevent it from being broken and thefollowing Keepalive parameters will take effect.

Keepalive Time Interval between the connection tests.Keepalive Interval Time to wait for the answer when the other side is not responding.Keepalive Probes Number of attempts to test the connection before it is declared to

be unavailable.Drop DTR Action Choose the action AT Modem Emulator will perform when the

DTR signal from the connected device (DTE) is lost. None, Off-line (command mode) or Disconnect (hangup). This can be setvia AT command &Dn (AT&Dn), too – see the table in Chap. 4.

S0 (Auto-answer) Automatic ATA answer on the RING message. Manual, Auto 1(after one RING – default) to Auto 5 (after 5 RINGs). See the com-mand table in Chap. 4 for details.

S6 (RING Interval) Time in sec. between RING messages. The default is 5. Range:2 to 255 sec. See the command table in Chap. 4 for details.

S7(CONNECT timeout)

Time in sec. to wait for the CONNECT response. Default is 10.Range: 1 to 255 s. See the command table in Chap. 4 for details.

S10 (Hang-up delay) Hangup after this interval in 10 times sec. if there is no communi-cation. Default is 60. 0 means the connection is not automaticallycanceled. 1 to 255. See the command table in Ch. 4 for details.

S11 (Split Timeout) Maximum interval between the characters sent as one message.The default is 10 msec. Range. 0 to 255 ms. See the commandtable in Ch. 4 for details.

S12 (Esc Delays) Interval in 1/50 sec. (times 20 msec) before and after ESC se-quence switching the AT Modem Emulator to Command off-linemode. 0 to 255. Default is 8. See the commands in Ch. 4.

S25 (DTR Ignore) Interval in tens of msec. to ignore DTR signal changes. Drop DTRAction will take effect after this interval if DTR really dropped. 0 to255, default is 5. See the command table in Chap. 4 for details.

Configuration Script Substitution rules definitions. See Ch. 3.1 below for more details.Syslog Level Amount of information logged in the System Log. Warning, Noti-

fication, Informational, Debugging, Verbose debugging.Table 1: AT Modem Emulator Configuration

5

Page 10: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

3. CONFIGURATION

3.1 Configuration Script

The purpose of Configuration Script is to change the default response to AT commandsreceived from your application (DTE) connected to the AT Modem Emulator. This is to adaptthe modem emulator to these applications because they can’t be usually modified. E.g. somedevices can not dial IP addresses, but you can define the substitution rule here and assign thephone number to the the IP address.

Every line of the Configuration Script is one substitution rule or definition.There are two types of substitution rules:

"I" type substitution rule:

General format: Ii:texti index - unsigned integer number. 0 to 9 range.text all characters from behind ":" until the end of lineExample of substitution rule: I4: I am modem emulatorTerminal input (from user or application): ATI4 (+ Enter)Terminal output (from emulator): I am modem emulator

OK

"D" type substitution rule:

General format: Dpn:IPpn phone number in any format, letters are not allowedIP IP address as a series of 12 digitsExample of substitution rule: D+420 123 256:010000002145Terminal input (from user or application): ATD+420123256 (+ Enter)Result AT Modem Emulator connecting to IP 10.0.2.145

General notes on substitution rules:

• Substitution rules have priority over standard behavior if in conflict.Example 1: AT Modem Emulator is programmed to print the user module version as aresponse to ATI3 command. But if there is a substitution rule telling I3: a b c thenentering ATI3 command will return the "a b c" string.Example 2: The standard response to the ATD010000002145 command is trying to con-nect to the 10.0.2.145 IP address. But if there is a substitution ruleD010000002145:010000002146 the result is trying to connect to the 10.0.2.146 IP ad-dress instead.

• There can be any number of white characters (spaces) in the rules. There can be anynumber of spaces on the AT command input, too.

• Maximum number of substitution rules is 100.

6

Page 11: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

4. AT MODEM EMULATOR PROTOCOL

4. AT Modem Emulator Protocol

There is a list of supported AT commands in the table below, followed by an explanation ofestablishment and termination and general notes on AT Modem Emulator protocol usage.

4.1 AT Commands Overview

Note: Some commands are not used by AT Modem Emulator, because there is no practicaluse for them. Although the response may be OK, they will be ignored. This is for compatibilitypurposes and to allow for the use of standard programs for data (telephone) modems. Thereare no range limitations for setting the values variables and S-registers via AT commands.

Command Description ExampleAT Attention – indicates all commands except for “+++”, “A/”;

basic part of a command.A Answer incoming call. This is a response to a “RING” call mes-

sage from the other station.ATA

A/ Repeat the last command, no <CR> (Enter) needed. A/D Dial a phone number or an IP address (12 numbers). The ad-

dress of the opposite station follows after the command.ATD10

E0 Commands are not echoed (ECHO OFF). The modem doesnot return characters received from the computer.

ATE0

E1 Commands are echoed (ECHO ON) – default. The modemreturns characters received from the computer (you can seewhat you type).

ATE1

H Hangup - termination of the connection. See Figure 4. ATHI2 Returns the firmware version of the router. ATI2I3 Returns the version of the AT Modem Emulator user module. ATI3O Return to the On-line mode when in Command mode (Off-line).

See Figure 4. The connection is still established.ATO

Q0 Quiet mode OFF – responses to commands are displayed (re-turned). E.g. OK or ERROR. This is default.

ATQ0

Q1 Quiet mode ON – responses to commands not displayed (re-turned) – result codes suppressed.

ATQ1

V0 Verbose OFF – return codes are in the numeric form only. ATV0V1 Verbose ON – return codes are in the text English form (e.g.

CONNECT, BUSY). This is default.ATV1

To be continued on the next page

7

Page 12: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

4. AT MODEM EMULATOR PROTOCOL

Continued from the previous page

Command Description ExampleSr=n Set the value to the S-register:

r – is the number of S-register being set,n – is the value being set to the S-register.

ATS0=1

Sr? Return (show) the value of the r-th S-register ATS10?Z Usually performs the reset of the modem before the connec-

tion establishment. This does not reset the router AT ModemEmulator is running on, but does the reset of the AT ModemEmulator user module only (sets the default parameters as amodem would do the same if reset). The response is OK.

ATZ

+++ ESCAPE sequence. Switch from On-line (data) mode to Com-mand mode (off-line) without dropping the line. See Figure 4.Before and after the sequence there has to be a time delaydefined in the S12 register. The escape sequence charactercan be changed in S2 register. Switch back to the On-line datamode using the ATO command.

+++

&Dn Set the action the AT Modem Emulator will perform on the DTRsignal drop. n options:0 – AT Modem Emulator ignores the DTR signal.1 – Go to the Command mode (connection still established).This is the same as the escape sequence.2 – Hangup (disconnect).3 – Reset the AT Modem Emulator (same as ATZ). The resultwill be hangup, too.

AT&D1

&V Display the current values of status variables and S-registers.Same as on the Status page in the Web interface.

AT&V

&W Save the current setting of status variables and S-registers tothe router’s configuration file. The saved configuration is usedwhen reset is performed (ATZ) or starting the AT Modem Emu-lator (router).

AT&W

S0 This S-register defines the nature of the response to a call.The content specifies the number of “RINGs“ the AT ModemEmulator will automatically establish the connection after.0 – manual response using ATA command is necessary1 – automatic connection (Auto Response) after 1st ringing2 – automatic connection (Auto Response) after 2nd ringingetc.

ATS0=1

To be continued on the next page

8

Page 13: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

4. AT MODEM EMULATOR PROTOCOL

Continued from the previous page

Command Description ExampleS1 Ring counter – this S-register is incremented every time the

"RING" signal is heard on the telephone line. Reasonable rangeis 0 to 255.

ATS1

S2 Escape character — a special character used to move from theOn-line mode to the Command mode (Off-line). See Figure 4.The default value is “+” (43).

ATS2=43

S3 Defines the CARRIAGE RETURN character (return to the linestart). The default value is CR (13) (Enter key).

ATS3=13

S4 Setting the LINE FEED character (new line). The default valueis LF (10).

ATS4=10

S5 Setting the BACKSPACE character (a character for deleting thecharacters). The default value is 8 (the Backspace key).

ATS5=8

S6 Setting the time (in seconds) between the repetitions of theRING signal when the other side is calling. The default is 5seconds.

ATS6=5

S7 Setting the time the AT Modem Emulator waits for the CONNECTresponse. After the interval the modem sends the NO RESPONSEmessage to the connected device (computer). The default is 10sec.

ATS7=10

S10 Time in tens of seconds the connection is cancelled after therehas been no data communication. 0 means the connection isnot automatically cancelled. The default is 60 x 10 sec.

ATS10=60

S11 Maximum time between two subsequent characters in a blockof data in milliseconds. The message is closed and transmittedafter this interval. Reasonable range is 0 to 255 ms. Default is10 msec.

ATS11=10

S12 Time delay in 1/50 seconds (20 miliseconds) before and afterthe Escape sequence of three characters switching the modemto the Command (Off-line) mode. Default is 8 x 20 msec.

ATS12=50

S25 Interval in tens of msec. to ignore DTR signal changes beforetaking the action. Drop DTR Action (AT&D commands) will takeeffect after this interval if DTR really dropped. The default is 5x 10 msec.

ATS25=5

Table 2: AT Commands Overview

9

Page 14: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

4. AT MODEM EMULATOR PROTOCOL

4.2 Initial Status and Connection Establishment

After enabling the AT Modem Emulator user module (or booting the router with AT Mo-dem Emulator enabled), the AT Modem Emulator is in the Operating Mode, see Figure 4. Itreceives the commands from the connected device or computer (DTE). The CD signal is re-served and you may configure the parameters via AT Commands or the user module’s Webinterface.

The typical connection establishment may look like this:

AT

OK

Checkingthewconnectionandwsync

ATZ

ResetwthewmodemOK

ConfigurationwofparameterswviaATwcommands

DevicewAATwModemEmulatorwA

ATwModemEmulatorwB DevicewB

DialwthewIPwaddressATD010000002126

TCPcommunication

RING

ATA

CONNECT CONNECT

Answeringwthewcall

Connectedforwdatawcommunication

Connectedforwdatawcommunication

DTE DTEDCEDCE

Figure 7: Typical connection establishment

Now the AT Modem Emulator is in the On-line mode. The CD signal is set to the activestatus and the data communication is running. If the opposite modem is not ready for commu-nication, the RING message is repeated according to the settings in the S1 register. After theinterval set in S7 register, it returns the NO CARRIER message to the computer. If the oppositemodem has already established a connection with another modem, the BUSY response is re-turned. Note that ATZ leads to default settings only, not the reboot of the router (just softwarereset of the AT Modem Emulator user module).

10

Page 15: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

4. AT MODEM EMULATOR PROTOCOL

4.3 Communication and Modes

See the Figure 4 in Chapter 2 to understand the modes the AT Modem Emulator canoperate in and how to switch the modes (AT commands in the image or in the table above).When connected (On-line mode) it has to be switched to the Command mode to perform ATcommands while still connected. See +++ command in the table above for the details. Theconnected application or computer (DTE) can now set the parameters, S-variables, etc. usingAT commands in the table above. You can return to the On-line mode with the ATO commandor hangup with the ATH command.

4.4 Connection Termination

There are several ways to terminate the connection:

• The standard method to terminate the connection is to switch the AT modem Emulatorto the Command mode using the Escape sequence "+++" and then applying the ATH (orATH0) command to hangup. Note that there needs to be a time delay inserted beforeand after the escape sequence defined in the S12 register. Then a message about thetermination of the connection is sent to the opposite modem and the opposite modemsends the “NO CARRIER” message to the opposite connected computer.

• Another option is to set the action on the DTR signal drop. See &D command in thetable above (AT&D2). When the DTR signal is lost in the On-line mode, the AT ModemEmulator waits the S25 time and then disconnects (hangup).

• When there is no data communication for S10 interval, the AT Modem Emulator discon-nects automatically (hangup).

11

Page 16: User Module AT Modem Emulator - Advantech B+B SmartWorxadvantech-bb.com/wp-content/uploads/2015/12/AT_Modem... · 2018-01-15 · Figure 3: AT Modem Emulator Status The Status page

5. RECOMMENDED LITERATURE

5. Recommended Literature

[1] Conel: Configuration Manual for v2 Routers

[2] Conel: Configuration Manual for v3 Routers

12