 
Readme for Version 5.11 of the CAN Layer2 API

Contents:

 I   Differences to the implementation in Windows
 II  CAN driver installation
 III Runtime enviroment
 IV  Configuration of the CAN channels
 V   List of all files 
 VI  How to test the installation
 V   Differences to the former Version 5.01

 I) Differences to the implementation in Windows
 
 The Windows manual for the Softing CAN Layer2 API and the SCIM manual can be downloaded from the Softing 
 web page at www.softing.com.

 The interrupt handling differs to the Windows implementation. The API function CANL2_set_interrupt_event()
 does not exist (and is not neccessary) in the Linux implementation. Use poll instead. See the source code
 of the samples (can_tst) for details. 

    
 
 II) CAN driver installation:
 
 1. Unpack source files
 2. Open a console window and change to the directory where the unpacked files are
 3. Be sure to have root access rights. Be shure to have the same gcc (version!) compiler installed, which has been used to  
    compile your kernel.
    
 4a. If you want to build the driver: Kernel sources must be installed. Kernel symbol versions (modversions) must be installed.
     If the linux distributor does not provide the modversions, it will be built while compiling the kernel and the kernel modules.
     
     In this case you must compile the kernel and the kernel modules first.
 4b. For building the usermode part of the packet, libtool must be installed. If you want to build the SCIM and the CANopen
     master sample for qt4 then the following packets must be installed: 
     
     a) cmake
     b) kdevelop
     c) build-essential
     d) kdelibs5-dev

     To build and install the driver packege and the API library type following commands from the main directory:
     
     -enter make clean
     -enter make
     -enter make install
     -enter depmode -a

    
 4c. If you want to copy the drivers to an other computer: copy the executable (cancard_cs.ko, vcanacd.ko, vcanpcid.ko)
     to the appropriate /lib/modules/<kernel version> directory. For example to /lib/modules/<kernel version>/extra
     and run depmod -a
     (4b is only useful, if the computer has exactly the same kernel version as the computer where the driver was built)

 5. (only needed for CAN-ACx-104) if you have more than one card in your system or if the default IOPort address 0x240
    does not work (because it is used by an other driver), you must change the script softing_can104. Please enter the
    new/additional resources in the script. A example line which enables 3 cards (in the comment) shows the syntax.
    
 6. Copy the script (softing_cancard, softing_canpci, softing_can104, softing_canpro) to the /etc/init.d directory
 7. Change to /etc/init.d 
 8. -enter insserv <script name> ("insserv softing_canpci" or softing_can104 or softing_cancard or softing_canpro, which depends
    on the card you wish to use).
 9. -enter ./<script name> start
 10. with SuSE linux you can use the runlevel editor to start and install the 
    script instead "insserv". (step 7 - 9 are no more needed in this case)

  

 III) Runtime enviroment:
 1. Generate a directory /etc/softing and copy "mk_devices" to it.

    mk_devices generates default settings and stores it in /etc/softing/candevices.conf, if no valid configuration
    exists for the CAN channel.

    It generates the device files for the softing CAN interfaces too. This program is called from udev
    when a new device is plugged or (CAN-ACx-104) from the start script.

 2. Copy the rules files (40-cancard.rules and 40-canpci.rules) for udev to the directory /etc/udev/rules.d. The rules
    files are needed for PCMCIA, PCI and PC104+ devices but not for PC104 devices.


 IV) Configuration of the CAN channels:

 The CAN channels can be configured in 3 ways:

 1. With the Softing CAN Interface Manager (the easiest way to build a configuration file, but Qt is needed!)
 2. With the API functions; configuration file is not used. (The best way, if you don't want to use the Softing CAN Interface Manager)
 3. By editing the configuration file directly. The best way to do this is the following:
    Let the driver generate the file and change the file after this. Note: Do not insert any additional spaces
    or new lines into the file. New lines are used to seperate channel definitions. Spaces are used to seperate
    the different settings for one channel.
    The configuration file has the following format:
    channel definition<new line>channel definition
    Meaning of the keywords in a channel definition:
    baud: baudrate (with at least 1 decimal digit!)
    presc: CAN prescaler
    tseg1: time segment 1
    tseg2: time segment 2
    sam: number of samples 
    sjw: sync. jump with
    ocr: Output Control Register; possible values: 0xfa or 0xfb (always as hex number with leading "0x"!)
    accmstd: acceptance mask for 11 Bit identifier (see API manual for details). (always as hex number with leading "0x"!)
    acccstd: acceptance code for 11 Bit identifier (see API manual for details)  (always as hex number with leading "0x"!)
    accmxtd: acceptance mask for 29 Bit identifier (see API manual for details)  (always as hex number with leading "0x"!)
    acccxtd: acceptance code for 29 Bit identifier (see API manual for details)  (always as hex number with leading "0x"!)
    ack: a value of 1 enables ack, a value of 0 disables ack 
    errorframes: if set to 1 then the application will be informed about error frames on the bus. 0 disables this feature. 
    type: do not change this value (interface type; used only by the Softing CAN Interface Manager to show it)
    irq: do not change (used interrupt; used only by the Softing CAN Interface Manager to show it)
    ioport: do not change (IOPort address, if used; used only by the Softing CAN Interface Manager to show it)
    dpram: do not change (DPRAM memory address; used only by the Softing CAN Interface Manager to show it)
    name: channel name 

    A channel configuration starts with the serial number of the CAN Interface card followed by a "_" and the
    physical channel number [1 or 2]. If you want to adapt a configuration file to CAN Interface cards with a
    different serial number then you must change the serial number at the start of the channel configuration.

 Softing CAN Interface Manager installation (configuration tool):
 
 Qt must be installed first.

 The CAN Interface Manager is not neccessary. But it helps to configure the CAN Interfaces in an easy way. 
 It generates a configuration file in /etc/softing. (candevices.conf) Administrator rights are neccessary for
 using the CAN Interface Manager.

 This configuration file will be generated by the driver at boot time too, if it does not already exist. But
 (if it is built at boot time) then the CAN Interfaces are configured with default values. (default channel name and
 a default baud rate of 125 KBaud for each channel.)



    
 The Softing CAN Interface Manager is used to change the settings like channel name, baudrate and some other features
 of the CAN interface card. The look and feel is similar to the Windows version of the Softing CAN Interface Manager.
 The Manual to the Windows version can be downloaded from the Softing web page at www.softing.com.

 1. Start kdevelop
 2. At the KDevelop menue select: project->open/import
 3. Browse to usermode/qt4/scim
 4. Type on the finish-button
 5. Select the project scim with the mouse (in the project window)
 6. At the KDevelop menue select: project->settings
 7. Remove the line "/home/kno/..." by typing on the red "-"
 8. Type on the "+", a subdialoge opens, close it by typing on the ok-button.
 9. Click with the right mouse button on the project in the project window on the left and select rebuild.
 

V) List of all files needed:

