2 master-slave messaging protocol – Jameco Electronics Rabbit 3000 User Manual

Page 216

Advertising
background image

User’s Manual

207

require a speciality processor. The slave processor can process data to perform pattern
recognition or to extract a specific parameter from a data stream.

13.3.2 Master-Slave Messaging Protocol

In this protocol the master sends messages to the slave and receives an acknowledgement
message. The protocol can be polled or interrupt driven. Generally, the master sends a
message that has a message type code, perhaps a byte count, and the text of the message.
The slave responds with a similar message as an acknowledgement. Nothing happens
unless the master sends a message. The slave is not allowed to initiate a message, but the
slave could signal the master by using a parallel port line other than /SLAVEATN or by
placing data in one of the registers the master can read without interfering with the mes-
sage protocol.

The master sends a message byte by storing it in SPD0R. The slave notices that SPD0R is
full and reads the byte. When the master notices that SPD0R is empty because the slave
read it, the master stores the next byte in SPD0R. Either side can tell if any register is
empty or full by reading the status register. When the slave acknowledges the message
with a reply message, the process is reversed. To perform the protocol with interrupts, a
slave interrupt can be generated each time the slave receives a character. The slave can
acknowledge the master by reading SPD0R if the master is polling for the slave response
to each character. If the master is to be interrupted to acknowledge each character, the
slave can create an interrupt in the master by storing a dummy character in SPD0R to cre-
ate a master interrupt, assuming that the /SLAVEATTN line is wired to interrupt the mas-
ter. The acknowledgement message works in a similar manner, except that the master
writes a dummy character to interrupt the slave to say that it has the character.

Several problems can arise if there are dual interrupts for each character transmitted. One
problem is that the message transmission rate will free run at a speed limited by the inter-
rupt latency and compute speed of each processor. This could consume a high percentage
of the compute resources of one or both processors, starving other processes and espe-
cially interrupt routines, for compute time. If this is a problem, then a timed interrupt can
be used to drive the process on one side, thus limiting the data transmission rate.

Another solution, which may be better than limiting the transmission rate, is to use inter-
rupts only for the first byte of the message on the slave side, and then lower the interrupt
priority and conduct the rest of the transaction as a polled transaction. On the master side
the entire transaction can be a polled transaction. In this case, the entire transaction takes
place in the interrupt routine on the slave, but other interrupts are not inhibited since the
priority has been lowered.

A typical slave system consists of a Rabbit microprocessor and a RAM memory con-
nected to it. The clock can be provided either by connecting a crystal, or crystals to the
slave or by providing an external clock, which could be the master’s clock. The reset line
of the slave would normally be driven by the master. At system startup time the master
resets the slave and cold boots it via the slave port. (The SMODE pins must be configured

Advertising
This manual is related to the following products: