I’ve been attempting to Factory Default the Network Configuration object in my Profibus 40 with no success. Here is the code I’ve got:
void ABCC_NodeAddressReset( void )
{
ABCC_AddCmdSeq( NodeAddressFactoryResetCmdSeq, NULL );
}
static const ABCC_CmdSeqType NodeAddressFactoryResetCmdSeq[] =
{
ABCC_CMD_SEQ( NodeAddressFactoryDefaultResetCmd, NULL ),
ABCC_CMD_SEQ_END()
};
static ABCC_CmdSeqCmdStatusType NodeAddressFactoryDefaultResetCmd( ABP_MsgType* psMsg )
{
ABCC_SetObjReset( psMsg, ABP_OBJ_NUM_NC, ABP_NC_INST_NUM_SW1,
ABP_RESET_POWER_ON_FACTORY_DEFAULT,
ABCC_GetNewSourceId() );
return( ABCC_SEND_COMMAND );
}
void ABCC_SetObjReset(ABP_MsgType* psMsg,
UINT8 bObject,
UINT16 iInstance,
UINT8 bResetType,
UINT8 bSourceId )
{
ABCC_MsgType sMsg;
sMsg.psMsg = psMsg;
ABCC_SetLowAddrOct( sMsg.psMsg16->sHeader.iSourceIdDestObj, bSourceId ); /* SourceId /
ABCC_SetHighAddrOct( sMsg.psMsg16->sHeader.iSourceIdDestObj, bObject ); / bObject /
psMsg->sHeader.iInstance = iTOiLe( iInstance ); / Instance /
ABCC_SetLowAddrOct( sMsg.psMsg16->sHeader.iCmdReserved,
ABP_CMD_RESET ); / Command */
sMsg.psMsg16->sHeader.iDataSize = iTOiLe( 0 ); /* Data size /
ABCC_SetLowAddrOct( sMsg.psMsg16->sHeader.iCmdExt0CmdExt1, 0 ); / CmdExt1 (reserved) /
ABCC_SetHighAddrOct( sMsg.psMsg16->sHeader.iCmdExt0CmdExt1, bResetType ); / CmdExt0 (ResetType) */
}
Here’s a log of the debug output:
Mem: Buffer allocated: 0x80037634
CmdSeq(9d03e27c)->NodeAddressFactoryDefaultResetCmd()
Msg sent:
[ MsgBuf:0x80037634 Size:0x0000 SrcId :0x1a DestObj:0x04
Inst :0x0001 Cmd :0x05 CmdExt0:0x00 CmdExt1:0x02 ]
[ ]
Mem: Buffer returned: 0x80037634
There is no response from the module (I’m assuming this is correct on a reset, as I don’t see one, and there is no error returned)
The reset command definition from the manual:
I’ve tried these things:
- performing a APPL_RestartAbcc after the default, with different wait periods after the default
- not doing a APPL_RestartAbcc after the default
- the ABP_RESET_FACTORY_DEFAULT option
- resetting instance 0 and 1 of the Network Config object (04)
- setting the ABP_MSG_HEADER_C_BIT in the command, which causes an exception error response
- power cycling after the default
- used an external tool (Siemens PDM) to read the Node Address (it doesn’t change)
I have SSA enabled, this is why I would need to default the object, to allow the user to have the option to set the address again if required.
When I read back the node address after the reset I always receive the address that was set previously (in this case, 6):
Msg sent:
[ MsgBuf:0x800372b4 Size:0x0000 SrcId :0x34 DestObj:0x04
Inst :0x0001 Cmd :0x41 CmdExt0:0x05 CmdExt1:0x00 ]
[ ]
Mem: Buffer returned: 0x800372b4
Mem: Buffer allocated: 0x800372b4
Outstanding commands: 254
Msg received:
[ MsgBuf:0x800372b4 Size:0x0001 SrcId :0x34 DestObj:0x04
Inst :0x0001 Cmd :0x01 CmdExt0:0x05 CmdExt1:0x00 ]
[ 0x06 ]
What am i missing here?
-ed