|
Project ObjectivesOur goal was to implement writing shared variables for shared memory on multiple devices. We wanted the devices to communicate with each other using the I2C protocol. Project ImplementationNetwork Topology: I2CI2C is a broadcast topology network, like Ethernet. Any node may connect to any other node
in the network. Each node is a device, such as a microprocessor like the Atmel
89C55 (aka the 8051). The master transmission procedure call implementation follows the protocol outlined in Figure 6 (Master transmitter mode) of the PCF8584 specification. The slave receiver interrupt handler implementation follows the basic portions of the slave receiver protocol outlined in Figure 9 (Slave receiver/slave transmitter modes) of the PCF8584 specification. Because we did not implement master to slave read messages through the PCF8584, our implementation of the slave receiver mode interrupt handler does not perform checks such as asking if the node was addressed as a slave, if the node's own address was accessed correctly, and if the message was a read or a write before reading the byte received in the I2C controller buffer. To use the I2C controller, you need to initialize the bus controller following the procedure outlined in Figure 5 (PCF8584 initialization sequence), which we implement in our I2C interface. Details on using our I2C bus controller interface are found here. Application: Serial Chat Program and Shared MemoryOur project implements a message passing system. We implemented the I2C bus controller interface (effectively datalink/physical layers) and then built an application that handled the low level details of message passing (effectively the transport, session, and application layers all together). A node on the network is the collection of a serial port terminal window for text viewing (optional), an 8051 for application processing , and a bus controller for I2C handling. Each node on the network has an array of variables ("shared variables") which may be accessed by other nodes on the network. Each node acts as an owner for a fixed sized set of variables. The number of shared variables available for access by other nodes is then proportional to the number of nodes on the network. Locally, the node may perform three operations: HELP, ZERO, VIEW, and buffer dump. HELP displays the commands available in the application in the terminal window. ZERO resets the values of all of the owner's shared variables to zero. VIEW displays the value of each of the owner's shared variables in the terminal window. Buffer dump shows the details of the last message received in the terminal window: what is the type of the message, who is the sender, and what is the message payload. Our system supports a maximum of twenty-six 8051 processors. On the network, the node may perform four operations: PING, CHAT, READ, and WRITE. PING is a network polling command which attempts to send an "Are you alive?" message to each of the twenty-six possible nodes. CHAT sends an application message to another node, which appears in the node's terminal window. READ requests for the value of a shared variable on another node. This is a timed request which displays the shared variable value if the node responded before the timeout or an error message if it did not. WRITE requests to change the value of a shared variable on another node. This is a best effort service, meaning the application does not guarantee or acknowledge the request was granted. Our application communicated to the computer terminals via serial I/0. We implemented printf and scanf-like functions to abstract the details of handling serial I/O interrupts. Details on how to use the serial I/O interface, how to use this application, and how the application was implemented are here. Project DetailsTo recreate our project, build the circuit below:
Here are all of our source files:
For more information about the tools we used, check out the links page. Project ExtensionsNow that the I2C bus controller interface is implemented, it is easy to think of more projects that could extend from ours.
|