industrialNETworXnetx

simon

simon

| 19.08.2008 | 10:30 | 3 replies

PROFIBUS C1 Write over DPM

Hi,

I've got the PROFIBUS stack up and running now. Only the C1 Write mechanism doesn't work properly yet. In the PROFIBUS manual you write

Quote:
The indication packet itself may not be used as resource to build the corresponding response packet.
It has rather to be returned back to the FSPMS task by using the macro TLR_QUE_RETURNPACKET()
first, before the separated response can built with a free packet from the AP task’s own pool.

I'm not sure how to return the packet to the FSPMS task when accessing the Stack via DPM memory. I think I should do that, because when sending a C1 Write packet to the device I get an error reply. But the data in the write packet is written to the device's memory. C1 Read requests work fine.

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 19.08.2008 | 11:00

Hi Simon,

in which manual did you find the description. I think it is in an old version of the manual, because it is decrepitly in the meantime.

It is no Problem to use the indication for the response.
A quick and dirty test code for a DPV1 write indication looks like:

void DPS_Do_DPV1_Write(PROFIBUS_FSPMS_PACKET_C1_WRITE_IND_T *ptPckt)
{
  unsigned char i;
  unsigned long ulErr;

PROFIBUS_FSPMS_PACKET_C1_WRITE_RES_POS_T *ptWriteResPos;

ptWriteResPos = (PROFIBUS_FSPMS_PACKET_C1_WRITE_RES_POS_T *)ptPckt;


printf("\n Class 1 Write: ");
printf("\n Slot: %d, Index: %d, Length: %d", ptPckt->tData.bSlotNumber,
ptPckt->tData.bIndex,
ptPckt->tData.bLength);

/* generate some test data */
printf("\n Data: ");

for (i = 0 ; i != ptPckt->tData.bLength ; i++)
printf("%x ", ptPckt->tData.abData[i]);

ptWriteResPos->tHead.ulLen = sizeof(PROFIBUS_FSPMS_PACKET_C1_WRITE_RES_POS_T);
ptWriteResPos->tHead.ulCmd |= 1;
ptWriteResPos->tHead.ulSta = 0;

ulErr = xChannelPutPacket( atChannel[0].hChannel, (CIFX_PACKET*)ptWriteResPos, 0);
}

simon

simon

| 19.08.2008 | 11:06

Thanks, It does work when I just use the packet I got for the reply.

My quote is from the document "PROFIBUS-DP_Slave_Protocol_API.pdf", the last entry in the Revision History is dated 02.06.08 by RG/HH and tells about Revisions
"Firmware/stack version 2.0.10.
Reference to netX Dual-Port Memory Interface Manual Revision 5.
Chapter Configuration Parameters restructured"

Well, the manual is more for accessing the tasks of the FW-Stack directly, not for DPM access. But two months ago I still had to do this when working on a netSTICK (via xChannel functions).

simon

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 19.08.2008 | 11:13

Ah, that explains it :wink:

Login