lcec_conf: ERROR: couldn't allocate user/RT shared memory

More
13 Oct 2023 07:27 #282872 by MakerYang
I encountered a problem when using EtherCAT.

ERROR:
root@armcnc:~/linuxcnc/script# sudo -u armcnc linuxcnc /opt/armcnc/configs/ethercat_xyz/machine.ini
LINUXCNC - 2.9.0~pre1+git20230208.f1270d6ed7
Machine configuration directory is '/opt/armcnc/configs/ethercat_xyz'
Machine configuration file is 'machine.ini'
Starting LinuxCNC...
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./machine.hal
creating ladder-state
rtapi_shmem_new failed due to shmget(key=0xacb572c7): Permission denied
lcec_conf: ERROR: couldn't allocate user/RT shared memory
./machine.hal:12: waitpid failed lcec_conf lcec_conf
./machine.hal:12: lcec_conf exited without becoming ready
Shutting down and cleaning up LinuxCNC...
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/armcnc/linuxcnc_debug.txt
and
    /home/armcnc/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
Linux armcnc 4.14.87 #5 SMP PREEMPT RT Wed Sep 13 15:15:26 CST 2023 aarch64 GNU/Linux
root@armcnc:~/linuxcnc/script# ethercat master
Master0
  Phase: Idle
  Active: no
  Slaves: 3
  Ethernet devices:
    Main: 00:11:22:f2:b2:95 (attached)
      Link: UP
      Tx frames:   17582
      Tx bytes:    1074888
      Rx frames:   17581
      Rx bytes:    1074828
      Tx errors:   0
      Tx frame rate [1/s]:    125    125    114
      Tx rate [KByte/s]:      7.3    7.3    6.7
      Rx frame rate [1/s]:    125    125    114
      Rx rate [KByte/s]:      7.3    7.3    6.7
    Common:
      Tx frames:   17582
      Tx bytes:    1074888
      Rx frames:   17581
      Rx bytes:    1074828
      Lost frames: 0
      Tx frame rate [1/s]:    125    125    114
      Tx rate [KByte/s]:      7.3    7.3    6.7
      Rx frame rate [1/s]:    125    125    114
      Rx rate [KByte/s]:      7.3    7.3    6.7
      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
root@armcnc:~/linuxcnc/script# ethercat slaves
0  0:0  PREOP  +  ECR60(COE)
1  0:1  PREOP  +  ECR60(COE)
2  0:2  PREOP  +  ECR60(COE)
root@armcnc:~/linuxcnc/script# ethercat cstruct
/* Master 0, Slave 0, "ECR60"
 * Vendor ID:       0x00000a88
 * Product code:    0x0a880001
 * Revision number: 0x00000202
 */

ec_pdo_entry_info_t slave_0_pdo_entries[] = {
    {0x6040, 0x00, 16}, /* Control Word */
    {0x6060, 0x00, 8}, /* ModeOfOperation */
    {0x607a, 0x00, 32}, /* Profile Target Position */
    {0x6041, 0x00, 16}, /* Status Word */
    {0x6061, 0x00, 8}, /* Modes of Operation display */
    {0x6064, 0x00, 32}, /* Position Actual Value */
    {0x60fd, 0x00, 32}, /* Digital Inputs */
};

ec_pdo_info_t slave_0_pdos[] = {
    {0x1600, 3, slave_0_pdo_entries + 0}, /* Receive PDO 1 */
    {0x1a00, 4, slave_0_pdo_entries + 3}, /* Transmit PDO 1 */
};

ec_sync_info_t slave_0_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 1, slave_0_pdos + 1, EC_WD_DISABLE},
    {0xff}
};

/* Master 0, Slave 1, "ECR60"
 * Vendor ID:       0x00000a88
 * Product code:    0x0a880001
 * Revision number: 0x00000202
 */

ec_pdo_entry_info_t slave_1_pdo_entries[] = {
    {0x6040, 0x00, 16}, /* Control Word */
    {0x6060, 0x00, 8}, /* ModeOfOperation */
    {0x607a, 0x00, 32}, /* Profile Target Position */
    {0x6041, 0x00, 16}, /* Status Word */
    {0x6061, 0x00, 8}, /* Modes of Operation display */
    {0x6064, 0x00, 32}, /* Position Actual Value */
    {0x60fd, 0x00, 32}, /* Digital Inputs */
};

ec_pdo_info_t slave_1_pdos[] = {
    {0x1600, 3, slave_1_pdo_entries + 0}, /* Receive PDO 1 */
    {0x1a00, 4, slave_1_pdo_entries + 3}, /* Transmit PDO 1 */
};

ec_sync_info_t slave_1_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 1, slave_1_pdos + 0, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 1, slave_1_pdos + 1, EC_WD_DISABLE},
    {0xff}
};

/* Master 0, Slave 2, "ECR60"
 * Vendor ID:       0x00000a88
 * Product code:    0x0a880001
 * Revision number: 0x00000202
 */

ec_pdo_entry_info_t slave_2_pdo_entries[] = {
    {0x6040, 0x00, 16}, /* Control Word */
    {0x6060, 0x00, 8}, /* ModeOfOperation */
    {0x607a, 0x00, 32}, /* Profile Target Position */
    {0x6041, 0x00, 16}, /* Status Word */
    {0x6061, 0x00, 8}, /* Modes of Operation display */
    {0x6064, 0x00, 32}, /* Position Actual Value */
    {0x60fd, 0x00, 32}, /* Digital Inputs */
};

ec_pdo_info_t slave_2_pdos[] = {
    {0x1600, 3, slave_2_pdo_entries + 0}, /* Receive PDO 1 */
    {0x1a00, 4, slave_2_pdo_entries + 3}, /* Transmit PDO 1 */
};

