User manual

GHI Electronics,LLC Embedded Master User Manual
Hardware and Software Library
Reference
System.Net
Microsoft.SPOT.Net
11.11. CAN
Controller Area Network is a very common interface in industrial control and automotive.
CAN is very robust and works very well in noisy environments at high speeds. All error
checking and recovery methods are done automatically on the hardware. TD (Transmit
Data) and RD (Receive Date) are the only 2 needed pins. These pins carry out the digital
signal that need to be converted to analog before it is on the actual wires using the
physical layer. Physical layers are sometimes called transceivers. There are many kinds of
physical layers but the most commonly used is high-speed-dual-wire that uses twisted pair
for noise immunity. This transceiver can run at up to 1Mbps and can transfer data on very
long wires if low bit-rate is used. Data can be transferred between nodes on the bus where
any node can transfer at any time and all other nodes are required to successfully receive
the data. There is no master/slave in CAN. Also, all nodes must have a predefined bit
timing criteria. This is much more complicated that calculating a simple baud rate for
UART. For this reason, many CAN bit rate calculators are available. The CAN peripheral of
Embedded Master is same as the popular SJA1000. A quick Internet search for SJA1000
should result in more than one free calculator.
On Embedded Master, CAN clock matches the processor clock frequency (72 MHz).
PIN# TFT# Name Description
23 23 CAN_TD1 CAN Transmit Data channel 1
25 25 CAN_RD1 CAN Receive Data channel 1
4 4 CAN_TD1 CAN Transmit Data channel 2
3 4 CAN_RD2 CAN Receive Data channel 2
Embedded Master library provides all the necessary functions to be able to send/receive
CAN messages. The user would simply initialize a CAN channel, and then send/receive
through it. To receive messages, a CANMessage Object is created and passed to GetMessage
Method. To send messages the CANMessage is passed to PostMessage. These message
objects hold the data, Message ID and the needed flags.
GetMessage and PostMessage methods are blocking. If the transmit buffer is full, PostMessage
method blocks until is able to proceed. Similarly, GetMessage blocks until a message is
available. The library provide methods to check for transmit and receive buffers before
sending/receiving messages.
Rev. 2.06 TFT Page 71 of 102 www.ghielectronics.com