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
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.
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
Hilscher Gesellschaft fuer Systemautomation mbH
Ah, that explains it :wink:
Andreas Jacob
Hilscher Gesellschaft fuer Systemautomation mbH
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);
}