r2k-in-the-vortex / ethercat_src

9 stars 8 forks source link

configure: error: No configured Linux kernel sources in /usr/src/rpi-kernel #4

Open bbking78 opened 11 months ago

bbking78 commented 11 months ago

Hi,

I am trying to follow your installation manual, but I get the error when running the line with ./configure --sysconfdir=/etc --enable-8139too=no

checking for Linux kernel sources...
configure: error: No configured Linux kernel sources in /usr/src/rpi-kernel

so I followed this: https://www.raspberrypi.com/documentation/computers/linux_kernel.html but I cannot configure the kernel because I get:

pi@raspberrypi:/usr/src/rpi-kernel $ sudo make ARCH=arm bcmrpi_defconfig
Makefile:686: scripts/Makefile.compiler: No such file or directory
make: *** No rule to make target 'scripts/Makefile.compiler'.  Stop.

how did you make the igh configure file work?

r2k-in-the-vortex commented 11 months ago

ARCH=arm bcmrpi_defconfig

Are you quite sure about those options? Those would be for 32bit arm and ten year old pi hardware. Also I don't think you need to specify ARCH for native compile, that is for when you are cross-compiling. Pick the right option for your install: https://www.raspberrypi.com/documentation/computers/linux_kernel.html#kernel-configuration

Also, at the very end of this instruction you have, there is an option to just install the headers, that might work, maybe https://www.raspberrypi.com/documentation/computers/linux_kernel.html#kernel-headers

bbking78 commented 11 months ago

Hi, thanks for the answer - Yes, I am sure, I use a RPI1B. It's quite old, but ther performance is OK for my first tests. I think installing the headers did help, now I was able to compile and install everything without errors! Thanks so much for your work!!!

I just have two questions: 1) your docs say "Now OpenPLC can be started, on startup OpenPLC will print out (also in web ide) the pdos - input / output variables it has on ethercat" - I don't see those messages, although EtherCAT is running with EK1100+EKL2969 (16ch. DO):

pi@raspberrypi:~ $ sudo ethercat master
Master0
  Phase: Idle
  Active: no
  Slaves: 2
  Ethernet devices:
    Main: b8:27:eb:0b:e3:ef (attached)
      Link: UP
      Tx frames:   16169
      Tx bytes:    1137436
      Rx frames:   16168
      Rx bytes:    1137376
      Tx errors:   0
      Tx frame rate [1/s]:     50     50     51
      Tx rate [KByte/s]:      2.9    2.9    3.0
      Rx frame rate [1/s]:     50     50     51
      Rx rate [KByte/s]:      2.9    2.9    3.0
    Common:
      Tx frames:   35457
      Tx bytes:    2461996
      Rx frames:   35456
      Rx bytes:    2461936
      Lost frames: 0
      Tx frame rate [1/s]:     50     50     51
      Tx rate [KByte/s]:      2.9    2.9    3.0
      Rx frame rate [1/s]:     50     50     51
      Rx rate [KByte/s]:      2.9    2.9    3.0
      Loss rate [1/s]:          0     -0      0
      Frame loss [%]:         0.0   -0.0    0.0
  Distributed clocks:
    Reference clock:   Slave 0
    DC reference time: 0
    Application time:  0
                       2000-01-01 00:00:00.000000000

I did a sudo ethercat xml > /home/pi/ECAT/OpenPLC_v3/utils/ethercat_src/conf/master_config.xml

(there is no OpenPLC_v3/utils/ethercat_src/build/ethercat.cfg in my tree, the directory build is missing)

so, I thougth I just try to use %QX0.0 for the first output but nothing happens (while EtherCAT is running correctly).

I have to admit, that I had a version without EtherCAT installed of OpenPLC_v3 before, but after re-installing your branch it seems to work correctly:

pi@raspberrypi:~/ECAT/OpenPLC_v3 $ ps ax|grep openplc
  340 ?        Ss     0:00 /bin/bash /home/pi/ECAT/OpenPLC_v3/start_openplc.sh
 1147 pts/0    S+     0:00 grep --color=auto openplc

(/home/pi/ECAT/OpenPLC_v3/ is the correct directory)

2) so how would openPLC know that %QX0.0 belongs to EtherCAT and not, lets say Modbus? this is my startup log:

OpenPLC Runtime starting... Skipping configuration of Slave Devices (mbconfig.cfg file not found) Warning: Persistent Storage file not found Interactive Server: Listening on port 43628 Issued start_modbus() command to start on port: 502 Server: Listening on port 502 Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued stop_pstorage() command Thanks a lot!

r2k-in-the-vortex commented 11 months ago

Hi

When you install OpenPLC, you have to do so by specifying ethercat option:

./install.sh linux ethercat

That will also make the missing build directory. And start printing out it's configured ethercat variables. Just run the install again if you have previously done so with different options.

As for the addresses such as %QX0.0 etc, for ethercat variables it just auto assigns them incrementing from zero. During startup it prints out the addresses it has assigned for what, e.g.

Slave0_Channel_1 AT %IX0.0 : BOOL; (* EK1814 EtherCAT-EA-Koppler (1A E-Bus, 4 K. Dig. Ein, 3ms, 4 K. *)

And you just have to use those addresses it prints out in your PLC program.

Currently EtherCAT is coded so it just starts from zero and increments however many variables it has in it's configuration. So I guess if modbus also needs to be used at the same time then modbus has to be configured to not overlap this range, I don't know if there is an easy way to do this.

Currently there is no configuration to shift the ethercat address range to start from something else than zero.

The successful installation with ethercat included should be concluding like so:

Activating Blank driver
Setting Platform
Optimizing ST program...
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Including EtherCAT
Compiling for Linux
Generating object files...
Generating glueVars...
Compiling main program...
Compilation finished successfully!

Specifically note the line that says: Including EtherCAT If it doesn't say that then OpenPLC will be completely unaware of anything about ethercat.

Let me know how it goes

bbking78 commented 11 months ago

Ok, that's strange, because I did a ./install.sh rpi ethercat the second time when I installed it from your repo....

is there a way to completly purge the openPLC install and start from scratch? Or another way of installing your openPLC version over the first installation?

bbking78 commented 11 months ago

could you do a uname -a for me please? I am wondering if you have the PREEMPT-RT kernel running...because I don't

r2k-in-the-vortex commented 10 months ago

Hey, sorry for delayed answer, were away for a few days.

I'm afraid it has to be ./install.sh linux ethercat even on an rpi, because the rpi section in background_installer.sh script has not been updated and the rpi hardware layer hasn't really been checked vs the ethercat module. Just run the command again, no need to start from scratch.