industrialNETworXnetx

jr

jr

| 25.02.2008 | 13:07 | 22 replies

PROFINET IO-Device: Cyclic Data Exchange

Hi,
i am using the limited version of the PNIO Stack (libpns_netx500_ltd.a). The first command issued by the rcX application task is a WARMSTART_REQ. The request is confirmed, and i am able to assign StationName and IP address via DCP. The CONNECT request is also confirmed, and everything is fine until my application receives a PNS_IF_PARAM_END_IND. In the wireshark trace, i see a cyclic frame sent by netX followed by a cyclic frame sent by the IO-Controller. Then, the netX IO-device transmits an ERR_RTA_PDU with errorCode=0xcf (RTA_ERROR), errorCode1 = RTA_ERR_CLS_PROTOCOL, ErrorCode2=0x10 (AR device deactivated), and cyclic exchange stops.
What is the reason for this behaviour?
Do i have to start cyclic transmission explicitely by means of a PNS_IF_PACKET_START_STOP_COMM_REQ_T?
In PNS_IF_PUBLIC.h, i found the Request data type, but there is no define for the corresponding ulCmd.

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 28.02.2008 | 20:24

i am not that familiar with this stack but i will try to help.
some questions:

what does your application do with the PNS_IF_PARAM_END_IND?
do you return it to the stack immediately?

how much time lies between the first cyclic frame and the ERR_RTA_PDU ?

as far as i know you do not need to send a packet of type PNS_IF_PACKET_START_STOP_COMM_REQ_T to the stack.

jr

jr

| 29.02.2008 | 09:24

Hi bm,
i will try to provide more information.
I just chekc the information contained in the PNS_IF_PARAM_END_IND (Slot/Subslot/DeviceHandle) and then return the message immediately.
From CONNECT Response to the ERR_RTA_PDU, there are about 90 ms. The number of cyclic frames in that time interval depends upon the cycle time, i. e. for cycle time >= 128 ms, there is no cyclic frame.

Internally, the application receives an ABORT INDICATION with reasonCode 0x10 (protocol violation).

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 29.02.2008 | 16:28

okay, that information missed in your first post.

that is a normal behaviour if you use the warmstart message.

you should see in your wireshark trace that shortly after the ABORT INDICATION in your application the connection will be established again.

jr

jr

| 29.02.2008 | 16:33

Hi bm,
thanks for the hint. I do not see any reestablishing of the connection in the wirkeshark trace. Do you mean that if the IO-Controller issues another CONNECT Request, the IO-Device will enter normal cyclic exchange?

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 29.02.2008 | 16:50

yes. if the IO-Controller issues the next Connect Request the IO-Device will answer correctly and enter cyclic data exchange

jr

jr

| 01.03.2008 | 14:59

Hi bm,
unfortunately the second CONNECT Request is rejected by the IO-Device (errorCode=0xdb (IODConnectRes), errorDecode=0x81 (PNIO), errorCode1=0x40 (RMPM), errorCode2=4 (Out of AR Resources) ).

I didn't find a request to free AR resources after an ABORT IND.
Is there any documentation of the behaviour related to the warmstart message?

jr

jr

| 02.03.2008 | 15:01

Hi,
i also tried to bypass the warmstart req with the following startup sequence:

1. PNS_IF_CFG_SET_DEVICEINFO_REQ.
The Request is confirmed with ulSta = 0x00000000
2. PNS_IF_REGISTER_AP_REQ.
The Request is also confirmed with ulSta = 0x00000000
3. PNS_IF_CFG_OPEN_DEVICE_REQ.
Also confirmed with ulSta = 0x00000000
4. PNS_IF_GET_DEVICE_HANDLE_REQ.
Here, i get a response with ulSta = 0xC0300009 (no device instance open)

As such, i am also stuck with this approach because the subsequent messages i indended to use (PNS_IF_CFG_ADD_API_REQ, PNS_IF_CFG_PLUG_MODULE_REQ, PNS_IF_CFG_PLUG_SUBMODULE_REQ) require the device handle.

What's wrong with the above sequence?

| 04.03.2008 | 16:49

