synapticon / etherlab_ethercat_master Goto Github PK
View Code? Open in Web Editor NEWClone of IgH EtherCAT Master with additional Vectioneer patches.
License: GNU Lesser General Public License v2.1
Clone of IgH EtherCAT Master with additional Vectioneer patches.
License: GNU Lesser General Public License v2.1
the code below can not controll the INOVANCE IS620N and panasonic Minas A6B,can someone help me?
/*****************************************************************************
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/mman.h>
/****************************************************************************/
#include "ecrt.h"
/****************************************************************************/
#define SERVO_STAT_SWION_DIS 0x250 /switched on disabled/
#define SERVO_STAT_RDY_SWION 0x231 /ready to switch on/
#define SERVO_STAT_SWION_ENA 0x233 /switch on enabled/
#define SERVO_STAT_OP_ENA 0x237 /operation enable/
#define SERVO_STAT_ERROR 0x218 /error/
/Application Parameters/
#define TASK_FREQUENCY 100 /Hz/
#define TIMOUT_CLEAR_ERROR (1TASK_FREQUENCY) /clearing error timeout/
#define TARGET_VELOCITY 10241024 //8388608 /target velocity/
#define PROFILE_VELOCITY 3 /Operation mode for 0x6060:0/
/*****************************************************************************/
/EtherCAT/
static ec_master_t *master = NULL;
static ec_master_state_t master_state = {};
static ec_domain_t *domain1 = NULL;
static ec_domain_state_t domain1_state = {};
static ec_slave_config_t *sc_IS620N;
static ec_slave_config_state_t sc_IS620N_state = {};
/****************************************************************************/
/Process Data/
static uint8_t *domain1_pd = NULL;
#define IS620NSlavePos 0,0 /EtherCAT address on the bus/
#define INOVANCE_IS620N 0x00100000, 0x000C0108 /IS620N Vendor ID, product code/
/x86_64: char-1byte,int-4bytes,long-8bytes/
struct IS620N_offset {
//RxPDO
unsigned int control_word; //0x6040:控制字,subindex:0,bitlen:16
unsigned int target_position;//0x607A:目标位置,subindex:0,bitlen:32
unsigned int touch_probe; //0x60B8:探针,subindex:0,bitlen:16
unsigned int pysical_outputs;//0x60FE:pysical_outputs,subindex:1,bitlen:32
unsigned int target_velocity;//0x60FF:target_velocity,subindex:0,bitlen:32
unsigned int target_torque;//0x6071:int target_torque,subindex:0,bitlen:16
unsigned int modes_operation;//0x6060:Modes of operation,subindex:0,bitlen:8
unsigned int max_profile_velocity;//0x607F:max_profile_velocity,subindex:0,bitlen:32
unsigned int positive_torque_limit_value;//0x60E0:positive_torque_limit_value,subindex:0,bitlen:16
unsigned int negative_torque_limit_value;//0x60E1:negaitive_torque_limit_value,subindex:0,bitlen:16
unsigned int torque_offset;//0x60B2:torque offset,subindex:0,bitlen:16
//TxPDo
unsigned int status_word;//0x6041:status_word,subindex:0,bitlen:16
unsigned int position_actual_value;//0x6064:position_actual_value,subindex:0,bitlen:32
unsigned int touch_probe_status;//0x60B9,subindex:0,bitlen:16
unsigned int touch_probe_pos1_pos_value;//0x60BA,subindex:0,bitlen:32
unsigned int touch_probe_pos2_pos_value;//0x60BC ,subindex:0,bitlen:32
unsigned int error_code;//0x603F,subindex:0,bitlen:16
unsigned int digital_inputs;//0x60FD,subindex:0,bitlen:32
unsigned int torque_actual_value;//0x6077,subindex:0,bitlen:16
unsigned int following_error_actual_value;//0x60F4,subindex:0,bitlen:32
unsigned int modes_of_operation_display;//0x6061,subindex:0,bitlen:8
unsigned int velocity_actual_value;//0x606C,subindex:0,bitlen:32
};
static struct IS620N_offset offset;
const static ec_pdo_entry_reg_t domain1_regs[] = {
//RxPDO
{IS620NSlavePos, INOVANCE_IS620N, 0x6040, 0, &offset.control_word},
{IS620NSlavePos, INOVANCE_IS620N, 0x607A, 0, &offset.target_position},
{IS620NSlavePos, INOVANCE_IS620N, 0x60FF, 0, &offset.target_velocity},
{IS620NSlavePos, INOVANCE_IS620N, 0x6071, 0, &offset.target_torque},
{IS620NSlavePos, INOVANCE_IS620N, 0x6060, 0, &offset.modes_operation},
{IS620NSlavePos, INOVANCE_IS620N, 0x60B8, 0, &offset.touch_probe},
{IS620NSlavePos, INOVANCE_IS620N, 0x607F, 0, &offset.max_profile_velocity},
//TxPDO
{IS620NSlavePos, INOVANCE_IS620N, 0x603F, 0, &offset.error_code},
{IS620NSlavePos, INOVANCE_IS620N, 0x6041, 0, &offset.status_word},
{IS620NSlavePos, INOVANCE_IS620N, 0x6064, 0, &offset.position_actual_value},
{IS620NSlavePos, INOVANCE_IS620N, 0x6077, 0, &offset.torque_actual_value},
{IS620NSlavePos, INOVANCE_IS620N, 0x6061, 0, &offset.modes_of_operation_display},
{IS620NSlavePos, INOVANCE_IS620N, 0x60B9, 0, &offset.touch_probe_status},
{IS620NSlavePos, INOVANCE_IS620N, 0x60BA, 0, &offset.touch_probe_pos1_pos_value},
{IS620NSlavePos, INOVANCE_IS620N, 0x60BC, 0, &offset.touch_probe_pos2_pos_value},
{IS620NSlavePos, INOVANCE_IS620N, 0x60FD, 0, &offset.digital_inputs},
{}
};
static unsigned int counter = 0;
//static int state = -500;
/重新映射PDO才需要定义下面这3个数组,如果使用servo的固定映射则不需要/
/Config PDOs/
static ec_pdo_entry_info_t IS620N_pdo_entries[] = {
//RxPdo 0x1702
{0x6040, 0x00, 16},
{0x607A, 0x00, 32},
{0x60FF, 0x00, 32},
{0x6071, 0x00, 16},
{0x6060, 0x00, 8},
{0x60B8, 0x00, 16},
{0x607F, 0x00, 32},
//TxPdo 0x1B02
{0x603F, 0x00, 16},
{0x6041, 0x00, 16},
{0x6064, 0x00, 32},
{0x6077, 0x00, 16},
{0x6061, 0x00, 8},
{0x60B9, 0x00, 16},
{0x60BA, 0x00, 32},
{0x60BC, 0x00, 32},
{0x60FD, 0x00, 32},
};
static ec_pdo_info_t IS620N_pdos[] = {
//RxPdo
//{0x1600, 3, IS620N_pdo_entries + 0 },
{0x1600, 7, IS620N_pdo_entries + 0 },
//TxPdo
//{0x1A00, 8, IS620N_pdo_entries + 3 }
{0x1A00, 9, IS620N_pdo_entries + 7 }
};
static ec_sync_info_t IS620N_syncs[] = {
{ 0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE },
{ 1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE },
{ 2, EC_DIR_OUTPUT, 1, IS620N_pdos + 0, EC_WD_DISABLE },
{ 3, EC_DIR_INPUT, 1, IS620N_pdos + 1, EC_WD_DISABLE },
{ 0xFF}
};
/*************************************************************************/
void check_domain1_state(void)
{
ec_domain_state_t ds;
ecrt_domain_state(domain1, &ds);
if (ds.working_counter != domain1_state.working_counter)
printf("Domain1: WC %u.\n", ds.working_counter);
if (ds.wc_state != domain1_state.wc_state)
printf("Domain1: State %u.\n", ds.wc_state);
domain1_state = ds;
}
void check_master_state(void)
{
ec_master_state_t ms;
ecrt_master_state(master, &ms);
if (ms.slaves_responding != master_state.slaves_responding)
printf("%u slave(s).\n", ms.slaves_responding);
if (ms.al_states != master_state.al_states)
printf("AL states: 0x%02X.\n", ms.al_states);
if (ms.link_up != master_state.link_up)
printf("Link is %s.\n", ms.link_up ? "up" : "down");
master_state = ms;
}
/*****************************************************************************/
void check_slave_config_states(void)
{
ec_slave_config_state_t s;
ecrt_slave_config_state(sc_IS620N, &s);
if (s.al_state != sc_IS620N_state.al_state)
printf("IS620N: State 0x%02X.\n", s.al_state);
if (s.online != sc_IS620N_state.online)
printf("IS620N: %s.\n", s.online ? "online" : "offline");
if (s.operational != sc_IS620N_state.operational)
printf("IS620N: %soperational.\n", s.operational ? "" : "Not ");
sc_IS620N_state = s;
}
/*******************************************************************************/
void cyclic_task()
{
static unsigned int timeout_error = 0;
static uint16_t status_mask=0x004F;
static int32_t target_velocity = TARGET_VELOCITY;
uint16_t status;
int8_t opmode;
int32_t current_velocity;
//int32_t command_value;
/*Receive process data*/
ecrt_master_receive(master);
ecrt_domain_process(domain1);
/*Check process data state(optional)*/
check_domain1_state();
counter = TASK_FREQUENCY;
//Check for master state
check_master_state();
//Check for slave configuration state(s)
check_slave_config_states();
/*Read inputs*/
status = EC_READ_U16(domain1_pd + offset.status_word);
opmode = EC_READ_U8(domain1_pd + offset.modes_of_operation_display);
current_velocity = EC_READ_S32(domain1_pd + offset.velocity_actual_value);
/*if((status & 0x4F) == 0x00) {
printf("status:%d\n",status);//statusWord = SANYO_NOT_READY_TO_SWITCH_ON;
}
else if((status & 0x4F) == 0x08) {
printf("status:%d\n",status);//statusWord = SANYO_FAULT;
}
else if((status & 0x4F) == 0x40) {
printf("status:%d\n",status);//statusWord = SANYO_SWITCH_ON_DISABLED;
}
else if((status & 0x6F) == 0x27) {
printf("status:%d\n",status);//statusWord = SANYO_OPERATION_ENABLED;
}
else if((status & 0x6F) == 0x23) {
printf("status:%d\n",status);//statusWord = SANYO_SWITCH_ON_ENABLED;
}
else if((status & 0x6F) == 0x21) {
printf("status:%d\n",status);//statusWord = SANYO_READY_TO_SWITCH_ON;
}
else if((status & 0x6F) == 0x07) {
printf("status:%d\n",status);//statusWord = SANYO_QUICK_STOP_ACTIVE;
}
else if((status & 0x4F) == 0x0F) {
printf("status:%d\n",status);//statusWord = SANYO_FAULT_REACTION_ACTIVE;
}
else {
printf("i status:%d\n",status);//return 0xFFFF;
}*/
/*EC_WRITE_U16(domain1_pd + offset.control_word, 0x0006);
EC_WRITE_S8(domain1_pd + offset.modes_operation, PROFILE_VELOCITY);
EC_WRITE_U16(domain1_pd + offset.control_word, 0x0007);//接通主回路电
EC_WRITE_U16(domain1_pd + offset.control_word, 0x000f);//伺服运转
EC_WRITE_S32(domain1_pd + offset.target_velocity, target_velocity);
EC_WRITE_U16(domain1_pd + offset.control_word, 0x001f);//伺服运行*/
//DS402 CANOpen over EtherCAT status machine
if((status & status_mask)==0x0040) //status must equal to SERVO_STAT_SWION_DIS
{
EC_WRITE_U16(domain1_pd + offset.control_word, 0x0006 );
EC_WRITE_S8(domain1_pd + offset.modes_operation, PROFILE_VELOCITY);
status_mask=0x6f;
printf("status:0x%x\n",status);
}
else if((status & status_mask) == 0x0021) //status must equal to SERVO_STAT_RDY_SWION
{
EC_WRITE_U16(domain1_pd + offset.control_word, 0x0007 );
status_mask=0x6f;
printf("status:0x%x\n",status);
}
else if((status & status_mask) == 0x0023) //status must equal to SERVO_STAT_SWION_ENA
{
EC_WRITE_U16(domain1_pd + offset.control_word, 0x000f );
EC_WRITE_S32(domain1_pd + offset.target_velocity, target_velocity);
status_mask=0x6f;
printf("status:0x%x\n",status);
}
//operation enabled
else if((status & status_mask) ==0x0027) //status must equal to SERVO_STAT_OP_ENA
{
EC_WRITE_U16(domain1_pd + offset.control_word, 0x001f);
printf("status:0x%x\n",status);
}
/*Send process data*/
ecrt_domain_queue(domain1);
ecrt_master_send(master);
}
/****************************************************************************/
int main(int argc, char **argv)
{
master = ecrt_request_master(0);
if (!master)
exit(EXIT_FAILURE);
domain1 = ecrt_master_create_domain(master);
if (!domain1)
exit(EXIT_FAILURE);
if (!(sc_IS620N = ecrt_master_slave_config(master, IS620NSlavePos, INOVANCE_IS620N)))
{
fprintf(stderr, "Failed to get slave configuration for IS620N!\n");
exit(EXIT_FAILURE);
}
/*设置0x1702为RPDO*/
/*if(ecrt_slave_config_sdo8(sc_IS620N,0x1c12,0,0)) printf("failed to configure slave sdo 0x1c12-00:0x00!\n");
if(ecrt_slave_config_sdo16(sc_IS620N,0x1c12,1,0x1702)) printf("failed to configure slave sdo 0x1c12-01:0x1702!\n");
if(ecrt_slave_config_sdo8(sc_IS620N,0x1c12,0,0x01)) printf("failed to configure slave sdo 0x1c12-00:0x01!\n");*/
/*设置0x1B02为TPDO*/
/*if(ecrt_slave_config_sdo8(sc_IS620N,0x1c13,0,0)) printf("failed to configure slave sdo 0x1c13-00:0x00!\n");
if(ecrt_slave_config_sdo16(sc_IS620N,0x1c13,1,0x1B02)) printf("failed to configure slave sdo 0x1c13-01:0x1B02!\n");
if(ecrt_slave_config_sdo8(sc_IS620N,0x1c13,0,0x01)) printf("failed to configure slave sdo 0x1c13-00:0x01!\n");*/
// printf("alias=%d,vid=%d,watchdog_divider=%d",sc_IS620N->alias,sc_IS620N->position,sc_IS620N->watchdog_divider);
printf("Configuring PDOs...\n");
/*重新映射PDO才需要运行ecrt_slave_config_pdos(),如果使用servo的固定映射则不需要*/
if (ecrt_slave_config_pdos(sc_IS620N, EC_END, IS620N_syncs))
{
fprintf(stderr, "Failed to configure IS620N PDOs!\n");
exit(EXIT_FAILURE);
}
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs))
{
fprintf(stderr, "PDO entry registration failed!\n");
exit(EXIT_FAILURE);
}
printf("Activating master...\n");
if (ecrt_master_activate(master))
exit(EXIT_FAILURE);
else
printf("Master activated\n");
if (!(domain1_pd = ecrt_domain_data(domain1)))
exit(EXIT_FAILURE);
printf("It's working now...\n");
/*if(ecrt_slave_config_sdo8(sc_IS620N,0x6060,0,8))
printf("fail to configure slave sdo velocity mode!\n");*/
/*EC_WRITE_U16(domain1_pd + offset.control_word, 0x0006);
EC_WRITE_S8(domain1_pd + offset.modes_operation, PROFILE_VELOCITY);
EC_WRITE_U16(domain1_pd + offset.control_word, 0x0007);//接通主回路电
EC_WRITE_U16(domain1_pd + offset.control_word, 0x000f);//伺服运转
EC_WRITE_S32(domain1_pd + offset.target_velocity, TARGET_VELOCITY);
EC_WRITE_U16(domain1_pd + offset.control_word, 0x001f);//伺服运行*/
/if(ecrt_slave_config_sdo32(sc_IS620N,0x60FF,0,TARGET_VELOCITY)) printf("fail to configure slave sdo 0x60FF!\n");
if(ecrt_slave_config_sdo16(sc_IS620N,0x6040,0,0x6)) printf("fail to configure slave sdo 0x6040!\n");
if(ecrt_slave_config_sdo16(sc_IS620N,0x6040,0,0x7)) printf("fail to configure slave sdo 0x6040!\n");
if(ecrt_slave_config_sdo16(sc_IS620N,0x6040,0,0xf)) printf("fail to configure slave sdo 0x6040!\n");/
while (1)
{
usleep(100000/TASK_FREQUENCY);
cyclic_task();
}
ecrt_master_deactivate(master);
return EXIT_SUCCESS;
}
Built as per instructions
lib tool commonly has a problem with whitespace. Ensured there where no whitespace in the directory paths. Built with both the install script and manually.
Error
/bin/bash ../libtool --tag=CC --mode=link gcc --std=c99 -I../include -Iinclude -g -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -g -O2 -static -L.libs -L../lib/.libs -lethercat_wrapper -lethercat -o testlib src/testlib-testlib.o
../libtool: line 7577: cd: .libs: No such file or directory
libtool: error: cannot determine absolute directory name of '.libs'
I encountered issue when building on a system with 16 cores.
When reaching libethercat_wrapper folder, it sometimes fail. It seems compilation of a test requiring "libethercat_wrapper.la" is started while it has not yet been compiled.
When continuing the build after this failure, it works properly. There's something wrong in the generated Makefile right now.
One way to go around the problem is to make using make -j1
, where in this case it does not happen.
| Making all in libethercat_wrapper
| make[2]: Entering directory '/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/git/libethercat_wrapper'
| ../x86_64-poky-linux-libtool --tag=CC --mode=compile x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -Iinclude --std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DVERSIONING=@LIBETHERCAT_WRAPPERVERSION@ -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -c -o src/libethercat_wrapper_la-slave.lo `test -f 'src/slave.c' || echo './'`src/slave.c
| ../x86_64-poky-linux-libtool --tag=CC --mode=compile x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -Iinclude --std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DVERSIONING=@LIBETHERCAT_WRAPPERVERSION@ -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -c -o src/libethercat_wrapper_la-ethercat_wrapper.lo `test -f 'src/ethercat_wrapper.c' || echo './'`src/ethercat_wrapper.c
| x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I.. --std=c99 -I../include -Iinclude -g -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -c -o src/testlib-testlib.o `test -f 'src/testlib.c' || echo './'`src/testlib.c
| In file included from /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/sys/time.h:21:0,
| from include/commons.h:13,
| from src/testlib.c:35:
| /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
| # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| ^~~~~~~
| x86_64-poky-linux-libtool: compile: x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -Iinclude --std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DVERSIONING=@LIBETHERCAT_WRAPPERVERSION@ -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -c src/slave.c -fPIC -DPIC -o src/.libs/libethercat_wrapper_la-slave.o
| x86_64-poky-linux-libtool: compile: x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -Iinclude --std=c99 -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DVERSIONING=@LIBETHERCAT_WRAPPERVERSION@ -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -c src/ethercat_wrapper.c -fPIC -DPIC -o src/.libs/libethercat_wrapper_la-ethercat_wrapper.o
| In file included from /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/bits/libc-header-start.h:33:0,
| from /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/stdlib.h:25,
| from ../include/ecrt.h:128,
| from include/ethercat_wrapper_slave.h:14,
| from include/slave.h:10,
| from src/slave.c:9:
| /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
| # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| ^~~~~~~
| In file included from /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/bits/libc-header-start.h:33:0,
| from /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/stdlib.h:25,
| from ../include/ecrt.h:128,
| from include/ethercat_wrapper_slave.h:14,
| from include/ethercat_wrapper.h:12,
| from src/ethercat_wrapper.c:5:
| /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot/usr/include/features.h:184:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
| # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| ^~~~~~~
| ../x86_64-poky-linux-libtool --tag=CC --mode=link x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot --std=c99 -I../include -Iinclude -g -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -static -L.libs -L../lib/.libs -L. -lethercat_wrapper -lethercat -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o testlib src/testlib-testlib.o
| x86_64-poky-linux-libtool: link: x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot --std=c99 -I../include -Iinclude -g -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0=/usr/src/debug/etherlab-ethercat-master/1.0-r0 -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o testlib src/testlib-testlib.o -L.libs -L../lib/.libs -L. -lethercat_wrapper /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/git/lib/.libs/libethercat.so
| /home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/7.3.0/ld: cannot find -lethercat_wrapper
| collect2: error: ld returned 1 exit status
| Makefile:483: recipe for target 'testlib' failed
| make[2]: *** [testlib] Error 1
| make[2]: *** Waiting for unfinished jobs....
| make[2]: Leaving directory '/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/git/libethercat_wrapper'
| Makefile:509: recipe for target 'all-recursive' failed
| make[1]: *** [all-recursive] Error 1
| make[1]: Leaving directory '/home/build/data/tmp/work/qemux86_64-poky-linux/etherlab-ethercat-master/1.0-r0/git'
| Makefile:435: recipe for target 'all' failed
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
Hi,
I tried to install Etherlab_EtherCAT_Master on my Ubuntu 18.04.6 (kernel version: Linux 5.4.0-120-generic).
It doesn't compile. Reading some documentation in the web, I found that the last release works on older kernel versions (like Ubuntu 16.04).
Are there available version for Ubuntu 18.04 and Ubuntu 20.* ? If there aren't, someone is going to develop them?
Thank you
The operating system is Ubuntu 20.04. After cloning this repository, I configured IgH Etherlab according to the INSTALL file.
When it comes to "make all modules", an error message appears:
/bin/bash ../libtool --tag=CC --mode=link gcc --std=c99 -I../include -Iinclude -g -D_XOPEN_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -g -O2 -static -L.libs -L../lib/.libs -lethercat_wrapper -lethercat -o testlib src/testlib-testlib.o
../libtool: line 7577: cd: .libs: No such file or directory
libtool: error: cannot determine absolute directory name of '.libs'
make[2]: *** [Makefile:492: testlib] Error 1
make[2]: Leaving directory '/home/azurec/Etherlab_EtherCAT_Master/libethercat_wrapper'
make[1]: *** [Makefile:514: all-recursive] Error 1
make[1]: Leaving directory '/home/azurec/Etherlab_EtherCAT_Master'
make: *** [Makefile:440: all] Error 2
I checked the version of libtool, made sure it was correct, and "make all modules" again, but it didn't work.
Please note: this code produces the following warning at compile time:
devices/generic.c: In function ‘ec_gen_device_create_socket’:
devices/generic.c:218:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaratio
n-after-statement]
struct net *nd_net = dev_net(dev->netdev);
^
The Master want to read a SDO which not exist.
I think the problem occoures because the slave have no TxPdos.
My System:
Debian without Desktop and the RT Preempt Kernel from the paket manager.
4.9.0-8-rt-amd64 #1 SMP PREEMPT RT Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
The Ethercat Configuration from the Commandline tool:
0 0:0 PREOP + EK1814 EtherCAT-EA-Koppler (1A E-Bus, 4 K. Dig. Ein, 3ms, 4 K.
1 0:1 PREOP + EL3161 1K.Ana. Eingang 0-10V
2 0:2 PREOP + EL2535 2K. Pulsweiten Strom Ausgang (24V, 1 A)
3 0:3 PREOP + EL4001 1Ch. Ana. Output 0-10V, 12bit
4 0:4 PREOP + EL9510 Netzteilklemme 10V
5 0:5 PREOP + EL3356-0010 1K . Ana. Eingang, Widerstandsbr▒cke, 24bit, hochge
The Error from the Kernel log file
Jan 10 08:14:29 Ethermax kernel: [ 5.103529] ec_master: loading out-of-tree module taints kernel.
Jan 10 08:14:29 Ethermax kernel: [ 5.112188] EtherCAT: Master driver 1.5.2-sncn-5 v1.5.2-sncn-4-10-gefbf251
Jan 10 08:14:29 Ethermax kernel: [ 5.112635] EtherCAT: 1 master waiting for devices.
Jan 10 08:14:29 Ethermax kernel: [ 5.120527] ec_generic: EtherCAT master generic Ethernet device module 1.5.2-sncn-5 v1.5.2-sncn-4-10-gefbf251
Jan 10 08:14:29 Ethermax kernel: [ 5.120548] EtherCAT: Accepting E0:D5:5E:E8:A8:9B as main device for master 0.
Jan 10 08:14:29 Ethermax kernel: [ 5.120564] ec_generic: Binding socket to interface 3 (enp4s0).
Jan 10 08:14:29 Ethermax kernel: [ 5.147299] EtherCAT 0: Starting EtherCAT-IDLE thread.
Jan 10 08:14:30 Ethermax kernel: [ 5.827747] [drm] RC6 on
Jan 10 08:14:30 Ethermax kernel: [ 6.213126] r8169 0000:04:00.0 enp4s0: link up
Jan 10 08:14:30 Ethermax kernel: [ 6.213150] IPv6: ADDRCONF(NETDEV_CHANGE): enp4s0: link becomes ready
Jan 10 08:14:30 Ethermax kernel: [ 6.215193] EtherCAT 0: Link state of ecm0 changed to UP.
Jan 10 08:14:30 Ethermax kernel: [ 6.223466] EtherCAT 0: 6 slave(s) responding on main device.
Jan 10 08:14:30 Ethermax kernel: [ 6.223507] EtherCAT 0: Slave states on main device: PREOP.
Jan 10 08:14:30 Ethermax kernel: [ 6.223817] EtherCAT 0: Scanning bus.
Jan 10 08:14:30 Ethermax kernel: [ 6.293915] random: crng init done
Jan 10 08:14:30 Ethermax kernel: [ 6.293918] random: 7 urandom warning(s) missed due to ratelimiting
Jan 10 08:14:30 Ethermax kernel: [ 6.763568] EtherCAT ERROR 0-3: SDO upload 0x1C13:01 aborted.
Jan 10 08:14:30 Ethermax kernel: [ 6.763635] EtherCAT ERROR 0-3: SDO abort message 0x06090011: "Subindex does not exist".
Jan 10 08:14:30 Ethermax kernel: [ 6.763689] EtherCAT ERROR 0-3: Failed to read index of assigned PDO 1 from SM3.
Jan 10 08:14:31 Ethermax kernel: [ 7.093650] EtherCAT 0: Bus scanning completed in 868 ms.
Jan 10 08:14:31 Ethermax kernel: [ 7.093653] EtherCAT 0: Using slave 0 as DC reference clock.
Jan 10 08:14:31 Ethermax kernel: [ 7.104660] r8169 0000:03:00.0 enp3s0: link up
With the Commandline tool I see that the SDO not exist.
0x1c00:02, r-r-r-, uint8, 8 bit, "SubIndex 002"
0x1c00:03, r-r-r-, uint8, 8 bit, "SubIndex 003"
0x1c00:04, r-r-r-, uint8, 8 bit, "SubIndex 004"
SDO 0x1c12, "RxPDO assign"
0x1c12:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c12:01, r-r-r-, uint16, 16 bit, "SubIndex 001"
SDO 0x1c32, "SM output parameter"
0x1c32:00, r-r-r-, uint8, 8 bit, "SubIndex 000"
0x1c32:01, rwrwrw, uint16, 16 bit, "Sync mode"
0x1c32:02, rwrwrw, uint32, 32 bit, "Cycle time"
Had anyone the same problem and know how to fix it?
Thanks in advance
Steffen
Trying to run "make modules":
/usr/local/etherlab/src/Etherlab_EtherCAT_Master/master/module.c:43:10: fatal error: gitlog.h: No such file or directory
#include "gitlog.h"
Did I miss something in the INSTALL? I ran:
./bootstrap
./configure --prefix=/usr/local/etherlab --disable-8139too --disable-e1000e --enable-generic
make
make modules
I'm curious to understand why reading a SDO takes 25ms in operation mode whereas with the SOEM stack it takes only 2ms.
Do you have some experiences with this? Is this timing behavior caused by a bad configuration?
Here is my context:
Current Makefile:
ethercatMasterVersion:=1.5.2
ethercatMasterZip:=ethercat-$(ethercatMasterVersion).tar.bz2
fix:
ethercatMasterVersion:=1.5.2-sncn-3
ethercatMasterZip:=ethercat-$(ethercatMasterVersion).tar.bz2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.