Iic Driver Sample Application - Freescale Semiconductor DSP56800E User Manual

Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

5.17.4

IIC Driver Sample Application

The IIC driver application is designed for Freescale EVMs and is intended to illustrate the usage
of this driver by a real example. For the IIC module, the sample application contains a "complete"
IIC interrupt handler code, implementing the state diagram described below in Figure 5-3. The
code can be reused in user applications as a general-purpose IIC communication driver.
The IIC sample application demonstrates both the Master and Slave capabilities of the IIC
peripheral module. You will need two MC56F8013DEMO boards connected together via the IIC
bus (3 wires needed: SCL, SDA and GROUND).
1. Most of the time, the IIC is in Slave mode and waits for being addressed by the Master
device.
— a) If Master uses a WRITE transaction, the BIT_0 and BIT_1 of (each) data byte received are
tested and we toggle the YELLOW[GPIO_A1] and/or GREEN[GPIO_A2] LEDs if BIT_0/1 is
set.
— b) If Master uses a READ transaction, we respond with a byte where BIT_0 and BIT_1 report
what LEDs (GPIO_A1 and GPIO_A2) are ON.
2. Using an GPIO interrupt, we monitor the board buttons. Any time the button is pressed, the
IIC is switched to Master mode and a message is sent to a remote slave. The BIT_0 and
BIT_1 bits are set in the message data byte if button #1 and/or #2 were pressed. Thanks to
(1a) the remote node should respond by toggling the YELLOW and/or GREEN LEDs.
3. Even if no button is pressed, the IIC is periodically (approx. once per second) switched to
a Master mode and the remote note is queried for what LEDs are currently turned-on (see
1b). The returned message is then used to turn the status YELLOW and GREEN LEDs on
or off (GPIO_A4 and GPIO_A5).
The IIC device must not address itself so it is required to define different
REMOTE_ADDRES and the local slave address (in graphical
configuration tool).
The Graphical Configuration Tool was used to configure CPU pins and
peripheral modules in this application. See the appconfig.h file listing for
more details.
The application can be found at e.g. sample_applications\MC56F8013DEMO\iic_demo directory
and consists of the application project iic_demo.mcp, source code for the application main.c and
configuration file appconfig.h.
FREESCALE SEMICONDUCTOR
NOTE:
NOTE:
Targeting 56F8xxx Platform
5-817

Advertisement

Table of Contents
loading

Table of Contents