|Ocera CANOpen Manual|
- 1 Overview
- 2 Hardware Configuration
- 3 PLD Register Map
- 4 Software Support
- 5 Further Resources
TS-CAN1 is a PC/104 daughter board which provides one single CAN interface channel and enables a PC/104 embedded systems to be connected to CAN1.1 and CAN2.0a networks. It uses a Philips SJA1000 CAN controller which is opto-isolated from the physical CAN network, increasing the system security. On-board jumpers are used to select both the interrupt and the I/O region used. Also, the on-board termination resistor is jumper selectable. Up to four boards can be installed in any single system. The SJA1000 controller can be configured to communicate with the processor through 8 different 32-bytes I/O regions.
|Note:||The TS-CAN1 is compatible with both X86 and ARM architectures.|
2 Hardware Configuration
2.1 Jumper settings for I/O Address Selection
2.2 Jumper settings for IRQ Selection
2.3 CAN 10 Pin Header
The physical pin numbering is as follows. The top row is the side closest to the edge of the board. The dot in the table represents the pin with the square pad.
|Note:||TS-7200, TS-7250, TS-7260, and TS-7300 I/O space starts at 0x11E0_0000 physical address. For example, 0x150 I/O space is decoded at 0x11E0_0150 physical memory.
3 PLD Register Map
|Base + 0||Board Identifier #1||R||Fixed hex value: 0xF6|
|Base + 1||Board Identifier #2||R||Fixed hex value: 0xB9|
|Base + 2||PLD Version Register||R||Fixed value|
|Base + 3||LED control/status||RW||
|Base + 4||Page selection register||RW||
|Base + 5||Mode control Register||RW||
|Base + 6||Jumper Status||R||
|Base + 7||Reserved|
3.1 SJA1000 IO Page Selection Reg
3.2 SJA1000 IO Address Selection Register
WARNING This register MUST be different from the PLD register chosen using the jumper configuration, and ALSO must be different from all other devices in the PC104 stack or an address conflict WILL occur. The default address is 0x100.
4 Software Support
4.1 SJA1000 Programming
The TS-CAN1 was designed using the Philips SJA1000 CAN controller. The SJA1000 provides support for CAN2.0 networks and supports BasicCAN and PeliCAN modes. For further information about SJA1000 and how to interact with it through its registers, please check the specific Datasheet and Application Notes:
4.2 Driver for Linux
The Linux device driver for TS-CAN1 was developed using the OCERA framework for CAN, which is composed of LINCAN, VCA, CAN/CANOpen Monitor and CANOpen Device. LINCAN is a generic Linux device driver implementation that supports many boards. It is an evolution of other CAN open-source projects for Linux. The Virtual CAN API (VCA) is an interface that hides LINCAN driver specifics from user space programmer, increasing the development speed and compatibility. CAN/CANOpen Monitor is a tool (application server and Java GUI client) that enables monitoring and interaction with a CAN network using client/server applications. CANOpen Device is a library based on VCA that provides a high-level protocol for device integration over LINCAN using CANOpen master and slave components. For further information on OCERA/LINCAN framework, please see the links:
|Note:||This guide was written to cover both TS-CAN1 and TS-7KV hardware and the Lincan driver is compatible with both.|
New: The original lincan author has notified Technologic Systems that a newer version of lincan is available here: http://ortcan.sourceforge.net/lincan/
This new source has not yet been tested by Technologic Systems.
4.3 Installing the Ocera/Lincan Files
The files are available at the TS ftp server (ftp://ftp.embeddedarm.com/can):
- oceralincan_arm.tar.gz : tarball with ocera/lincan files for TS ARM boards
- lincan_arm.tar.gz : tarball with last version of the lincan driver for TS ARM boards
- oceralincan_x86.tar.gz : tarball with ocera/lincan files for TS X86 boards
- lincan_x86.tar.gz : tarball with last version of the lincan driver for TS X86 boards
More recent versions of the Lincan driver can be found at:
If you need the source code of OCERA/LINCAN, please follow the link below to get access to OCERA at CVS or download the source tree used by Technologic Systems:
Extracting the two tarballs for your specific architecture (ARM or X86) at the root directory of your target system will create the /usr/lincan/ directory filled with all needed files (All the examples in this guide assume that root is your working directory). Use the following commands replacing xxx with the appropriate architecture name:
# tar zxvf oceralincan_xxx.tar.gz -C / # tar zxvf lincan_xxx.tar.gz -C /
4.4 Loading the Driver
The Lincan driver for TS-CAN1 implements a plug and play feature. So, the driver is able to detect the hardware, I/O address and IRQ line being used. To take advantage of the implemented plug and play feature, load the driver into the kernel by executing the command below:
# cd /usr/lincan/modules/ # insmod -f lincan.o hw=tscan1 (in case your board is a TS-CAN1) # insmod -f lincan.o hw=ts7kv (in case your board is a TS-7KV) # insmod -f lincan.o hw=ts732 (in case your board is a TS-732)
4.5 Testing the CAN Network
You can use the testing tools available at /usr/lincan/bin-utils directory. For example, to set up your CAN hardware to listen to messages from a working CAN network, use the following command:
# ./readcan /dev/can0
To send messages out to a CAN network, you can use the sendburst tool. For example, to send out #3 can messages with identifiers #1 on each #1 second of period, do:
# ./sendburst --help # ./sendburst -d/dev/can0 -w1 -b3 -i1
To find further information about either the binary tools or LIBVCA and CAN/CANOpen, please view the OCERA documentation:
4.6 More Control Over the Driver
If you need more control over the driver configuration, you can skip the plug and play feature and use the module parameters. Get more information about the Lincan driver using the modinfo tool. For TS-CAN1, the relevant driver parameters are:
- hw: Name of the TS hardware being used. It should be tscan1 if using TS-CAN1 card, ts7kv if using TS-7KV card or ts732 if using a TS-732 card.
- io: The I/O address used by the card. It must be in accordance with the jumper selection. Use io=0x150 if jumper selection is all OFF for ARM I/O, for example.
- irq: The IRQ address used by the card. It must be in accordance with the jumper selection. For ARM platform, use irq=33 when jumper selection is IRQ 6, irq=40 when jumper selection is IRQ 7, and irq=21 when jumper selection is IRQ 5
- canio: Use this parameter for setting a specific I/O address space to allocate the SJA1000 registers. It is only available with TS-CAN1. See the table SJA1000 I/O address selection register in previous section.
- clock: Clock frequency of the on-board crystal/oscillator in step of 1kHz. The default is clock=16000 for 16Mhz on TS-CAN1 and clock=24000 for 24Mhz on TS-7KV.
- baudrate: Bit rate for the SJA1000 communication with the CAN network in step of 1kHz. The default is baudrate=1000 for 1Mbps.
|Note:||If your CAN card is a TS-732, the Lincan driver will only support the hw and baudrate parameters. The clock is default set to 25Mhz and the IRQ is 40. The default baudrate is set to 500Kbps.|
4.7 Using Additional TS-CAN1 Cards in a Single System
By using more than one TS-CAN1 card on a single system, you can set up a CAN network for testing and development with a single target embedded hardware. The Lincan device driver supports up to 8 CAN boards. You can load a single driver to give support to all cards by setting the appropriate parameters on driver loading. The parameters of the driver can be extended by using index commas. For example, to set up the Lincan driver to support 3 different CAN boards and use plug and play functionality:
# insmod -f lincan.o hw=tscan1,ts732,ts7kv
If you want to set specific values to the other parameters, it is possible to skip the plug and play functionality by assigning values others than -1. Notice that the -1 value tells the driver to use plug and play or default values to the specific parameter.
The next example loads the LINCAN driver to support two TS-CAN1 boards and one TS-7KV. The I/O space of the first board is 0x150, while the others are plug and play configured. The same methodology can be applied for IRQ and baudrate configuration.
# insmod -f lincan.o hw=tscan1,tscan1,ts7kv io=0x150,-1,-1 irq=-1,-1,33 baudrate=1000,500,-1
|Note:||TS-ARM based systems can be set up with a maximum of 4 TS-CAN1 boards and 4 TS-7KV boards. Thus, you are able to have up to 8 CAN interfaces running simultaneously.
5 Further Resources
Recommended reading: CANopen user guide: ftp://oz.embeddedarm.com/pc104-peripherals/ts-can1/pdfs/ocera-canopen-ug.pdf