jr wrote:
Hi bm,
unfortunately the second CONNECT Request is rejected by the IO-Device (errorCode=0xdb (IODConnectRes), errorDecode=0x81 (PNIO), errorCode1=0x40 (RMPM), errorCode2=4 (Out of AR Resources) ).

I didn't find a request to free AR resources after an ABORT IND.
Is there any documentation of the behaviour related to the warmstart message?

hi jr,

the error code that you receive is a standard answer of the device if the establishing of communication is not allowed. Try sending the PNS_IF_PACKET_START_STOP_COMM_REQ_T packet.

The steps to start the device(also per warm start message) are described in
PROFINET IO RT Device Protocol API.doc/pdf
and in
netX DPM Interface.doc/pdf
There is no detailed description of the stack behavior in case of configuring per warmstart message.

| 04.03.2008 | 16:55

jr wrote:
Hi,
i also tried to bypass the warmstart req with the following startup sequence:

1. PNS_IF_CFG_SET_DEVICEINFO_REQ.
The Request is confirmed with ulSta = 0x00000000
2. PNS_IF_REGISTER_AP_REQ.
The Request is also confirmed with ulSta = 0x00000000
3. PNS_IF_CFG_OPEN_DEVICE_REQ.
Also confirmed with ulSta = 0x00000000
4. PNS_IF_GET_DEVICE_HANDLE_REQ.
Here, i get a response with ulSta = 0xC0300009 (no device instance open)

As such, i am also stuck with this approach because the subsequent messages i indended to use (PNS_IF_CFG_ADD_API_REQ, PNS_IF_CFG_PLUG_MODULE_REQ, PNS_IF_CFG_PLUG_SUBMODULE_REQ) require the device handle.

What's wrong with the above sequence?

The complete sequence of requests can be found in an Example task for the PNS stack.
PNS_IF_CFG_ADD_API_REQ, PNS_IF_CFG_PLUG_MODULE_REQ, PNS_IF_CFG_PLUG_SUBMODULE_REQ - the documentation says that the handle is not required for these requests.

jr

jr

| 04.03.2008 | 18:03

Hi ks,
thanks for your hints. Believe me, i searched the manuals you mentioned many times for startup sequences, but in vain. I also tried the START COMMUNICATION message. In PNS_IF_Public.h, there is only a definition of the message structure, but no define for the Request code. Also in the PROFINET IO RT Manual, the ulCmd field for this command is empty. So i took the code from the DPM manual.

Regarding the necessity of the device handle: I also tried to issue e.g. the PLUG_MODULE Request without a device handle, but it was also rejected with ulSta = 0xC0300009.

Kind regards
jr

| 04.03.2008 | 18:57

jr wrote:
Hi ks,
thanks for your hints. Believe me, i searched the manuals you mentioned many times for startup sequences, but in vain. I also tried the START COMMUNICATION message. In PNS_IF_Public.h, there is only a definition of the message structure, but no define for the Request code. Also in the PROFINET IO RT Manual, the ulCmd field for this command is empty. So i took the code from the DPM manual.

Regarding the necessity of the device handle: I also tried to issue e.g. the PLUG_MODULE Request without a device handle, but it was also rejected with ulSta = 0xC0300009.

Kind regards
jr

You are right. There is no detailed start-up sequence description in the manuals. The Example Task that I mentioned, 4BitIO_Task, containes this sequence. I think you could ask AJ, the admin, about the example task.
The command for starting the communication is RCX_START_STOP_COMM_REQ. It is described in the DPM interface manual.
So you took the code from the DPM manual and did it work then?

Concerning the add_api, plug_module, plug_submodule:
There are two similar commands for each action in the manual described. See their description. Some commands need the handle and some not. The purposes of the commands vary.

Regards,
ks

jr

jr

| 05.03.2008 | 13:18

Hi ks,
it works!
obviously i issued the START_STOP_COMM_REQ (0x1EE4) at the wrong place. If i send the START_STOP_COMM_REQ in response to the PNS_IF_AR_ABORT_IND, the second CONNECT REQ is confirmed, and cyclic exchange starts. Surprisingly, the contents of the ulParam field doesn't matter. If obtain the same result for ulParam = 1 and ulParam = 2.

Thanks again for your help!

| 05.03.2008 | 13:27

You are welcome, jr. :wink:

jr

jr

| 06.03.2008 | 14:23

