• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting example cifxlinuxsample.c on Raspberry Pi
Hello everybody,

at the moment I test the Hilscher NetHat for a Ethercad solution in my Masterthesis.
First I test the getting started documentation on the version V1.0.0.1

My Problem ist, that I can´t start the testprogramm cifxlinuxsample.c on the Raspberry Pi
The compiler publish a fatal error. The data cifxlinux.h can´t be find.

In the download I can find the cifXEndianess.h Data but not the cifxlinux.h.

Can everybody help me? What I am doing wrong.

Hi Christian,

the documentation on page 11 says that you have to install the driver package on your target system as well. This package installs the library and missing header files next to the driver in the installation folder


If you later compile the example yourself you have to tell the compiler the location of the header files where to search them. So a command line with GNU compiler could look like

gcc cifxlinuxsample.c -o cifxlinuxsample -I/usr/include/cifx -lcifx

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Hello Armin,

thanks for your quick answer. I could solve the problem and after you had explain it, it was logical.

But now I have the next Problem. Can you help me in this case too?
At first I have to say that I am a bloody newcomer in the Topics Ethercad and Twincad-control.

Now I have installed the netHAT on twincad.
When I run on Twincad the Free Run mode, there will come the following failures on Twincad:

Fehler        02.12.2019 17:19:20 328 ms | 'Box 1 (NXHAT52-RTE/ECS)' (1001): 'PREOP to SAFEOP' failed! Error: 'check device state for SAFEOP'. AL Status '0x0012' read and '0x0004' expected. AL Status Code '0x8000' 

Fehler        02.12.2019 17:19:20 328 ms | 'Box 1 (NXHAT52-RTE/ECS)' (1001): state change aborted (requested 'SAFEOP', back to 'PREOP'). 

Additionally the LEDs on the netHAT indicated the following:
LED No.5 ist blinking red (singleflash) and the LED No. 6 ist blinking green (2.5Hz)

When I test the access to the netHAT with

cd /opt/cifx/demo/


sudo ./nethatdemo

the Programm is running until the message "Start read/write IO-Data!" are showing. But after approx. 20 seconds there will come the failure “error


When I run the 

sudo ./cifxsample

there will come the message "Waiting for Bus communication!" several times.

For Information: the SPI-Interface is activated in the raspberry configuration.

Have you an Idea what Im doing wrong?

Thanks a lot

I would search in the "Getting Starting" PDF document for the error 0x8000C021.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

For me it is totally new to "configure" any EtherCAT device in Twincat in general.

I know EtherCAT as a network system that is auto-scanning for all connected devices. There is nothing to configure. All is read from the connected devices automatically during the scan.

To me it seems again you have not carefully read the "Getting Started" document and how to configure a Twincat master.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)


Possibly Related Threads...
Thread Author Replies Views Last Post
  Raspberry Pi + NetHat_Kommunikation über OPC UA Whatzittoya13 1 93 December-11th-2018, 10:59 AM
Last Post: Simon@netHAT

Forum Jump:

Users browsing this thread: 2 Guest(s)