...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents |
---|
Installing NXDRV-Driver on Linux Ubuntu
...
The cifX Linux driver runs as a library in userspace and accesses the card via a UIO kernel module (userspace I/O).
...
Figure 1: Linux cifX driver architecture (Linux DRV 13.EN)
Requirements
cmake (min 2.8.9)
libthread, librt
libapciaccess-dev (tested with V0.10.2 / V0.13.1-2)
- always needed for cifx PCI cards
Installing NXDRV-Driver
Install cmake.
...
Install libpciaccess-dev.
Code Block | ||||
---|---|---|---|---|
| ||||
$ apt-get install libpciaccess-dev |
Extract the sources from the zip-file.
Code Block | ||||
---|---|---|---|---|
| ||||
$ tar xf <driver_version>.tar.gz |
Change to the driver directory.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd <driver_version>/driver/ |
Run the installation script.
Code Block | ||||
---|---|---|---|---|
| ||||
$ ./build_install_driver [optional pass the build folder] |
...
In case of a system reboot, the kernel driver needs to be reloaded
Code Block | ||||
---|---|---|---|---|
| ||||
$ modprobe uio_netx |
Compiling the example programs
Go to the examples folder.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd <driver_version>/examples |
(Optional) Create a build directory.
Code Block | ||||
---|---|---|---|---|
| ||||
$ mkdir build && cd build |
Run cmake.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cmake .. |
Build all source modules
Code Block | ||||
---|---|---|---|---|
| ||||
$ make all |
Configuration file storage
For a cifX device (especially CIFX 50 and CIFX 90), firmware and configuration files that are not stored on the hardware, must be loaded into the hardware each time the card is powered-up.
This part describes where and how these files have to be stored.
To allow device-specific configuration, the card needs to be identified, and the firmware must be stored on the host in a specific folder structure to create a unique relation between card and configuration.
These folders locate under a global base-folder. By default, it is '/opt/cifx' (can be changed during driver initialization).
There are four different types of configuration of a card, each with its specific folder structure. For more information, please see our Linux driver manual.
This guide describes the folder structure single directory.
Go to the scripts directory.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd <driver_version>/driver/scripts |
Run the installation firmware script.
Code Block | ||||
---|---|---|---|---|
| ||||
$ ./install_firmware create_single_dir |
...
First, enable the SPM_PLUGIN option during compiling the driver. See Configuration file storage.
Note |
---|
If you are using linux driver version V2.1.1.0 or lower, the the kernel module ax99100-pci-spi does not compile out of the box. If you get the following compiler error: -Werror=incompatible pointer-types located in moduleparam.h, please change in ax99100-pci-spi.c the following calls of module_param_named from ushort to uint. |
Go to cifx_m2 folder.
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd <driver_version>/driver/cifx_m2/ |
Change in ax99100-pci-spi.c (with e.g nano) the parameter in line 497, 501 and 505 from ushort to uint.
Code Block | ||||
---|---|---|---|---|
| ||||
$ nano ax99100-pci-spi.c |
...
Then, in Makefile uncomment line 5
#obj-m += ax99100-pci-gpio.o
Warning |
---|
You cannot use Interrupt for now! |
Build source module
Code Block | ||||
---|---|---|---|---|
| ||||
$ make |
Install driver modules. This will copy the driver modules into the desired kernel library folder, which are compiled for.
Code Block | ||||
---|---|---|---|---|
| ||||
$ make modules_install |
Update the module dependencies in the modules.dep file.
Code Block | ||||
---|---|---|---|---|
| ||||
$ depmod |
Configure the SPI interface (at chip-select 0) for accessing the netX90 based cifX/M.2 card with mode 3 and a maximum speed of 25Mhz.
Code Block | ||||
---|---|---|---|---|
| ||||
$ modprobe ax99100-pci-spi modalias0=spi-petra mode0=3 max_speed_hz0=25000000 |
...
Run:
Code Block | ||||
---|---|---|---|---|
| ||||
$ dmesg | grep "ax99" |
You should see something similar to the following:
Code Block | ||||
---|---|---|---|---|
| ||||
[ 208.376412] ax99100-pci-spi: AX99100 PCIe to Multi I/O Controller - SPI driver [ 208.386582] ax99100-pci-spi 0000:06:00.3: spi0 successfully initialized! [ 208.386638] ax99100-pci-spi 0000:06:00.3: SPI slave (cs=0, modalias=spi-petra, mode=3, max_speed_hz=25000000) successfully added. |
(Optional) Check if spi device is created.
Code Block | ||||
---|---|---|---|---|
| ||||
$ ls /dev/spi* |
Terminal output:
Code Block | ||||
---|---|---|---|---|
| ||||
/dev/spidev0.0 |
Test
Then run a simple cifx example for the initial sanity check:
Go to the example folder and build the example programs. Please see Compiling the example programs.
Then run the cifxtcpserver with -a as parameter to detect the installed CIFX/M.2 card.
An example:
Code Block | ||||
---|---|---|---|---|
| ||||
$ cd <driver_version>/examples/build $ ./cifxtcpserver -a |
If a firmware (e.g. PROFINET) was downloaded to the device, you should get a similar output:
Code Block | ||||
---|---|---|---|---|
| ||||
---------- Available Cards ---------- 1.: cifX0 DeviceNumber : 1443100 SerialNumber : 20418 - Channel 0: Firmware : PROFINET IO Device Version : 5.4.3 build 0 - Channel 1: Firmware : Network Services Version : 1.0.0 build 0 ---------------------------------------------------- |
Issues during build process
While compiling cifxtcpserver example, this error appears.
Error: multiple definition of 'g_ptMutex'
Figure 2: Error while compiling
...