[etherlab-users] Beckhoff AX5201
Jun Yuan
j.yuan at rtleaders.com
Fri Oct 26 12:27:57 CEST 2012
Hallo Maggie,
I don't think the design of the function ecrt_domain_reg_pdo_entry_list()
takes PDO entries with identical index&subindex but different PDO index
into consideration. Because normally it doesnot happen.
Although we can modify this function to take PDO index as an additional
parameter, there is a much easier way for your application with AX5201,
without changing the etherlab code.
There is a trick, when you register the first pdo entry into the domain,
this domain already contains the complete pdo data of the corresponding
sync manager. All you need to do is to calculate the correct offset by
yourself to access the other pdo entries in the same sync manager.
i.e. when you register the first pdo entry "{0x0086, 0x00, 16}, /* Master
control word */" into a domain, you get the offset_ctrl1 for the first pdo
entry. Then the offset for the second pdo entry is :
offset_vel1 = offset_ctrl + the size of "Master control word" =
offset_ctrl1 + 2;
The offset for the third pdo entry, the second "Master control word" is :
offset_ctr2 = offset_vel1 + the size of "Velocity command value" =
offset_vel1 + 4 = offset_ctrl1 + 6;
Of course, then you can do the same thing to AT "Drive status word", just
notice that they(AT) are in another sync manager. So you'll need to
register the first "Drive status word" into a domain to get the offset
begin for that.
With these offsets, you can modify your cyclic data as usual.
P.S. ecrt_master_write_idn() is not for use in cycle.
Regards,
Jun Yuan
On Tue, Oct 23, 2012 at 9:24 AM, Min Yang <yang.min at sibonac.com> wrote:
> Hello all,
>
> I am using Beckhoff AX5201(2 channel servo drive), the cstruct is:
>
> #/opt/etherlab/bin/ethercat cstruct -p1
> ec_pdo_entry_info_t slave_1_pdo_entries[] = {
> {0x0086, 0x00, 16}, /* Master control word */
> {0x0024, 0x00, 32}, /* Velocity command value */
> {0x0086, 0x00, 16}, /* Master control word */
> {0x0024, 0x00, 32}, /* Velocity command value */
> {0x0087, 0x00, 16}, /* Drive status word */
> {0x0033, 0x00, 32}, /* Position feedback 1 value */
> {0x0087, 0x00, 16}, /* Drive status word */
> {0x0033, 0x00, 32}, /* Position feedback 1 value */
> };
> ec_pdo_info_t slave_1_pdos[] = {
> {0x0018, 2, slave_1_pdo_entries + 0}, /* MDT 1 */
> {0x1018, 2, slave_1_pdo_entries + 2}, /* MDT 2 */
> {0x0010, 2, slave_1_pdo_entries + 4}, /* AT 1 */
> {0x1010, 2, slave_1_pdo_entries + 6}, /* AT 2 */
> };
> 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, 2, slave_1_pdos + 0, EC_WD_DISABLE},
> {3, EC_DIR_INPUT, 2, slave_1_pdos + 2, EC_WD_DISABLE},
> {0xff}
> };
>
> I need to write "Master control word "of 2 channels in cycle(because 1
> channel controls 1 servo). But their pdo entries is the same, if
> I register both of them to domain with ecrt_slave_config_reg_pdo_entry(),
> how to distinguish them?
> I also try to write them like this:
> ecrt_master_write_idn(master, 0, 0, 0x86, pdata0, 2, error_code); //for
> channel 1 drive_no=0
> ecrt_master_write_idn(master, 0, 1, 0x86, pdata0, 2, error_code); //for
> channel 2 drive_no=1
> but when I put them in cycle, I got an error "Failed to write
> IDN:Iput/output error", then the drive stayed in INIT. Why I got this
> error? What's the best solution for my problem?
>
> Best Regards
> Maggie
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>
>
--
Jun Yuan
[Aussprache: Djün Üän]
Robotics Technology Leaders GmbH
Am Loferfeld 58, D-81249 München
Tel: +49 89 189 0465 24
Mobile: +49 176 2176 5238
Fax: +49 89 189 0465 11
mailto: j.yuan at rtleaders.com
Umlautregel in der chinesischen Lautschrift Pinyin: Nach den Anlauten y, j,
q, und x wird u als ü ausgesprochen, z.B. yu => ü, ju => dschü, qu =>
tschü, xu => schü.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20121026/5739b23e/attachment-0004.htm>
More information about the Etherlab-users
mailing list