**************************************************************************************************** ADSP-BF537 EZ-KIT Lite CAN Receive Example Analog Devices, Inc. DSP Division Three Technology Way Norwood, MA 02062 Date Created: 12/10/04 ____________________________________________________________________________________________________ This directory contains an example ADSP-BF537 project that shows how Port Pins, Interrupts, and the CAN interface can be configured in C. It also demonstrates how to access the LEDs on the EZ-KIT Lite. This receiver example can be used individually or in conjunction with the transmitter example. If used stand-alone, another CAN node must be present on the CAN bus with the same timing and with the same messaging characteristics. This example is available for hardware testing of the CAN and is provided to be used as reference code for setting up the CAN to do simple receive operations. More robust examples will be provided in a future tools update. Files contained in this directory: readme.txt This project description file CAN_RX.dpj VisualDSP++ project file main.c C file containing the main program Initialization.c C file containing all initialization routines Interrupts.c C file containing the interrupt service routines for CAN TX, CAN RX, and PORT F CAN_Functions.c C file containing CAN-specific Functions CAN_RX.h Header file containing prototypes, global data, and macros ____________________________________________________________________________________________________ CONTENTS I. FUNCTIONAL DESCRIPTION II. IMPLEMENTATION DESCRIPTION III.OPERATION DESCRIPTION I. FUNCTIONAL DESCRIPTION This example demonstrates the initialization of the Port pins, Interrupts, and the CAN interface. Theis program initializes the CAN the same way the TX program does. In addition to setting up the CAN and the Port, this program executes a blink routine that scrolls a light across the LEDs from left to right. Upon receipt of a byte into Mailbox 7, the CAN RX ISR checks for a valid command of 0x01, 0x02, 0x03, or 0x04, and sets a series of software flags that are used by the CAN RX main routine to determine what is displayed on the LEDs. Valid commands change the display to blink all 6 LEDs (0x01), scroll the LED left-to-right (0x02) or right-to-left (0x03), or turn all of the LEDs off (0x04). An unrecognized command will turn the LEDs off. After the command is received, this program writes the value of the command into mailbox 24 and sends it back out the CAN controller. II. IMPLEMENTATION DESCRIPTION The main file calls the following sub-routines: 1. Init_PLL() 2. Init_Port() 3. Init_Interrupts() 4. Init_CAN_Timing() 5. Init_CAN_Mailboxes() 6. CAN_Setup_Interrupts() 7. CAN_Enable() It then executes an endless blink routine and takes CAN interrupts to change the pattern. III. OPERATION DESCRIPTION - Make sure that switch SW2.4 is turned on (Attaches PJ4 to CAN_RX Pin) - Open project "CAN_RX.dpj" in VisualDSP++ Integrated Development Environment (IDDE). - Under the "Project" tab, select "Build Project" (program is then loaded automatically into DSP). - Select "Run" from the "Debug" tab on the menu bar of VisualDSP++. - Observe scrolling LED on board after initialization is completed. - If two EZ-KITs are used, the transmitter will display the command sent via push-button interrupt on the LEDs when the response comes back from the receiver board.