• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple netrepns
#1
Hi Armin,

I am trying to connect 2 X netpi with same PNS example code to one siemens PLC.
it seems threre is a problem doing so networking wise when using "Ethernet device Configuration" tool.
I the netx has someking of mac address which conflicts. is it something I can change when initiating the driver ?
is it possible to do ?

Regards,

Roy
  Reply
#2
Hi there,

when netPI is manufactured the Ethernet network Controller who is responsible for the PROFINET communcation is burned with a unique MAC address. So each netPI has a different MAC address on PROFINET side.

But there is one trick you need to know. In order to let netPI customers use the PNS example directly along with the corresponding GSDML without the need for any changes, the PROFINET device name in the GSDM file is preset to "netx51repns" and also in the example in the "packethandlerpns.c" file is preset to "netx51repns" with the consequence that each netPI with the same unchanged example will get the same name on PROFINET. But this is not allowed and if a device detects a second device with the same name it goes bus off.

Following the API manual located on github as well I see two possitilies. I prefer this one: On page 41 it says to have bit D17 set in "ptSetConfig->ulSystemFlags" with the #define PNS_IF_SYSTEM_NAME_IP_HANDLING_BY_STACK_ENABLED. With this setting the network controller ignores any configured name of station by the example and takes the name from the internal FLASH memory. Since netPI is fresh the name will be zer in the first place. With this bit D17 settings you start both netPIs with the example, but this time both of them have no names and no netPI goes off. Now comes the Ethernet Device Utitily which is used to set unique names on PROFINET stations and now set name1 for netPI1 and name2 for netPI2.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Hi Armin,

Thanks for the support. 
it seems the example already takes care of this bit(see below 1).  and I was not able to configure a second netPi with the tool.
I tried to change the name of the device, was hoping it will do the job (see below 2) with no success.

any idea what else shoud I try ?

Regards,

Roy

1)
ptSetConfig->ulSystemFlags        = PNS_IF_SYSTEM_START_AUTO_START |
                                        PNS_IF_SYSTEM_STACK_HANDLE_I_M_ENABLED  |
                                        PNS_IF_SYSTEM_ARDY_WOUT_APPL_REG_ENABLED |
                                        PNS_IF_SYSTEM_NAME_IP_HANDLING_BY_STACK_ENABLED;      /* Flags to use are defined in this file  */
    ptSetConfig->ulWdgTime            = 1000;                                          /* Watchdog time (in milliseconds)        */
    ptSetConfig->ulVendorId          = 0x011E;                                        /* Vendor ID                              */
    ptSetConfig->ulMaxAr              = 0;                                              /* Currently not used                    */
    ptSetConfig->ulCompleteInputSize  = sizeof(APP_OUTPUT_DATA_T);                      /* Maximum amount of allowed input(received) data  */
    ptSetConfig->ulCompleteOutputSize = sizeof(APP_INPUT_DATA_T);                      /* Maximum amount of allowed output(sent) data  */


2)
memcpy( ptSetConfig->abNameOfStation, "netx51repns1", sizeof( "netx51repns1" ) );    /* The NameOfStation as ASCII char-array  */
      ptSetConfig->ulNameOfStationLen = sizeof( "netx51repns1" ) - 1;                      /* Length of NameOfStation                */
      memcpy( ptSetConfig->abTypeOfStation, "NETX 51 RE/PNS", sizeof( "NETX 51 RE/PNS" ) );
                                                /* The TypeOfStation as ASCII char-array  */
      ptSetConfig->ulTypeOfStationLen = sizeof( "NETX 51 RE/PNS" ) - 1;                  /* Length of TypeOfStation                */
      memcpy( ptSetConfig->abDeviceType, "NETX 51 RE/PNS", sizeof( "NETX 51 RE/PNS" ) - 1 );
                                              /* The DeviceType as ASCII char-array    */
      memcpy( ptSetConfig->abOrderId, "2231.000", sizeof( "2231.000" ) - 1 );            /* The OrderId as ASCII char-array        */
  Reply
#4
There is one simple question.

If you use the ethernet configuration tool to scan for the devices. What does it tell you? 

Can you please post a screen shot. I am interested in what the Ethernet side is doing. Do you see one device, two devices ... non. 

Is it the first device behnd the scanning PC, do you see or the second device after the first netPI ... or both?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
(July-20th-2021, 01:14 PM)Armin@netPI Wrote: There is one simple question.

If you use the ethernet configuration tool to scan for the devices. What does it tell you? 

Can you please post a screen shot. I am interested in what the Ethernet side is doing. Do you see one device, two devices ... non. 

Is it the first device behnd the scanning PC, do you see or the second device after the first netPI ... or both?

I see only one device with the name netx51repns when both are connected to the network. 
it seems that each time it displays the first device to answer. because the IP changes between searches


  
  Reply
#6
Sounds weird to me ... one more question ... and just for test purposes.

By default the two Industrial Ethernet ports operate as a LAN switch always, independent if PROFINET is configured or not. 

Now if you setup two netPIs inline across the dual LAN ports ... and you start the second one located behind the first netPI device with the PNS example ... are you able to scan it?

Can you please also tell me the two MAC addresses printed on the devices' label so I can verify the production settings of both devices.

