Controller Area Network (CAN) driver example application.

You must license the NET+OS Controller Area Network (CAN) 
driver from Digi before you can use it. Please register at 
http://www.digiembedded.com/requestcan to receive the 
required CAN bus support files.

This example only works on the ConnectCore 9P 9215 development
board.  External hardware is also required.  Please contact 
Digi sales to purchase an application H/W kit which supports
CAN.  If you use the application kit, then refer to the 
documentation which ships with it for information on how to
configure the kit to support CAN and how to update the gpio.h
file in the ConnectCore 9P 9215 platform directory to support
the kit's hardware connections.

You could also build your own CAN interface.  The file 
canInterface.bmp shows how to create one using an SN65HVD233
CAN driver.  Pins 6 and 7 on this chip attach to the CAN bus.
Pins 1 and 4 need to connect to processor GPIO pins.  You 
must choose which of the two FIM processors on the NS9215 
will be used for CAN.  The FIM processor you select determines
which GPIO pins will be used.

If you use FIM 0, then you must use GPIO pin 14 or 96 for the 
CAN receive line, and GPIO pin 15 or 97 for the transmit line.
Edit gpio.h as follows:

CAN RX      BSP_GPIO_MUX_IOP_0_CAN_RXD
=======     ====================================
pin 14      BSP_GPIO_MUX_USE_PRIMARY_PATH
pin 96      BSP_GPIO_MUX_USE_ALTERNATE_PATH

CAN TX      BSP_GPIO_MUX_IOP_0_CAN_TXD
======      =====================================
pin 15      BSP_GPIO_MUX_USE_PRIMARY_PATH
pin 97      BSP_GPIO_MUX_USE_ALTERNATE_PATH

You must also make sure the configuration file canTable.c in 
the platform directory selects FIM 0.  Edit the file and make
sure it contains the following statements.

NaCanTable_t naCanTable[] = 
{
    {
        NA_IOP_PROCESSOR_PIC0,
        (NaIopProgram_t *) &naCanIopDriver
    }
};


If you use FIM 1, then you must use GPIO pin 24, 68, or 98 for
the receive line, and pin 25, 69, or 99 for the transmit line.
Edit gpio.h as follows:

CAN RX      BSP_GPIO_MUX_IOP_1_CAN_RXD
=======     ====================================
pin 24      BSP_GPIO_MUX_USE_PRIMARY_PATH
pin 68      BSP_GPIO_MUX_USE_ALTERNATE_PATH
pin 98      BSP_GPIO_MUX_USE_2ND_ALTERNATE_PATH

CAN TX      BSP_GPIO_MUX_IOP_1_CAN_TXD
======      =====================================
pin 25      BSP_GPIO_MUX_USE_PRIMARY_PATH
pin 69      BSP_GPIO_MUX_USE_ALTERNATE_PATH
pin 99      BSP_GPIO_MUX_USE_2ND_ALTERNATE_PATH

You must also make sure the configuration file canTable.c in 
the platform directory selects FIM 1.  Edit the file and make
sure it contains the following statements.

NaCanTable_t naCanTable[] = 
{
    {
        NA_IOP_PROCESSOR_PIC1,
        (NaIopProgram_t *) &naCanIopDriver
    }
};


Rebuild the ConnectCore 9P 9215 platform after you have edited 
gpio.h and canTable.c.

This example demonstrates how to use the NET+OS CAN driver.  The
application opens and configures the CAN driver.  It periodically
sends a request frame and a data frame, and it responds to 
selected request frames received from the CAN bus.

The example code is contained in root.c.  There are a set of 
constant #defines near the top of root.c.  These control the bit
rate of the CAN bus, and the CAN IDs used by the example.  It is
very important to set the correct bit rate for the bus.  Edit
root.c and make sure CAN_BUS_BIT_RATE is set to the correct value.

Note that there must be at least two devices on a CAN network.  
This is because all frames must be acknowledged by at least one
receiver.  The example will not work unless there is at least
one other CAN node on the network.


appconf.h           sets application configuration settings
canInterface.bmp    schematic of CAN interface
.\32b\image.gpj     used to build the big endian Green Hills version of the
                    application.  The build script creates a version that
                    can be debugged with Multi, and the file image.bin 
                    which can be written into a ROM that uses the bootloader.
makefile            Make file for the GNU toolset.
project.gpj         
readme              this file
root.c              contains the applicationStart() function, that
                    creates an application thread
naftpapp.c          contains the RAM based FTP application code
project.gpj         contains the generic project build script

In addition, the following files in the BSP directory are built
as part of this application:

reset.s         contains the reset code
appconf_api.c   contains run time access to the application configuration


