HMS Read IP Address through SDK

Hello I am using Profinet M40 Module with M40 starter Kit.
I have SDK version 3.06.01 and i am trying to read IP address set through SDK code. SDK code terminates with below error.

Severity : ABCC_SEV_WARNING
Error code: ABCC_EC_RESP_MSG_E_BIT_SET (ErrNo: 8)
Add info : (UINT32)( (psMsg )->abData[ 0 ] ) (0x4)
File : C:\Projects\ABCC_Starter_Kit_3.06.01\Projects\Windows\AnybusProfiNet.c (Line:43)
RSP MSG_GET_IP_ADDR: 4.20.243.200

IP address set was 10.20.243.200 and below is the code snippet

static ABCC_CmdSeqCmdStatusType GetIPCmd(ABP_MsgType* psMsg)
{
	ABCC_GetAttribute(psMsg, ABP_OBJ_NUM_NW, 3,
		6, ABCC_GetNewSourceId());
	
    return(ABCC_SEND_COMMAND);
}

static ABCC_CmdSeqRespStatusType GetIPResp(ABP_MsgType* psMsg)
{
	UINT8 abcc_IP1;
	UINT8 abcc_IP2;
	UINT8 abcc_IP3;
	UINT8 abcc_IP4;

	ABCC_ASSERT_ERR(ABCC_VerifyMessage(psMsg) == ABCC_EC_NO_ERROR,
		ABCC_SEV_WARNING, ABCC_EC_RESP_MSG_E_BIT_SET,
		(UINT32)ABCC_GetErrorCode(psMsg));
	ABCC_GetMsgData8(psMsg, &abcc_IP1, 0);
	ABCC_GetMsgData8(psMsg, &abcc_IP2, 1);
	ABCC_GetMsgData8(psMsg, &abcc_IP3, 2);
	ABCC_GetMsgData8(psMsg, &abcc_IP4, 3);
	printf("RSP MSG_GET_IP_ADDR: %d.%d.%d.%d\n", abcc_IP1, abcc_IP2, abcc_IP3, abcc_IP4);
	return(ABCC_EXEC_NEXT_COMMAND);
}

static const ABCC_CmdSeqType anb_NW_IPSeq[] =
{
   ABCC_CMD_SEQ(GetIPCmd, GetIPResp),
   ABCC_CMD_SEQ_END()
};

void GetIPAddr(char* str)
{
	ABCC_AddCmdSeq(anb_NW_IPSeq, NULL);
}

Hi @Shiva ,

What line here is line 43? It looks like it is having an issue verifying the message when reading the abcc_ip1 but with the info available i am not sure what. Enabling the debug messages bia abcc_drv_cfg.h and looking at the print out might provide more details.

Deryck

Hi deryck,

line 43 is from function ABCC_CmdSeqRespStatusType where assert function is present to verify response received from M40 Module. It looks like if there is an issue, M40 updates error code in first byte of response message and it says 0x04. I have enabled debug prints as you suggested and seen below messages when I was trying to read IP address through command sequencer

Mem: Buffer returned: 0x009374fc
Mem: Buffer allocated: 0x009374fc
CmdSeq(92ff3c)->GetIPCmd()

Msg sent:
[ MsgBuf:0x009374fc Size:0x0000 SrcId :0x0b DestObj:0x03
** Inst :0x0003 Cmd :0x41 CmdExt0:0x05 CmdExt1:0x00 ]**
[ ]

Mem: Buffer returned: 0x009374fc
Mem: Buffer allocated: 0x009374fc
Outstanding commands: 0

Msg received:
[ MsgBuf:0x009374fc Size:0x0001 SrcId :0x0b DestObj:0x03
** Inst :0x0003 Cmd :0x81 CmdExt0:0x05 CmdExt1:0x00 ]**
[ 0x04 ]

If 0x04 is error code what is the meaning of this error code and why M40 module throwing this error?

Error codes can be found in the Software design guide. In your case the error looks like it is for an instance that does not exist.

Are you running this right after setting the IP address? Discussing this with a colleague I suspect you are getting stale data in the print out, possibly from when you set the data.

Try switching the network object (ABP_OBJ_NUM_NW) for the Network Configuration object ABP_OBJ_NUM_NC.

Deryck

Hi Deryck,

Thanks for providing inputs switching to network configuration object worked.

Shivaji.

1 Like