industrialNETworXnetx

laurence_yu

laurence_yu

| 26.03.2010 | 05:24 | 1 reply

How to add a new Object in Ethernet/IP stack and send a UCMM to it?

Hi,

We now have a netStick and want to test the "EIP_OBJECT_MR_REGISTER_REQ" command with a pursose of adding a new object into EIP_OBJECT process and test the UCMM message.

To achieve this, we created a queue, named "OBJECT_QUE" in one task and assignm a handle named "hObjectQue", as:

  eRslt = TLR_QUE_CREATE("OBJECT_QUE", 32,  &ptRsc->tLoc.hObjectQue)

At the same time, we identify this queue in  "EIPDemo" task of the demo, using codes as:

 TLR_QUE_IDENTIFY_INTERN("OBJECT_QUE", ptRsc->tLoc.uTskInst, &ptRsc->tRem.hObjectQue)

and then cosntruct a MR_REGISTER_REQ packet and sent it out as:

ptPck->tMrRegisterReq.tHead.ulCmd = EIP_OBJECT_MR_REGISTER_REQ;
ptPck->tMrRegisterReq.tHead.ulSrc = (UINT32)ptRsc->tLoc.hQue;
ptPck->tMrRegisterReq.tHead.ulSrcId = 0;
ptPck->tMrRegisterReq.tHead.ulSta = 0;
ptPck->tMrRegisterReq.tHead.ulLen = EIP_OBJECT_MR_REGISTER_REQ_SIZE;
ptPck->tMrRegisterReq.tData.hObjectQue = ptRsc->tRem. hObjectQue;ptPck->tMrRegisterReq.tData.ulClass = 0xC9;

TLR_QUE_SENDPACKET_FIFO_INTERN(ptRsc->tRem.hEipObjectQue, &ptPck->tMrRegisterReq, 0);

After these coding, we run the program and want to send a UCMM to this new object (class 0xC9). We once thought the message would be sent to "ptRsc->tRem. hObjectQue" and trigger the remote task to run. So we added the codes in this task's "TaskProcess",as:  

TLR_HANDLE  hQue  = ptRsc->tLoc.hObjectQue;

....

 

do {

      eRslt = TLR_QUE_WAITFORPACKET(hQue, &pvPck, TLR_INFINITE);

      if(TLR_S_OK != eRslt)

      {       continue;    }

   .......

}while(1);

But as a result, no packet will be sent to this "ptRsc->tLoc.hObjectQu". That is to say, "TLR_QUE_WAITFORPACKET" didn't return any packet.
Please help me on this problem and give me some advices about sending UCMM message to a new object created by users. If there's any tutorials on message mechanism about the message router, Identity Object, Assembly Object etc. within the linkable Ethernet/IP module, it will be of great help for me to develop ourselves' application objects.
Thank you very much in advance!
Best regards,
Laurence

 

 

laurence_yu

laurence_yu

| 26.03.2010 | 07:54

Wow, I suddenly notice a statement in the Ethernet/IP Adapter protocol for netx, that says:

"The source queue is directly bound the new object. All indication for the new object are send to the 

ulSrc and ulSrcId of the request packet"

So I change the ulSrc to point to the task queue which is regarded as the new object. Then the UCMM sent to the new object is routed to this queue!

This problem is solved!

Login