VSCP Level I driver for devices
vscpl1drv-can232 is a VSCP level I driver (CANAL driver) for the Lawicel CAN232 CAN adapter and other compatible slcan devices.
The linux port of this driver is created by (firstname.lastname@example.org)
Info about the adapter is available at (https://www.can232.com)
This driver interface is for the can232 adapter from Lawicel (or other slcan drivers). This is a low cost CAN adapter that connects to one of the serial communication ports on a computer. The driver can handle the adapter in both polled and non polled mode, which handled transparently to the user. It is recommended however that the following settings are made before real life use.
- Set the baud rate for the device to 115200. You do this with the U1 command. This is the default baud rate used by this driver. * Set auto poll mode by issuing the X1 command.
- Enable the time stamp by issuing the Z1 command.
Driver for Windows
Driver for Linux
From version 14.0.0 the driver is installed in /var/lib/vscp/drivers/level1
From version 14.0.0 the driver is installed in /program files/vscpd/drivers/level1
All level I drivers are configured using a semicolon separated configuration string.
The driver string has the following format (note that all values can be entered in either decimal or hexadecimal form (for hex precede with 0x).
The serial communication port to use.
For windows use 1,2,3...
For Linux use /dev/ttyS0, /dev/ttyUSB1 etc.
A valid baud rate for the serial interface ( for example. 9600 ).
The mask for the adapter. Read the Lawicel CAN232 manual on how to set this. It is not the same mask as for CANAL/VSCP.
The filter for the adapter. Read the Lawicel CAN232 manual on how to set this. It is not the same as for CANAL/VSCP.
is the speed or the CAN interface. Valid values are
Instead of setting a bus-speed you can set the SJA1000 BTR0/BTR1 values directly. If both are set the bus_speed parameter is ignored.
If no device string is given COM1/ttyS0 will be used. Baud rate will be set to 115200 baud and the filter/mask to fully open. The CAN bit rate will be 500Kbps.
Not used. Set to zero.
The CanalGetStatus call returns the status structure with the channel_status member having the following meaning:
|Bit 0-7||TX Error Counter.|
|Bit 8-15||RX Error Counter.|
|Bit 16||Overflow. Cleard by status read.|
|Bit 17||RX Warning.|
|Bit 18||TX Warning.|
|Bit 19||TX bus passive.|
|Bit 20||RX bus passive.|
|Bit 29||Bus Passive.|
|Bit 30||Bus Warning status.|
|Bit 31||Bus off status|
Uses COM5 at 115200 with filters/masks open to receive all messages and with 1Mbps CAN bit rate.
On Linux uses serial USB adapter 1 at 57600 baud with filters/masks open to receive all messages and with a CAN bit-rate set to 50Kbps using btr0/btr1
Typical settings for VSCP daemon config
<!-- The can232 driver --> <driver enable="false" name="can232" config="/dev/ttyS0;19200;0;0;125" flags="0" translation="0x02" path="/var/lib/vscp/drivers/level1/vscpl1drv-can232.so" guid="FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:04" />
<!-- The can232 driver --> <driver enable="false" name="can232" config="com1" flags="0" translation="0x02" path="/program files/vscpd/drivers/level1/vscpl1drv-can232.so" guid="FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:04" />
Install the driver on Linux
Install Debian package
> sudo apt install ./vscpl2drv-can232_1.1.0-1_amd64.deb
using the latest version from the repositories release section.
./configure ./make sudo make install
use the switch --enable-debug if you want a debug build.
Install the driver on Linux using vscp private repository
Warning !!! Currently this is very much experimental
wget -O - http://apt.vscp.org/apt.vscp.org.gpg.key | sudo apt-key add -
deb http://apt.vscp.org/debian buster main deb http://apt.vscp.org/debian eoan main
to the file
replace eoan with the os-release you have installed and debian to debian, ubuntu or raspian
Install the driver on Windows
Install using the binary install file in the release section.
How to build the driver on Linux
git clone https://github.com/grodansparadis/vscpl1drv-can232.git cd vscpl1drv-can232 git submodule update --init ./configure make make install
Default install folder is /var/lib/vscp/drivers/level1
You need build-essentials and git installed on your system.
sudo apt update && sudo apt -y upgrade sudo apt install build-essential git
How to build the driver on Windows
The source contains a Visual Studio project. Use this project to build the driver.
There are many Level I drivers (CANAL drivers) available in VSCP & Friends framework that can be used with both VSCP Works and the VSCP Daemon (vscpd) and other tools that interface the drivers using the CANAL standard interface. Added to that many Level II and Level III drivers are available that can be used with the VSCP Daemon.
Level I drivers is documented here.
Level II drivers is documented here
The VSCP project homepage is here https://www.vscp.org.
Copyright © 2000-2021 Ake Hedman, Grodans Paradis AB - MIT license.