Ethercat HAL driver

More
12 years 5 months ago #47194 by narogon
Replied by narogon on topic Ethercat HAL driver
Could you post your xml file to check if there is something different from mine?
More
12 years 5 months ago - 12 years 5 months ago #47195 by willrat
Replied by willrat on topic Ethercat HAL driver
We used that same module on a working machine for a customer;
The config was like this;
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1"> <slave idx="0" type="EK1100"/> <!-- modded the source to use the 12 bit module --> <slave idx="1" type="EL3062"/> <slave idx="2" type="EL4032"/> <slave idx="3" type="EL1018"/> <slave idx="4" type="EL1018"/> <slave idx="5" type="EL2008"/> <slave idx="6" type="EL2024"/> </master>

We added the EL3062 into the source if anyone is interested. Can probably be implemented with the generic driver anyway(?)
Last edit: 12 years 5 months ago by willrat.
More
12 years 5 months ago #47196 by narogon
Replied by narogon on topic Ethercat HAL driver
I've solved it using the generic type, but i would appreciated if anyone could discover why doesn't work using ELxxxx :S
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="10"> <slave idx="0" type="EK1100" /> <slave idx="1" type="generic" vid="00000002" pid="03F63052" configPdos="true"> <syncManager idx="0" dir="in"> <pdo idx="1A00"> <pdoEntry idx="3101" subIdx="01" bitLen="1" halPin="entrada1" halType="bit"/> </pdo> <pdo idx="1A01"> <pdoEntry idx="3101" subIdx="02" bitLen="1" halPin="entrada2" halType="bit"/> </pdo> <pdo idx="1A02"> <pdoEntry idx="3101" subIdx="03" bitLen="1" halPin="entrada3" halType="bit"/> </pdo> <pdo idx="1A03"> <pdoEntry idx="3101" subIdx="04" bitLen="1" halPin="entrada4" halType="bit"/> </pdo> </syncManager> </slave> </master>
More
12 years 4 months ago #48258 by javiergr
Replied by javiergr on topic Ethercat HAL driver
Hello, I am transform the EL2004 files to EP2338 box for compiling it but no posible, how I must configure this 2 files for get lcec_ep2338.o and use me box for pulse-direction control?

Best regards

lcec_el2xxx.h

//
// Copyright (C) 2011 Sascha Ittner <sascha.ittner@modusoft.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//

#include "lcec.h"
#include "lcec_el2xxx.h"

typedef struct {
hal_bit_t *out;
hal_bit_t invert;
unsigned int pdo_os;
unsigned int pdo_bp;
} lcec_el2xxx_pin_t;

void lcec_el2xxx_write(struct lcec_slave *slave, long period);

int lcec_el2xxx_init(int comp_id, struct lcec_slave *slave, ec_pdo_entry_reg_t *pdo_entry_regs) {
lcec_master_t *master = slave->master;
lcec_el2xxx_pin_t *hal_data;
lcec_el2xxx_pin_t *pin;
int i;
int err;

// initialize callbacks
slave->proc_write = lcec_el2xxx_write;

// alloc hal memory
if ((hal_data = hal_malloc(sizeof(lcec_el2xxx_pin_t) * slave->pdo_entry_count)) == NULL) {
rtapi_print_msg(RTAPI_MSG_ERR, LCEC_MSG_PFX "hal_malloc() for slave %s.%s failed\n", master->name, slave->name);
return -EIO;
}
memset(hal_data, 0, sizeof(lcec_el2xxx_pin_t) * slave->pdo_entry_count);
slave->hal_data = hal_data;

// initialize pins
for (i=0, pin=hal_data; i<slave->pdo_entry_count; i++, pin++) {
// initialize POD entry
LCEC_PDO_INIT(pdo_entry_regs, slave->index, slave->vid, slave->pid, 0x7000 + (i << 4), 0x01, &pin->pdo_os, &pin->pdo_bp);

// export pins
if ((err = hal_pin_bit_newf(HAL_IN, &(pin->out), comp_id, "%s.%s.%s.dout-%d", LCEC_MODULE_NAME, master->name, slave->name, i)) != 0) {
rtapi_print_msg(RTAPI_MSG_ERR, LCEC_MSG_PFX "exporting pin %s.%s.%s.dout-%02d failed\n", LCEC_MODULE_NAME, master->name, slave->name, i);
return err;
}
if ((err = hal_param_bit_newf(HAL_RW, &(pin->invert), comp_id, "%s.%s.%s.dout-%d-invert", LCEC_MODULE_NAME, master->name, slave->name, i)) != 0) {
rtapi_print_msg(RTAPI_MSG_ERR, LCEC_MSG_PFX "exporting pin %s.%s.%s.dout-%02d-invert failed\n", LCEC_MODULE_NAME, master->name, slave->name, i);
return err;
}

// initialize pins
*(pin->out) = 0;
pin->invert = 0;
}

return 0;
}

