Hello,
The question is about demo project Profibus_Slave_netX50.htp which comes with
NXLOM RCX-DPS 07'2009 V2.2 PROFIBUS Slave stack. It is used Shared Memory API(SHM) mode.
If I use original code it works and state Data Exchange is reached. Bus trace looks like this:
| Timestamp | Addr | Req/Res | Datalen | Data | Msg type | FC | Station |
| 28058.86 ms | 1->32 | Req | 7 | 40 01 14 0B 0A 12 00 |
Set Parameters | 6C | |
| 28059.85 ms | 1->32 | Req | 7 | 40 01 14 0B 0A 12 00 | Set Parameters | 6C | |
| 28059.88 ms | Res | Short acknowledge | |||||
| 28060.69 ms | 1->32 | Req | 0 | Get Diagnostics | 5C | ||
| 28060.71 ms | 1<-32 | Res | 6 | 02 05 00 FF 0A 12 | Get Diagnostics | 8 | |
| 28061.61 ms | 1->32 | Req | 12 | 80 01 14 0B 0A 12 00 80 00 00 00 00 |
Set Parameters | 7C | |
| 28061.64 ms | Res | Short acknowledge | |||||
| 28062.45 ms | 1->32 | Req | 2 | 91 A1 | Check Config | 5C | |
| 28062.47 ms | Res | Short acknowledge | |||||
| 28063.92 ms | 1->32 | Req | 0 | Get Diagnostics | 7C | ||
| 28063.94 ms | 1<-32 | Res | 6 | 00 06 00 01 0A 12 | Get Diagnostics | 8 | |
| 28064.84 ms | 1->32 | Req | 0 | Get Diagnostics | 5C | ||
| 28064.86 ms | 1<-32 | Res | 6 | 00 06 00 01 0A 12 | Get Diagnostics | 8 | |
| 28065.82 ms | 1->32 | Req | 0 | Get Diagnostics | 7C | ||
| 28065.84 ms | 1<-32 | Res | 6 | 00 04 00 01 0A 12 | Get Diagnostics | 8 | |
| 28067.85 ms | 1->32 | Req | 2 | 00 00 | Data Exchange | 5D | |
| 28067.87 ms | 1<-32 | Res | 2 | 00 00 | Data Exchange | 8 | |
But I want to have more control over the communication, that's why I have set the bit WRMSTRT_FLG_AUTOCONFIG in the tWarmstartReq.tData.bFlags.
Additionally I have included in the TaskProcess_ShmDemo( ) the code:
lTemp = xChannelBusState(hChannel, CIFX_BUS_STATE_ON, &ulState, 0L);
if(CIFX_NO_ERROR != lTemp)
{ uiTest4++; }
lTemp = xChannelGetPacket(hChannel, sizeof(tRecvPkt), &tRecvPkt, 0);
if(CIFX_NO_ERROR == lTemp)
{
PROFIBUS_APS_PACKET_CHECK_USER_PRM_RES_T *ptRespPrm;
PROFIBUS_APS_PACKET_CHECK_CFG_RES_T *ptRespCfg;
uiTest1++;
switch(tRecvPkt.tHeader.ulCmd)
{
case PROFIBUS_APS_CHECK_USER_PRM_IND :
ptRespPrm = (PROFIBUS_APS_PACKET_CHECK_USER_PRM_RES_T *)&tRecvPkt;
ptRespPrm->tHead.ulDest = ptRespPrm->tHead.ulSrc;
ptRespPrm->tHead.ulSrc = 0x10;
ptRespPrm->tHead.ulLen = PROFIBUS_APS_CHECK_USER_PRM_RES_SIZE;
ptRespPrm->tHead.ulSta = 0;
ptRespPrm->tHead.ulCmd = PROFIBUS_APS_CHECK_USER_PRM_RES;
ptRespPrm->tHead.ulExt = 0;
ptRespPrm->tHead.ulRout = 0;
ptRespPrm->tData.fPrmOk = TLR_TRUE;
lTemp = xChannelPutPacket(hChannel, (CIFX_PACKET *) ptRespPrm, ulTimeout);
if(CIFX_NO_ERROR != lTemp)
{ uiTest2++; }
break;
case PROFIBUS_APS_CHECK_CFG_IND :
ptRespCfg = (PROFIBUS_APS_PACKET_CHECK_CFG_RES_T *)&tRecvPkt;
ptRespCfg->tHead.ulDest = ptRespCfg->tHead.ulSrc; //0x20;
ptRespCfg->tHead.ulSrc = 0x10;
ptRespCfg->tHead.ulLen = PROFIBUS_APS_CHECK_CFG_RES_SIZE;
ptRespCfg->tHead.ulSta = 0;
ptRespCfg->tHead.ulCmd = PROFIBUS_APS_CHECK_CFG_RES;
ptRespCfg->tHead.ulExt = 0;
ptRespCfg->tHead.ulRout = 0;
ptRespCfg->tData.fCfgOk = TLR_TRUE;
lTemp = xChannelPutPacket(hChannel, (CIFX_PACKET *) ptRespCfg, ulTimeout);
if(CIFX_NO_ERROR != lTemp)
{ uiTest2++; }
else
{ uiTest3++; }
break;
default:
uiTest2++;
}//switch
}//if
As expected I recive the messages with commands PROFIBUS_APS_CHECK_USER_PRM_IND and PROFIBUS_APS_CHECK_CFG_IND. Variable lTemp is always CIFX_NO_ERROR.
The problem is that the Bit
1 “Station_Not_Ready“of diagnostic message octet1 remains set.
In this case bus trace looks like this:
| Timestamp | Addr | Req/Res | Datalen | Data | Msg type | FC | Station |
| 11741.44 ms | 1->32 | Req | 7 | 40 01 14 0B 0A 12 00 |
Set Parameters | 6C | |
| 11742.44 ms | 1->32 | Req | 7 | 40 01 14 0B 0A 12 00 | Set Parameters | 6C | |
| 11742.47 ms | Res | Short acknowledge | |||||
| 11743.28 ms | 1->32 | Req | 0 | Get Diagnostics | 5C | ||
| 11743.30 ms | 1<-32 | Res | 6 | 02 05 00 FF 0A 12 | Get Diagnostics | 8 | |
| 11744.12 ms | 1->32 | Req | 12 | 80 01 14 0B 0A 12 00 80 00 00 00 00 |
Set Parameters | 7C | |
| 11744.15 ms | Res | Short acknowledge | |||||
| 11744.96 ms | 1->32 | Req | 2 | 91 A1 | Check Config | 5C | |
| 11744.98 ms | Res | Short acknowledge | |||||
| 11746.43 ms | 1->32 | Req | 0 | Get Diagnostics | 7C | ||
| 11746.45 ms | 1<-32 | Res | 6 | 02 04 00 01 0A 12 | Get Diagnostics | 8 | |
| 11747.35 ms | 1->32 | Req | 0 | Get Diagnostics | 5C | ||
| 11747.36 ms | 1<-32 | Res | 6 | 02 04 00 01 0A 12 | Get Diagnostics | 8 | |
Octet 1 reamis 02.
It seems I'm missing to do something. What is this?
Best regards
Rumen
Ralf Hornung
Hilscher
Hi Rumen,
if responses are send the destination and the source are not swapped. Also the route shall not be touched.
If you change the code without thouse statements it should run
I think your response was not received by the stack
Best Regards
rh