[Etherlab-users] ecrt_sdo_request_state : error
BUSSIERES Vincent
vincent.bussieres at hemeria-group.com
Sun Oct 24 21:54:47 CEST 2021
Dear Etherlab users,
I use a Beckhoff module EL5102 (2 channels encoder interface) and two servodrives to control motors.
I develop a homing sequence as below :
1- Enable counter reset on channel 1 when index encoder is encountered
2- Move axis 1 until index is encoutered
3- Unable counter reset on channel 1
4- Enable counter reset on channel 2 when index encoder is encountered
5- Move axis 2 until index is encoutered
6- Unable counter reset on channel 2
Unabling and disabling counter reset is done using SDOs 0x80n0:01 where n is the channel number.
In my program, I create 2 SDO requests with « ecrt_slave_config_create_sdo_request » before changing master state in OP with « ecrt_master_activate ».
Then, before entering in cyclic task, I write SDOs for the first time and I get « EC_REQUEST_UNUSED » SDO request state (trigger first write), it seems to be OK.
void enableIndexResetCh_n(state)
{
switch (ecrt_sdo_request_state(mReqIndexResetCh_n)) {
case EC_REQUEST_UNUSED:
ecrt_sdo_request_write(mReqIndexResetCh_n);
break;
case EC_REQUEST_BUSY:
break;
case EC_REQUEST_SUCCESS:
EC_WRITE_U8(ecrt_sdo_request_data(mReqIndexResetCh1), static_cast<uint8_t>(state));
ecrt_sdo_request_write(mReqIndexResetCh_n);
break;
default:
ecrt_sdo_request_write(mReqIndexResetCh_n);
break;
}
break;
}
Then, I realize homing sequence in the cyclic task as described before.
For the fisrt channel, I write « 1 » into SDO 0x8000:01, request state is « EC_REQUEST_SUCCES » but for the second channel 0x8010:02 I get « EC_REQUEST_ERROR » and SDO value remains at false state.
I don’t understand why I get this error.
Moreover I want to let you know that I don’t call « ecrt_sdo_request_write » at each loop of cyclic task but only when I need to change sdo state. Perhaps this is not the right way to call this function. Do I have to call this function at each iteration ?
How can I be sure that sdo state corresponds to the right state ? Do I have to read sdo state (if sdo is R/W) also at each iteration ?
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20211024/01c07666/attachment.htm>
More information about the Etherlab-users
mailing list