sho - 2020-09-14

Hello,

I am currently trying to programmatically read the frame statistics from a Profinet adapter for evaluation purposes. (That would be pretty much what you get if you double-click on a Profinet controller or device in the IDE, change to the β€˜Status’ tab, and expand the node β€˜Ethernet Statistic.’)

So far, I tried to utilise the SysEthernetGetMediaCounters and SysEthernetGetInterfaceCounters functions from SysEthernet. However, to no avail: The result code is 16#0C in both cases, which should map to ERR_NOTIMPLEMENTED if I am not mistaken. I suspect those functions are either a stub (which would explain why the would not show up in the online help) or they are expecting the MAC address of the interface in an order that I cannot fathom. Code example for reference:

SysEthernetGetMediaCounters(
    // Set to Ethernet.MACAddress, which is checking out
    macAddress                      := abMacAddress, 
    // Setting this to TRUE yields the same result
    xGetAndClear                    := FALSE,
    pSysEthernetMediaCounters       := ADR(sMediaCounters),
    SysEthernetGetMediaCounters     => uiMediaRes,
);

So far I have been greatly unsuccessful in finding adequate functions or function blocks in either CommFB or any of the relevant Profinet libraries. So I would be thankful for any pointers. I would be perfectly content with the number of sent and received frames, btw.

 

Last edit: sho 2020-09-14