Right way to set node address up during initialization of a Profibus DP-V1 brick

Hello there,

After having worked with modules based on Ethernet (Ethernet Powerlink, EtherCAT, EtherNet/IP), I am trying to support Profibus DP-V1 modules as well.

I might be doing something really stupid because the PDP brick is going into Exception State during initialization process.

ABCC_CbfUserInitReq() function does the following:

anybusConfigAcc is a structure with data sent by another board. This is working fine. So after filling out those data structures (appl_*), command sequencer is called in the end.

My command sequencer is pretty standard.

Of course, those IP settings do not apply for Profibus.

What am I missing? What would be the right way to set-up node address for those protocols such as Profibus?

Best Regards,
Luciano.

You should be able to use APPL_SetAddress() available in appl_abcc_handler.

/*------------------------------------------------------------------------------
** Set HW switch 1 value to the application. The value is used to generate the
** the node address or the IP address (192.168.0.X) depending on network.
**
** NOTE: For networks that uses an IP address and if this function is called
** with address 0 no address will be set to the ABCC.
**------------------------------------------------------------------------------
** Arguments:
** bSwitchValue/iSwitchValue - Switch 1 value either as an 8 bit or 16 bit
** value depending on configuration.
**
** Returns:
** None
**------------------------------------------------------------------------------
*/
#if APPL_USE_16BIT_NODE_ADDR
EXTFUNC void APPL_SetAddress( UINT16 iSwitchValue );
#else
EXTFUNC void APPL_SetAddress( UINT8 bSwitchValue );
#endif

Hi Deryck,

Thanks for the quick reply.

Sorry, forgot to mention that I have tried doing that already. Variable “appl_bNwNodeAddress” gets correctly the node address user adjusted in the HMI, but Anybus still ends up in Exception State.

For Profibus, node address is the only setting user is going to do. I wonder if my command sequencer, which includes calls for IPs configuration, is not causing trouble.

Something like this for instance:

static const ABCC_CmdSeqType appl_asUserInitCmdSeq[] = {ABCC_CMD_SEQ(UpdateNodeAddress, NULL), ABCC_CMD_SEQ_END()};

Besides, important to highlight that our host board has no switches, so all programming is done by software.

Since the program is already working for above Ethernet-based protocols (ADI mapping, exchanging cyclic and acyclic data), I suspect the configuration for the Profibus is not ok.

I see, nothing looks out of place with what you are doing. Does the using APPL_SetAddress(anybusConfigAcc.cfg_nodeid) also cause an exception? What node id are you setting?
Are you able to review the debug logs from the host application? This may show what request is causing the abcc to go into the exception state.

Hi Deryck,

Debugging this system is a bit challenging. I am already using 2x Segger debuggers and because of the timing, getting real-time data is not straightforward. So at this stage, I am no longer able to collect debug event printouts.

But I made some progress. It turns out the problem is not related to node address setting. The issue is in the I/O mapping. My application allows up to 50 words for input and 50 words for output, and this setting is working fine for those Ethernet-based protocols. But with the Profibus brick, anything larger than 24 words send the module to exception state.

Like I said, I might be doing something silly in part of the code. Anyway, I have a direction now to search for answers.

Thanks a lot.
Luciano.