
LAWICELAB Embedded Tools, Starterkits & Consulting Phone: +46 (0)451 598 77
Box 3 AVR • 8051 • PICmicro • HC08 • HC11 • HC12 • MSP430 • C166 Fax: +46 (0)451 598 78
SE-282
21
T
yringe
CAN (Controller Area Network) • CANopen • USB • Compilers [email protected]SWEDEN Single Board Computers • Programmers • Software www.can232.com
LAWICELAB www.can232.com
CAN232
1.2 Testing the CAN232
Test the CAN232 by installing it to a PC’s COM port and power it up according to instructions on
previous page under section 1.1. When the CAN232 gets power the 4 LEDs (red, yellow & two
green) will blink rapidly some times depening on what RS232 speed it is set up to. If the RS232 is
set to 57,600baud (default when delivered) all four LEDs will blink 3 times (the higher RS232
speed the less it blinks, see the Ucommand for more info). Then start Windows Terminal software
(or your favourite terminal software) and set it up to e.g. 57600baud, 8 databits, no parity, 1 stop bit
(if the CAN232 is set to 57,600baud), also set local echo on so you can see what you type and set
the check flag so that it appends a line feed when it receive and end of line. Finally, make sure you
have hardware and software handshaking off and that no LF (ASCII 10) is added on outgoing CR
(ASCII 13). Then make sure you are connected and press >ENTER< and it will make a new line,
then press V and >ENTER< and it will print/reply Vhhss, where hh is the hardware version and ss
is the software version (e.g. V1335). Now you know you have full contact with the CAN232 unit
and can set it up with a CAN speed and open the CAN port, send and receive frames. Note that
the green LED on the CAN connector side indicates that a CAN frame is succesfully sent or
received into the CAN232 unit and the green LED on the RS232 side blinks for received RS232
data (new in version 3). Note that you must at least have 2 nodes (CAN232 works as one node if
it is not set into ”listen only mode”) to send/receive CAN frames and that the CAN cable network is
terminated at both ends with 120 ohms over the CANL and CANH lines plus that a twisted pair
CAN cable is used. The CAN232 is set to accept all frames, so no need to set filters etc. for
testing. The CAN232 can also be tested with the sample programs at www.can232.com.
Example for testing CAN232
V[CR] (should reply version, e.g. V1324[CR])
S4[CR] (set up CAN speed to 125Kbit)
O[CR] (open the CAN channel, the Yellow LED should be activated)
t1001AA[CR] (sends ID=0x100 hex with DLC=1 and data 0xAA, one byte)
1.3 CAN232 limitations
There are of course limitations of how many CAN frames the CAN232 can send & receive. Current
version (V13nn) is tested with a throughput of sending 500 standard 11bit frames with 8 databytes
at 125kbit CAN bitrate and 115,200 baudrate of the RS232. The bottle neck is of course the
RS232 side and the microcontroller not being able to handle more frames per second. So the
CAN232 is aimed for low speed CAN networks and works very well with CAN speeds at 125kbit or
less but of course it is usable up to 1 Mbit (but the bus load may not be high at these speeds or e.g.
the filter has to be set to accept some of the frames). The CAN232 has software CAN FIFO
queues for both sending and reception. These transmit FIFO can handle 8 frames (standard or
extended) while the receive FIFO can handle 32 frames (standard or extended). Furthermore the
CAN232 has only a small RS232 buffer, so it can only handle one or tow command at a time,
meaning before sending the next command to it, you must wait for an answer from the CAN232
unit (OK which is [CR] or Error which is [BELL]).