RS232 CAN bus Node
Application note 00
6392 as RS232 to CAN bus interface
To switch the 6392 RS232 node to its CANBUS interface mode, CFG6000 or WIN6000 sends the following 19 characters:
The string is send with 8 data, 2 stopbits and no parity (the 6392 ignores its parity while decoding this string).
Because the actual 6392 BAUDRATE is unknown, it is send by CFG6000/WIN6000 on
every possible speed (300/600/1200/2400/4800/9600/19200/38400) until the 6392
returns the string (confirmation), using its actual BAUDRATE.
Character offset
As soon the 6390 or 6392 is switched into the interface mode the character
offset system is active and must be used.
(Some operating systems or programming languages will not accept some character
under 32
Routine is C and Pascal can be down loaded, see the bottom of this page.
While sending CAN messages via the 6392 the actual codes send via the PC COM
port can be lower than 32.
Some PC programs (like the GWBASIC or QBASIC internal interrupt routines) do not
handle all of these codes correctly, so a protocol is used to prevent the
occurrence of these codes.
1) at the beginning of each CAN message, OFFSET is set to zero.
2) get character to send.
3) if (character code + OFFSET) < 32 : send 1 and set OFFSET to 32
4) if (character code + OFFSET) > 255: send 2 and set OFFSET to 0
5) send character code + OFFSET
6) goto step 2 if any more character to send
7) send carriage return
An example sting
Original string; 244 50 10 50 30 242 40 30
With offsets: 244 50 01 (10+32) (50+32) (30+32) 02 242 40 30
So the string to (or from) the 6392 will be longer than the CAN message.
As soon as CFG6000/WIN6000 (or another PC program) has
switched the 6392 into its interface mode,
a few special CDAL commands can be given (CDAL using CAN identifier 2034),
none of these commands will
get a message response from the 6392. The commands are:
RS232 speed
|
CAN Header |
Byte 1 |
Byte 2 (lsb) |
Byte 3(msb) |
|
|
FEh 43h |
01h |
2Ch |
01h | (300bps) |
| 58h | 02h | (600bps) | ||
| B0h | 04h | (1200bps) | ||
| 60h | 09h | (2400bps) | ||
| C0h | 12h | (4800bps) | ||
| 80h | 25h | (9600bps) | ||
| 00h | 4Bh | (19200bps) | ||
| 00h | 96h | (38400bps) |
CAN bus speed
|
CAN Header |
Byte 1 |
Byte 2 (lsb) |
Byte 3(msb) |
|
|
FEh 43h |
03h |
OAh |
00h | (10Kbps) |
| 14h | 00h | (20Kbps) | ||
| 32h | 00h | (50Kbps) | ||
| 7Dh | 00h | (125Kbps) | ||
| FAh | 00h | (250Kbps) | ||
| F4h | 01h | (500Kbps) | ||
| E8h | 03h | (1000Kbps) |
The typical way to establish a connection to the CAN BUS via the 6392 is:
C routines
We at CD Systems write already a few C routines for CANopen
communication
(including the character offset system) for the 6390/9392 RS232 to CAN interface.
Canoappl.C (p) contains CANopen routines and make use of
can_6390.C (p) for communication thru the 6390 device.
And for Pascal:
Canoappl,pas (p)
(p) protected part of our Internet site, files available for 6390/6392 users.