ec_sync_info_t slave_2_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 1, slave_2_pdos + 0, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 1, slave_2_pdos + 1, EC_WD_DISABLE},
    {0xff}
};


 
Attachments:

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 08:01 #282873 by MakerYang
I tried restarting the device and found that the error message has changed.
root@armcnc:~# sudo -u armcnc linuxcnc /opt/armcnc/configs/ethercat_xyz/machine.ini
LINUXCNC - 2.9.0~pre1+git20230208.f1270d6ed7
Machine configuration directory is '/opt/armcnc/configs/ethercat_xyz'
Machine configuration file is 'machine.ini'
Starting LinuxCNC...
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./machine.hal
creating ladder-state
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefined symbol: ecrt_slave_config_sdo
./machine.hal:14: waitpid failed /usr/bin/rtapi_app lcec
./machine.hal:14: /usr/bin/rtapi_app exited without becoming ready
./machine.hal:14: insmod for lcec failed, returned -1
Shutting down and cleaning up LinuxCNC...
INFO CLASSICLADDER-   No ladder GUI requested-Realtime runs till HAL closes.
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/armcnc/linuxcnc_debug.txt
and
    /home/armcnc/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 09:05 #282877 by MakerYang
I have consulted some references and learned about this old script, which can solve the above problem.

realtime.mk

github.com/abausano/linuxcnc-ethercat/tree/master

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 09:51 #282878 by rodw
A couple of things
1. This repo of mine should compile and create a deb file of the linuxcnc-ethercat driver.
github.com/rodw-au/linuxcnc-ethercat
I had a bit of help here from one of the ethercat developers.
I did this so I could package it for AMD64 and host it. Then the repositories are preinstalled in my installer in the installing linuxcnc section here (as a sticky). forum.linuxcnc.org/9-installing-linuxcnc...or-linuxcnc-x86-only

I have thought of building it for the pi4 and hosting it too.
It should compile on ARM, Please let me now if it does.

2. The ethercat guys now have a repository and support the Raspberry Pi, Please open the spoilers for details here
forum.linuxcnc.org/ethercat/45336-etherc...-how-to-step-by-step 



 
The following user(s) said Thank You: MakerYang

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 10:46 #282884 by MakerYang
I am trying to build a deb based on github.com/rodw-au/linuxcnc-ethercat. I will notify you if it works. However, the chip on my development board is not quite the same as the Raspberry Pi, but it should be usable.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 10:55 #282885 by MakerYang
I have successfully built the DEB files based on github.com/rodw-au/linuxcnc-ethercat, resulting in two DEB files. Do I need to install them both?
drwxr-xr-x  7 root root   4096 Oct 13 18:52 linuxcnc-ethercat
-rw-r--r--  1 root root  15714 Oct 13 18:53 linuxcnc-ethercat_0.9.4_arm64.buildinfo
-rw-r--r--  1 root root   2926 Oct 13 18:53 linuxcnc-ethercat_0.9.4_arm64.changes
-rw-r--r--  1 root root  63936 Oct 13 18:53 linuxcnc-ethercat_0.9.4_arm64.deb
-rw-r--r--  1 root root    679 Oct 13 18:52 linuxcnc-ethercat_0.9.4.dsc
-rw-r--r--  1 root root  95408 Oct 13 18:52 linuxcnc-ethercat_0.9.4.tar.xz
-rw-r--r--  1 root root 159592 Oct 13 18:53 linuxcnc-ethercat-dbgsym_0.9.4_arm64.deb

Please Log in or Create an account to join the conversation.

More
13 Oct 2023 12:03 #282888 by MakerYang
I have placed the two compiled deb files at mirrors.geekros.com/pool/main/focal/. They are linuxcnc-ethercat-dbgsym_0.9.4_arm64.deb and linuxcnc-ethercat_0.9.4_arm64.deb. You can directly download them and migrate to your own software repository if needed.

I haven't tested it on the Raspberry Pi yet. Below is the information of my current device, which in theory should be universally compatible.
root@armcnc:~# uname -a
Linux armcnc 4.14.87 #5 SMP PREEMPT RT Wed Sep 13 15:15:26 CST 2023 aarch64 GNU/Linux
root@armcnc:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
14 Oct 2023 09:13 - 14 Oct 2023 09:15 #282969 by bkt
I see your dmesg ..... you are sure your xml is right? .... because I obtain same error in same situation where xml is not clear ... like a lot of comment .... seems parser not able to show all error and exception so show something   .... that is real better than show nothing .... after these good luck with your installation and work.... but take my worlds only like a warning messages ... i'm not an expert.
Last edit: 14 Oct 2023 09:15 by bkt.

Please Log in or Create an account to join the conversation.

More
14 Oct 2023 10:35 #282978 by rodw
Great work!
this deb: linuxcnc-ethercat-dbgsym_0.9.4_arm64.deb
contains the debug symbols so its not required for normal operation.

Please Log in or Create an account to join the conversation.

More
14 Oct 2023 10:41 #282980 by MakerYang
I have resolved this issue. It was a mismatch between the configuration in the XML file and the EtherCat being used. I reviewed the product manual and have successfully run it on both the XZ and XYZ models. However, I still find the relationship between these configurations not very clear, so I need to continue learning and experimenting. I have placed the relevant configurations in the repository at

github.com/armcnc/linuxcnc/tree/main/debian/opt/armcnc/configs

I'm not entirely sure if there is any documentation in the LinuxCNC documentation regarding HAL and XML configurations related to EtherCat. It could be that I'm not very accustomed to the LinuxCNC documentation, which might have caused me to overlook them.

Please Log in or Create an account to join the conversation.

Time to create page: 0.181 seconds
Powered by Kunena Forum