Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

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).Image Removed

...

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.

...

...

languagebash
themeDJango

...

$ apt-get install cmake

Install libpciaccess-dev.

Code Block
languagebash
themeDJango
$ apt-get install libpciaccess-dev

Extract the sources from the zip-file.

Code Block
languagebash
themeDJango
$ tar xf <driver_version>.tar.gz

Change to the driver directory.

Code Block
languagebash
themeDJango
$ cd <driver_version>/driver/

Run the installation script.

Code Block
languagebashthemeDJango
$ ./build_install_driver [optional pass the build folder]

...

(info) In case of a system reboot, the kernel driver needs to be reloaded

Code Block
theme
languagebashDJango
$ modprobe uio_netx

Compiling the example programs

Go to the examples folder.

Code Block
languagebash
themeDJango
$ cd <driver_version>/examples

(Optional) Create a build directory.

Code Block
languagebash
themeDJango
$ mkdir build && cd build

Run cmake.

Code Block
languagebashthemeDJango
$ cmake ..

Build all source modules

Code Block
theme
languagebashDJango
$ 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
languagebash
themeDJango
$ cd <driver_version>/driver/scripts

Run the installation firmware script.

Code Block
theme
languagebashDJango
$ ./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
languagebashthemeDJango
$ 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
languagebash
themeDJango
$ 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 the source module

Code Block
theme
languagebashDJango
$ make

Install driver modules. This will copy the driver modules into the desired kernel library folder, which are compiled for.

Code Block
languagebash
themeDJango
$ make modules_install

Update the module dependencies in the modules.dep file.

Code Block
languagebash
themeDJango
$ 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
languagebash
themeDJango
$ modprobe ax99100-pci-spi modalias0=spi-petra mode0=3 max_speed_hz0=25000000

...

Run:

Code Block
theme
languagebashDJango
$ dmesg | grep "ax99"

You should see something similar to the following:

Code Block
languagebashthemeDJango
[  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
theme
languagebashDJango
$ ls /dev/spi*

Terminal output:

Code Block
languagebash
themeDJango
/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
theme
languagebashDJango
$ 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
languagebashthemeDJango
---------- 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'

Image Removed

Figure 2: Error while compiling

...

Recommended content