Thx
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#7
Another idea. Supposing you would start both netPIs with the very same example and you configure them the same time without haveing them connected inline ... then in theory connecting netPI 1 alone to the PROFINET PLC will run and if you remove it and connect then netPI 2 to PROFINET instead this device will run. At no time both units are connected to PROFINET during this test. Is that running as I describe it in theory?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#8
(July-20th-2021, 03:00 PM)Armin@netPI Wrote: Another idea. Supposing you would start both netPIs with the very same example and you configure them the same time without haveing them connected inline ... then in theory connecting netPI 1 alone to the PROFINET PLC will run and if you remove it and connect then netPI 2 to PROFINET instead this device will run. At no time both units are connected to PROFINET during this test. Is that running as I describe it in theory?

will try and let you know. 
I will be able to test it only next week. I have only one PLC which is under test I cannot stop now.
  Reply
#9
In the morning I tried to setup also two netPIs in the office ... and guess what ... I was having the same problem as you have.

Ethernet network scan tool just shows only one device. So I was really astonished. Each of the devices connected alone to the scan tools worked ... but the remarkable thing was both devices showed me the very same MAC address even if the device label was indicating me a different one.

So I went to the source code and found the following sequence in "PacketHandlerPNS.c"

Code:
uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData){

  uint32_t lRet=RCX_S_OK;
  uint8_t abMacAddr[6] = { 0x00, 0x02, 0xA2, 0x2F, 0x90, 0x58 };
  lRet=Sys_SetMacAddressReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++, &abMacAddr[0]);

  return lRet;
}

So the example code configures always a MAC address (the same for all) for each of the netPIs and overwrites the one installed during production and this is why it does not work to run two or more netPIs the same time on the network.

Since I didn't want to change the calling process in "PNS_simpleConfig.c" source code

Code:
lRet = Protocol_SendFirstPacket(&tAppData);

instead I did some code modifications in "PacketHandlerPNS.c" to get rid of the SetMacAddress feature

Code:
uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData){

  uint32_t lRet=RCX_S_OK;
  //uint8_t abMacAddr[6] = { 0x00, 0x02, 0xA2, 0x2F, 0x90, 0x58 };
  //lRet=Sys_SetMacAddressReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++, &abMacAddr[0]);

  lRet=Pns_SetConfigReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++);
 
  return lRet;
}

So instead of configuring the MAC address, I directly start with the configuration as "first packet".

BUT ONE MORE THING ... since my two netPIs already got a MAC address before due to the previous "wrong" code ... a reset of the netPIs Industrial Ethernet Controller was necessary to get it removed. The trick is to call one of the other examples that are included in the programming example container like ./ECS_simpleConfig ... this causes a firmware reload into the controller and hence a reset. Afterwards calling my recompiled example ./PNS_simpleConfig succeeded.

Now I am able to see both of my netPI working with the labeled MAC addresses as expected.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#10
(July-21st-2021, 06:48 AM)Armin@netPI Wrote: In the morning I tried to setup also two netPIs in the office ... and guess what ... I was having the same problem as you have.

Ethernet network scan tool just shows only one device. So I was really astonished. Each of the devices connected alone to the scan tools worked ... but the remarkable thing was both devices showed me the very same MAC address even if the device label was indicating me a different one.

So I went to the source code and found the following sequence in "PacketHandlerPNS.c"

Code:
uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData){

  uint32_t lRet=RCX_S_OK;
  uint8_t abMacAddr[6] = { 0x00, 0x02, 0xA2, 0x2F, 0x90, 0x58 };
  lRet=Sys_SetMacAddressReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++, &abMacAddr[0]);

  return lRet;
}

So the example code configures always a MAC address (the same for all) for each of the netPIs and overwrites the one installed during production and this is why it does not work to run two or more netPIs the same time on the network.

Since I didn't want to change the calling process in "PNS_simpleConfig.c" source code

Code:
lRet = Protocol_SendFirstPacket(&tAppData);

instead I did some code modifications in "PacketHandlerPNS.c" to get rid of the SetMacAddress feature

Code:
uint32_t Protocol_SendFirstPacket(APP_DATA_T *ptAppData){

  uint32_t lRet=RCX_S_OK;
  //uint8_t abMacAddr[6] = { 0x00, 0x02, 0xA2, 0x2F, 0x90, 0x58 };
  //lRet=Sys_SetMacAddressReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++, &abMacAddr[0]);

  lRet=Pns_SetConfigReq(ptAppData->hChannel[0], &ptAppData->tPkt, ptAppData->ulSendPktCnt++);
 
  return lRet;
}

So instead of configuring the MAC address, I directly start with the configuration as "first packet".

BUT ONE MORE THING ... since my two netPIs already got a MAC address before due to the previous "wrong" code ... a reset of the netPIs Industrial Ethernet Controller was necessary to get it removed. The trick is to call one of the other examples that are included in the programming example container like ./ECS_simpleConfig ... this causes a firmware reload into the controller and hence a reset. Afterwards calling my recompiled example ./PNS_simpleConfig succeeded.

Now I am able to see both of my netPI working with the labeled MAC addresses as expected.

Thx
Armin

thank you for the support. I will try it next week
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)