19.08.2013 Views

AN2120: Connecting an M68HC08 Family Microcontroller to an ...

AN2120: Connecting an M68HC08 Family Microcontroller to an ...

AN2120: Connecting an M68HC08 Family Microcontroller to an ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Application Note<br />

Type Code Checksum<br />

Type<br />

Identification Sequence<br />

8 - ECHO REQUEST<br />

0 - ECHO REPLY<br />

Optional Data<br />

Code<br />

Always 0 for ECHO messages<br />

The ICMP message layout is very simple. Implementations of this<br />

pro<strong>to</strong>col should check the type <strong>an</strong>d code fields <strong>to</strong> determine the nature<br />

of the message. For inst<strong>an</strong>ce, a type field set <strong>to</strong> 8 requires <strong>an</strong> echo reply<br />

from the destination IP. The origina<strong>to</strong>r of this ICMP message c<strong>an</strong> then<br />

determine if the host is reachable or not. This is perhaps the most<br />

popular ICMP application used <strong>to</strong>day <strong>an</strong>d is called ping (described next).<br />

After the Code field, the checksum follows <strong>an</strong>d is calculated over the<br />

entire ICMP packet without taking the IP header in<strong>to</strong> account.<br />

This application note implements ICMP support <strong>to</strong> send <strong>an</strong>d receive ping<br />

messages. The format of a ping message (officially called echo request)<br />

is shown in Figure 12.<br />

Identification <strong>an</strong>d Sequence<br />

Two 16-bit fields <strong>to</strong> aid in matching echoes <strong>an</strong>d replies<br />

Data<br />

This data is optional for the origina<strong>to</strong>r; however, for <strong>an</strong> upcoming ping<br />

request, the data must be returned in the reply message.<br />

Figure 12. Ping Message Format or Echo/Echo Reply Message Format<br />

Once the sender sets the type field <strong>to</strong> 8 (echo request) <strong>an</strong>d the code <strong>to</strong> 0,<br />

it must initialize the identifier <strong>an</strong>d sequence number prior <strong>to</strong> a ping<br />

execution. Those fields are used when multiple echo requests are sent.<br />

If desired, the ping origina<strong>to</strong>r c<strong>an</strong> add optional data <strong>to</strong> the ICMP packet.<br />

The maximum amount of data should be no more th<strong>an</strong> 64 Kbytes long.<br />

Since this amount also applies <strong>to</strong> incoming requests, this application<br />

note silently discards such big packets.<br />

<strong>AN2120</strong><br />

14 MOTOROLA

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!