industrialNETworXnetx

jr

jr

| 14.02.2008 | 13:13 | 1 reply

EtherCAT: SDO Write problem

Hi,
in an EtherCAT example based upon rcX V1 i created an object

 eRslt = Od2_CreateSubObject(hObjDict, OD2_ALLOC_OBJMGMT, 
          0, 0x6040, 0, OD2_DIR_ALL,  
          ECAT_OD_WRITE_ALL|ECAT_OD_READ_ALL,  
          ECAT_OD_DTYPE_UNSIGNED16, 1, 0, 0, 0, &uZero);

and requested a write notification for that object:

  eRslt = TLR_QUE_IDENTIFY("ECAT_SDO_QUE",
      ptRsc->tLoc.uTskInst,&ptRsc->tRem.tLnkDstSdo);
  if(eRslt != TLR_S_OK) return eRslt;

eRslt = TLR_POOL_PACKET_GET(ptRsc->tLoc.hPool, &pvPck);
if(eRslt != TLR_S_OK) return eRslt;
ptPck = (EXAMPLE_APP_PACKET_T*)pvPck;

ptPck->tHead.ulCmd = ECAT_OD_NOTIFY_REGISTER_REQ;
ptPck->tHead.ulExt = 0;
ptPck->tHead.ulSrc = (TLR_UINT32)ptRsc->tLoc.hQue;
ptPck->tHead.ulLen = sizeof(ECAT_OD_NOTIFY_REGISTER_REQ_DATA_T);
ptPck->tOdNotifyReq.tData.usIndex = 0x6040;
ptPck->tOdNotifyReq.tData.fReadNotify = TLR_FALSE;
ptPck->tOdNotifyReq.tData.fWriteNotify = TLR_TRUE;
eRslt = TLR_QUE_SENDPACKET_FIFO(ptRsc->tRem.tLnkDstSdo,
ptPck, TLR_INFINITE);

The same code does not work with the EtherCAT example based on rcX V2. When i try to write the object via TwinCAT System Manager, the SDO request is rejected with "general fault". When the write notification request is removed, SDO access is successful.

code- small

code- small

Hilscher Gesellschaft für Systemautomation mbH

| 14.02.2008 | 13:39

Hi jr,

the version used in newer examples has several improvements in the Od mechanism handling which allow to interact fully with the SDO transfer. The packet send has to be answered correctly with a packet containing a valid ulSta.

However, since you are on the same system, you do not have to register the write notification via packet. The other possible way is to access the object dictionary directly which provides callbacks for those notifications.

In addition, the new scheme contains timeouts for the answer to be expected, if that is not done on time the SDO download will be answered
with an SDO abort.
There are no such timeouts within the callback interface provided by the object dictionary itself.

Greets

code-small

Login