IGH主站在配置PDO的时候,PDO entry 0x7010:02 does not byte-align in config 0:0错误

下边是IGH的 mail list。大意就是使用ecrt_slave_config_reg_pdo_entry()来代替ecrt_slave_config_pdos()来进行注册。
Hi Christian!

Instead of passing the structs to ecrt_slave_config_pdos(), you can use 
ecrt_slave_config_reg_pdo_entry() to register each PDO individually. This 
function has an optional parameter to get the bit position. With this provided 
it won't complain about byte alignment.

It also seems to work to only register the first PDO entry, and you get access 
to the other entries that share the same byte. I think this is the way it is 
done in the digital IO examples.

Best regards,
Fabian Herb

Am Dienstag 23 März 2010 11:43:26 schrieb Richter, Christian:
> Hi,
>  
> I try configure an AnalogIO-Slave like in the User-example, but have
>  problems with the Input-configuration. When running application error
>  message "PDO entry 0x6000:02 does not byte-align in config 0:7.  PDO entry
>  registration failed!" occurs.
>  
> The mapping looks like this:
>  
>  const static ec_pdo_entry_reg_t domain1_regs[] = {
>              {AnaIO, Alex_1, 0x7010, 1, &off_ana_out1},
>              {AnaIO, Alex_1, 0x7010, 2, &off_ana_out2},
>              {AnaIO, Alex_1, 0x6000, 1, &off_ana_in1},
>              {AnaIO, Alex_1, 0x6000, 2, &off_ana_in2},
>              {AnaIO, Alex_1, 0x6000, 3, &off_ana_in3},
>              {AnaIO, Alex_1, 0x6000, 4, &off_ana_in4},
>              {AnaIO, Alex_1, 0x6000, 5, &off_ana_in5},
>              {AnaIO, Alex_1, 0x6000, 7, &off_ana_in7},
>              {AnaIO, Alex_1, 0x0000, 0, &off_ana_in0},
>              {AnaIO, Alex_1, 0x6000, 11, &off_ana_in11},
>              {AnaIO, Alex_1, 0x6000, 12, &off_ana_in12},
>              {AnaIO, Alex_1, 0x6000, 15, &off_ana_in15},
>              {AnaIO, Alex_1, 0x6000, 16, &off_ana_in16},
>              {AnaIO, Alex_1, 0x6000, 19, &off_ana_in19},
>              {AnaIO, Alex_1, 0x6000, 13, &off_ana_in13},
>              {AnaIO, Alex_1, 0x6000, 14, &off_ana_in14},
>              {}
>       };
>  
> static ec_pdo_entry_info_t alex_1_channels[] = {
>             {0x7010, 1, 16},
>             {0x7010, 2, 16}
>      };
> static ec_pdo_entry_info_t alex_in_channels[] = {
>              {0x6000, 1, 1},
>              {0x6000, 2, 1},
>              {0x6000, 3, 1},
>              {0x6000, 4, 1},
>              {0x6000, 5, 2},
>              {0x6000, 7, 2},
>              {0x0000, 0, 8},
>              {0x6000, 11, 32},
>              {0x6000, 12, 32},
>              {0x6000, 15, 16},
>              {0x6000, 16, 16},
>              {0x6000, 19, 16},
>              {0x6000, 13, 16},
>              {0x6000, 14, 16}
>      };
>  
> static ec_pdo_info_t alex_1_pdos[] = {
>             {0x1601, 2, alex_1_channels}
>    };
>     
> static ec_pdo_info_t alex_in_pdos[] = {
>             {0x1a00, 14, alex_in_channels}
>      };
>    
> static ec_sync_info_t alex_1_syncs[] = {
>             {2, EC_DIR_OUTPUT, 1, alex_1_pdos},
>             {3, EC_DIR_INPUT, 1, alex_in_pdos},
>             {0xff}
>      };
> 
> hope some one can help me to solve the "byte-align"-problem
>  
> best regards
> Christian Richter
> Christian Richter
> Forschung/Entwicklung
那么如何利用ecrt_slave_config_reg_pdo_entry来一个一个注册呢?

 

可以看到这个函数是如何使用的。

然后我截图我程序中的一部分。

 这样多次调用多次注册就好了。大概明白了吗。