void lcec_el2xxx_write(struct lcec_slave *slave, long period) {
lcec_master_t *master = slave->master;
lcec_el2xxx_pin_t *hal_data = (lcec_el2xxx_pin_t *) slave->hal_data;
uint8_t *pd = master->process_data;
lcec_el2xxx_pin_t *pin;
int i, s;

// set outputs
for (i=0, pin=hal_data; i<slave->pdo_entry_count; i++, pin++) {
s = *(pin->out);
if (pin->invert) {
s = !s;
}
EC_WRITE_BIT(&pd[pin->pdo_os], pin->pdo_bp, s);
}
}



lcec_el2xxx.h


//
// Copyright (C) 2011 Sascha Ittner <sascha.ittner@modusoft.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef _LCEC_EL2XXX_H_
#define _LCEC_EL2XXX_H_

#include "lcec.h"

#define LCEC_EL2xxx_VID LCEC_BECKHOFF_VID

#define LCEC_EL2002_PID 0x07D23052
#define LCEC_EL2004_PID 0x07D43052
#define LCEC_EL2008_PID 0x07D83052
#define LCEC_EL2022_PID 0x07E63052
#define LCEC_EL2024_PID 0x07E83052
#define LCEC_EL2032_PID 0x07F03052
#define LCEC_EL2034_PID 0x07F23052
#define LCEC_EL2042_PID 0x07FA3052
#define LCEC_EL2084_PID 0x08243052
#define LCEC_EL2088_PID 0x08283052
#define LCEC_EL2124_PID 0x084C3052
#define LCEC_EL2808_PID 0x0AF83052
#define LCEC_EL2809_PID 0x0AF93052

#define LCEC_EL2002_PDOS 2
#define LCEC_EL2004_PDOS 4
#define LCEC_EL2008_PDOS 8
#define LCEC_EL2022_PDOS 2
#define LCEC_EL2024_PDOS 4
#define LCEC_EL2032_PDOS 2
#define LCEC_EL2034_PDOS 4
#define LCEC_EL2042_PDOS 2
#define LCEC_EL2084_PDOS 4
#define LCEC_EL2088_PDOS 8
#define LCEC_EL2124_PDOS 4
#define LCEC_EL2808_PDOS 8
#define LCEC_EL2809_PDOS 16

int lcec_el2xxx_init(int comp_id, struct lcec_slave *slave, ec_pdo_entry_reg_t *pdo_entry_regs);

#endif
The following user(s) said Thank You: Nico2017
More
12 years 4 months ago #48260 by narogon
Replied by narogon on topic Ethercat HAL driver
Why don't you use the generic one?

You describe your EP2338 in the xml file and type=generic.
More
12 years 3 months ago #48649 by lincnc
Replied by lincnc on topic Ethercat HAL driver
Hi everybody,

I would like to ask for help running LinuxCNC with Sascha's EtherCAT HAL driver using AX5xxx servo drives from Beckhoff.

Here is Beckhoff's xml drive description file:

File Attachment:

File Name: BeckhoffAX5xxx.xml
File Size:799 KB


My drive is AX5201-0000-0200, but that model is missing in the xml file, so I use the info for AX5201-0000-0203, assuming it's approximately the same.

Here is my configuration file:

File Attachment:

File Name: ethercat_config_n.xml
File Size:1 KB


I must mention that there isn't any watchdog information in Beckhoff's xml file so I used some logical values.

The problem is that whenever I plug the ethernet cable in the drive's ethercat input, the drive display indicates that there is an error named "F581".
Here is the official Beckhoff's description about this error.

I can properly start the drive in TwinCAT and I can see the "Startup" IDN values that TwinCAT is writing to the drive, so I write the same IDN values to the drive with "ethercat soe_write" command, but still no success. The drive display continue to blink and indicate the "F581" error.

Do you have any ideas?
Any help would be appreciated.
Thank you.
Attachments:
Time to create page: 0.877 seconds
Powered by Kunena Forum