Issue
157 August 2003
Palm-Enabled
Telescope
THE
GALILEO PROTOCOL
The
aforementioned command and checksum framing are part
of my Galileo protocol. Starting the message with a
reserved command word, the Galileo protocol ensures
that the receiver can distinguish between a valid incoming
message and a message fragment. The checksum at the
end of the message ensures that the message was received
correctly. Listing 1 shows the Palm routine that builds
the IRDA command string.
| Listing
1—The Palm uses this communications routine
to talk to the telescope. It has to reformat bytes
that might be confused for commands and resend the
commands when they fail. |
The
eZ80’s protocol task is to validate incoming messages,
send an acknowledgement when a message arrives correctly,
and to format its responses properly. All of the protocol
intelligence is in the Palm.
As
you can see in Figure 3, the Palm software provides
for a message retry. When you press a button to initiate
a command to the telescope, the Palm writes the message
to a buffer and sends it to the serial port. The IrDA
driver software sends this message and awaits a response
from the telescope. If the telescope doesn’t respond
within 500 ms, the Palm resends the message. During
the message-sending process, the user display shows
a “Searching” message. Each pass through the retry loop
adds a period to the end of the Searching message. After
20 passes (10 s), the Palm reports a “Cannot find eZport”
message and quits.
|

(Click
here to enlarge)
|
Figure
3—To ensure reliable communication over the IrDA
link, the Palm software uses a wait-and-retry approach
to communications. It sends a message and waits
for a response, resending if the response fails. |
When
the Palm is expecting a response from the telescope,
the retry loop includes looking for a valid response
as part of its definition of a completed message. If
the response is corrupted, or never occurs, the Palm
will resend the command. In this way, the Palm maintains
control over the communications link, and the eZ80 can
simply send its response messages blindly.
This
protocol makes the communication bulletproof in that
it ensures the accuracy of messages. It also makes the
use of the IrDA link more convenient. Unlike a television
remote, the Galileo Palm tries multiple times during
a period of several seconds to get the message through.
You don’t have to point first and then press the button
to see if they are aligned correctly; nor must you try
again if there is no response. You can simply press,
point, and let the Palm take advantage of the link as
soon as everything lines up.
Be
careful when using this protocol. Because of the need
for handshaking and retry, the messages sent over the
IrDA interface should be short. The longer the message,
the more likely it is that the link will be broken before
a successful transmission and response have been completed.
That means you’ll have to use additional retry attempts
to increase the odds of having the link work, which
will make the link less responsive.
I
found that keeping the data packets to 10 or 20 bytes
yields the best results in terms of reliability and
speed. Longer data blocks should be broken up and numbered
so that the receiver can put them back together and
have labels to identify the start, end, and size of
the block. Figure 4 is an example of a command string.
|

(Click
here to enlarge)
|
Figure
4—A typical message from the Palm demonstrates the
Galileo format. Messages are short and framed with
a command code and checksum. |
Using
the Palm and bridge module to control the telescope,
I get more than a better user interface. I also have
the beginning of remote control capability. But pointing
the handheld Palm at the telescope is a tedious way
to issue a long series of commands. A wireless Ethernet
link would be more practical. I chose to use the Webserver
module as a core so that I could expand in that direction.
The
Webserver module includes an Ethernet port and comes
with full Ethernet and TCP/IP software support, so turning
the Galileo Palm bridge into a Galileo Internet bridge
would require only RF access point components as hardware
additions. The eZ80 software would become more complex,
of course, but most of the necessary software elements
are available and ready to use in the Webserver support
package. The support software also includes a full HTML
server, which turns the design of a user interface into
a simple HTML programming effort. A PC, running any
operating system, can run the telescope without additional
programming.
I
could even set up the telescope for ’Net-based control.
I could download star data from the ’Net and pass it
to the telescope, which would give me an unlimited database
of objects to gaze at. With a CCD camera and a wireless
network connection, I could even stargaze over the ’Net
from the comfort of my home.
Although
searching the stars from inside my house doesn’t generate
the same thrill as standing outside in the clear night
air to gaze at heavenly objects with my own eyes, it
does have one benefit: I can scan the stars and still
be able to meet my wife’s request, which is to stay
home and gaze at her.