Hello,
i am facing the next problem. About 2 seconds after the INDATA_IND, i receive an AR_OFFLINE_IND with reasonCode 5 (AR alarm open failed), and cyclic exchange stops.
Any ideas ?

jr

jr

| 07.03.2008 | 10:37

Hello,
cyclic data exchange now works. Obviously i requested the update of IO-data too fast. Following the PNS_IF_AR_INDATA_IND, i issued a PNS_IF_GET_OUTPUT_REQ. Upon receipt of the PNS_IF_GET_OUTPUT_CNF, i issued a PNS_IF_SET_INPUT_REQ. After the PNS_IF_SET_INPUT_CNF, i sent again a PNS_IF_GET_OUTPUT_REQ and so on. When i place a TLR_TSK_SLEEP() ( 1 ms is sufficient) before requesting new output data, cyclic exchange works fine.

But now another problem arises: A WriteRecord Request is always rejected by the PNIO stack (ErrorCode=0xDF, ErrorDecode=0x81,ErrorCode1=0x40 (RMPM), ErrorCode2=0x06 (State conflict)). As currently there is only one AR supported by the PNIO stack, i am using API=0x00000000. I tried different values for the index (0xB02E, 47, 0, 1), but the result was always the same.

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 07.03.2008 | 20:56

which slot, subslot and index did you try to write to?

jr

jr

| 08.03.2008 | 15:14

Hi bm,
my configuration is as follows:
Slot 0: DAP
Slot 1/Subslot1: 16 Bit Input
Slot 2/Subslot1: 16 Bit Output

actually i want to implement some PROFIdrive functions. As such, i would like to use API 0x3A00. As the current version of the PNIO stack only supports API 0, i have to find a work-around. I started with Slot1, Subslot 1 and Index 47. After you asked for the combinations i tried, i checked many different combinations for Slot/Subslot/Index just to get a clue. But the result was always the same (State conflict).

Slot/Subslot/Index tried:
0/0/0
0/0/47
1/0/47
1/1/47
2/0/47
2/1/47
1/0/0xD000
1/1/0xD000
1/0/0xEC00
1/1/0xEC00
2/1/0xD000
2/0/0xEC00
2/1/0xEC00
1/0/0xF400
1/1/0xF400
2/0/0xF400
2/1/0xF400
...

Benjamin Meyer

Benjamin Meyer

Hilscher Gesellschaft fuer Systemautomation mbH

| 08.03.2008 | 19:32

did you plug (sub)modules into the (sub)slots you try to read?

what do you use to send the write requests?

jr

jr

| 09.03.2008 | 11:09

Hi bm,
yes, i plugged modules/submodules in the slots/subslots. The CONNECT REQ is confirmed without Module Diff Blocks. Cyclic exchange also works fine.
For every Write Request received by the IO-Device, there is an ERR_RTA_PDU with errorCode=0xcf (RTA_ERROR), errorCode1 = RTA_ERR_CLS_PROTOCOL, ErrorCode2=0x10 (AR device deactivated), and cyclic exchange stops.

I don't understand your question

Quote:
what do you use to send the write requests?

jr

jr

| 11.03.2008 | 16:29

Hi,
now the WriteRequest also works. The problem turned out to be the SeqNumber field in the WriteReq. My IO-Controller startet with SeqNumber 1. This is rejected by the PNIO stack although the PNIO specification tells that the SeqNumber field in the IODWriteReqHeader should not be checked.
Anyway, with SeqNumber = 0, my application gets the WriteReq.

| 26.05.2008 | 12:04

Hello,

I have the nearly Problem like jr, but my slave is my NetX 500-re and I would like to play/test an example, so that through my cifX 50 (controller) and Ethernet cable I can control the LEDs on my slave without problem or using the PIO-Ports, which are including on the slave.

what I am suggesting is to use the PNS_IF_START_LED_BLINKING_IND from the documentation of the Profinet IO RT Device Protocol API.doc from the CD Linkable Object for rcX BETA Version 0.96 that I became with the Evaluation board. If is right, I will program this in the ..._PROCESS.c from the given version.

Regards

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 26.05.2008 | 19:02

Hello Fchaleun,

maybe reading the API manual will be the requested hint :wink:

Login