CAN-ACx-104:

/etc/init.d/softing_can104 (start script)
/etc/softing/candevices.conf (CAN channel configuration file, built by scim or mk_devices)
/sbin/mk_devices (program which generates the default configuration file and the device files in /dev)
/dev/Softing_AG_<channelname> (by mk_devices or Softing CAN Interface Manager generated device files)
/lib/modules/<version>/extra/vcanacd.ko (kernelmode driver)
/proc/softing_can_104/<serialnumber_channel> (proc files generated by the kernel mode driver)

~/CAN-ACx-104_Vxxx_Bxxx/Can104/* (sources of the kernel mode driver; startup script; rules file)
~/CAN-ACx-104_Vxxx_Bxxx/usermode/can_lib (sources of the shared CAN API library)
~/CAN-ACx-104_Vxxx_Bxxx/usermode/can_tst (sources of a sample, which uses the FIFO mode)
~/CAN-ACx-104_Vxxx_Bxxx/usermode/can_test (sources of a sample program, which uses all modes (FIFO-, static object buffer and dynamic object buffer)
~/CAN-ACx-104_Vxxx_Bxxx/usermode/mk_devices (sources of mk_devices)
~/CAN-ACx-104_Vxxx_Bxxx/usermode/staticLib (same as can_lib but a static library - used for mk_devices)


CAN-ACx-PCI:

/etc/init.d/softing_canpci (start script)
/etc/udev/rules.d/40-canpci.rules (rules file for udev)
/etc/softing/candevices.conf (CAN channel configuration file)
/sbin/mk_devices (program which generates the default configuration file and the device files in /dev)
/dev/Softing_AG_<channelname> (by mk_devices or Softing CAN Interface Manager generated device files)
/lib/modules/<version>/extra/vcanpcid.ko (kernelmode driver)
/proc/softing_can_pci/<serialnumber_channel> (proc files generated by the kernel mode driver)

~/CAN-ACx-PCI_Vxxx_Bxxx/CanPci/* (sources of the kernel mode driver; startup script; rules file)
~/CAN-ACx-PCI_Vxxx_Bxxx/usermode/can_lib (sources of the shared CAN API library)
~/CAN-ACx-PCI_Vxxx_Bxxx/usermode/can_tst (sources of a sample, which uses the FIFO mode)
~/CAN-ACx-PCI_Vxxx_Bxxx/usermode/can_test (sources of a sample program, which uses all modes (FIFO-, static object buffer and dynamic object buffer)
~/CAN-ACx-PCI_Vxxx_Bxxx/usermode/mk_devices (sources of mk_devices)
~/CAN-ACx-PCI_Vxxx_Bxxx/usermode/staticLib (same as can_lib but a static library - used for mk_devices)

CANcard2:

/etc/init.d/softing_cancard (start script)
/etc/udev/rules.d/40-cancard.rules (rules file for udev)
/etc/softing/candevices.conf (CAN channel configuration file)
/sbin/mk_devices (program which generates the default configuration file and the device files in /dev)
/dev/Softing_AG_<channelname> (by mk_devices or Softing CAN Interface Manager generated device files)
/lib/modules/<version>/extra/cancard_cs.ko (kernelmode driver)
/proc/softing_can_pcmcia/<serialnumber_channel> (proc files generated by the kernel mode driver)

~/CANcard2_Vxxx_Bxxx/CANcard2/* (sources of the kernel mode driver; startup script; rules file)
~/CANcard2_Vxxx_Bxxx/usermode/can_lib (sources of the shared CAN API library)
~/CANcard2_Vxxx_Bxxx/usermode/can_tst (sources of a sample, which uses the FIFO mode)
~/CANcard2_Vxxx_Bxxx/usermode/can_test (sources of a sample program, which uses all modes (FIFO-, static object buffer and dynamic object buffer)
~/CANcard2_Vxxx_Bxxx/usermode/mk_devices (sources of mk_devices)
~/CANcard2_Vxxx_Bxxx/usermode/staticLib (same as can_lib but a static library - used for mk_devices)

CAN-PROx-104+:

/etc/init.d/softing_canpro (start script)
/etc/udev/rules.d/40-canpro.rules (rules file for udev)
/etc/softing/candevices.conf (CAN channel configuration file)
/sbin/mk_devices (program which generates the default configuration file and the device files in /dev)
/dev/Softing_AG_<channelname> (by mk_devices or Softing CAN Interface Manager generated device files)
/lib/modules/<version>/extra/canprod.ko (kernelmode driver)
/proc/softing_can_pro/<serialnumber_channel> (proc files generated by the kernel mode driver)

~/CAN-PRO_Vxxx_Bxxx/CANcard2/* (sources of the kernel mode driver; startup script; rules file)
~/CAN-PRO_Vxxx_Bxxx/usermode/can_lib (sources of the shared CAN API library)
~/CAN-PRO_Vxxx_Bxxx/usermode/can_tst (sources of a sample, which uses the FIFO mode)
~/CAN-PRO_Vxxx_Bxxx/usermode/can_test (sources of a sample program, which uses all modes (FIFO-, static object buffer and dynamic object buffer)
~/CAN-PRO_Vxxx_Bxxx/usermode/mk_devices (sources of mk_devices)
~/CAN-PRO_Vxxx_Bxxx/usermode/staticLib (same as can_lib but a static library - used for mk_devices)

 VI) How to test the installation
     1) change to the directory usermode->can_tst
     2) enter make
     3) enter ./cantst

     After this a little test program will be started; it opens 2 CAN channels; CAN messages can be received and sent
     between the 2 channels, if the channels are connected by a loopback cable. 
    
     After typing "h" a little help menu appears.

     If you have any problems, contact the softing support at support@softing.com +49 89 4 56 56 337

V   Differences to the Version 5.01
==========================================

1. The new Softing CAN Interface card CAN-PROx-104+ is up now supported with Linux.
2. 64 Bit kernel support.
3. Version 5.11 is tested with kernel 2.6.13 (Suse 10.0), kernel 2.6.18 (Suse 10.2) and kernel 2.6.24.2


VI   Differences to the Version 5.18
==========================================

1. The new Softing CAN Interface card CANpro PCI/express and CANpro USB is up now supported with Linux.
2. Version 5.20 is tested with kernel 3.13.0-63 (Kubuntu 14.04)