之前工作有接触到Ethercat 并学习实践了IghMaster库,现在不做这方面工作了把代码开源出来,希望对大家有用。 代码使用Source Insight 3.5编辑的,用其它编辑器可能会出现乱码。 压缩包中包含了 1.基于Ighmaster 1.5.2驱动Sanyo,泰科伺服电机做力矩模式运动的代码。包含电机使能/禁止使能,设置运行模式,控制模式,发送力矩控制命令,读取力矩反馈等功能。基于SDO方式实现的代码。 2. 基于Ighmaster 1.5.2 驱动Et100 Io板代码,基于PDO,SDO方式的Io控制及温湿度读取 3. 测试例子包括了介于原生驱动接口ioctl方式控制码和基于libethercat库的驱动代码。具体见源代码。 文档目录结构及简要说明 0.Ethercat调试记录.txt 自己调试Ethercat过程中碰到的问题及解决办法 1. libethercat\std 目录 编译Igh生成的ethecat库 2. libethercat\include Igh Master Ethercat库包含的头文件 3. scripts/ 自动生成从站信息的相关脚本文件,要生成从站信息,将该文件夹复制到开发板运行GenerateSlavesConfig.sh。 默认生成ec_common_configs_define.h和ec_common_configs_define.c文件,这两个文件会在libethercat\ec_common\ecat_common.c,libethercat\ec_common\ecat_common.h相关接口使用。 4. libethercat\ec_common 4.0 ec_common_configs_define.h ec_common_configs_define.c 由脚本scripts/GenerateSlavesConfig.sh自动生成的从站信息,包括从站PDO,SDO设置等,更具体的可以参照scripts/README.txt 4.1 ecat_common.h ecat_common.c 基于ibethercat\std 中的库的二次封装库,简化了PDO,SDO等操作 4.2 ecat_common_intermediate_interface.h ecat_common_intermediate_interface.c 与具体厂商相关的接口库,基于ecat_common.c中接口的实现,不同设备修改这两个文件中的接口进行适配。 目前该文件实现的山羊电机接口。主要实现的PDO接口的电机状态查询,上电开机,关机,操作模式设置,力矩设置等接口,不同电机的类似接口可以参照该文件实现,接口作用见名知意。 封装接口的关键是对象字典的操作,根据手册设置对象字典即可,标准的Ethercat接口伺服电机一般来说对象字典定义基本是一样的,可能稍微有差别 5. 标准Igh Master接口的使用例子 mytest目录 mytest/test_torque_sanyo_ioctl 基于ioctl接口的sanyo电机测试例子 mytest/test_torque_tec_ioctl 基于ioctl接口的泰科电机电机测试例子 mytest/test_torque_tec_lib 基于libethercat\std库接口的电机测试例子 mytest/test_torque2 基于libethercat\std库接口的电机测试例子2 mytest/test_io_board ET1100,IO板的测试例子 基于标准的Igh 库及iotcl接口可以参照该文件夹例子 6.二次封装接口库ecat_common_intermediate_interface.c的使用说明 使用步骤 (1)将编译生成的Igh库文件替换libethercat\std文件, 文件名可能要改成,或者不该也行,自己写Makefile时匹配库名称就行 (2)将 scripts/ 目录复制到开发运行GenerateSlavesConfig.sh脚本,将脚本生成的ec_common_configs_define.h ec_common_configs_define.h 复制到libethercat\ec_common 文件夹 (3)基于二次封装接口的电机一般操作参照demo.c 参照demo.c中的ethercat_init() 进行从站初始化 初始化后就可以调用ecat_common_intermediate_interface.c中接口对从站进行操作 比如 interpolation_2_ecat_set_slave_pwr_on()接口使能电机, interpolation_2_ecat_set_slave_pwr_off() 关闭电机 interpolation_2_ecat_set_slave_target_pos() 设置目标位置,对应位置模式操作 其它接口作用见参照具体实现 7.关于轴操作的几点说明 (1)每个轴对应一个从站,由alias,position确定,一般来说从站不多时alias=0固定不变,对不同轴根据positon确定。 例如使能和关闭不同的轴 int interpolation_2_ecat_set_slave_pwr_on(MasterSpecifiedInfo_T *master_specified_info, int slave_pos); int interpolation_2_ecat_set_slave_pwr_off(MasterSpecifiedInfo_T *master_specified_info, int slave_pos); 中slave_pos参数就对应不同的轴,slave_pos=0,axis1 slave_pos=1,axis2... (2)设置不同轴的操作模式,位置,力矩,速度模式 可以参照这个接口 int interpolation_2_ecat_set_slave_operation_model(MasterSpecifiedInfo_T *master_specified_info, int slave_pos, unsigned char operation_model) 代码已经托管在云上,可以直接通过git下载: https://gitee.com/wllw7176/MyEthercat-IGH-1.5.2.git
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值