<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Reading Profinet Frame Statistics</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5937bf715b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5937bf715b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/5937bf715b/</id><updated>2020-09-14T22:11:34.047000Z</updated><subtitle>Recent posts to Reading Profinet Frame Statistics</subtitle><entry><title>Reading Profinet Frame Statistics</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5937bf715b/?limit=25#6347" rel="alternate"/><published>2020-09-14T22:11:34.047000Z</published><updated>2020-09-14T22:11:34.047000Z</updated><author><name>sho</name><uri>https://forge.codesys.com/u/sho/</uri></author><id>https://forge.codesys.comf2467c8b3cb4d41b41defa07df0ef98d8906fe06</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;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 &lt;a class="" href="https://help.codesys.com/webapp/_pnio_edt_device_status;product=core_ProfinetIO_Configuration_Editor;version=3.5.16.0" rel="nofollow"&gt;‘Status’ tab&lt;/a&gt;, and expand the node ‘Ethernet Statistics.’)&lt;/p&gt;
&lt;p&gt;So far, I tried to utilise the &lt;code&gt;SysEthernetGetMediaCounters&lt;/code&gt; and &lt;code&gt;SysEthernetGetInterfaceCounters&lt;/code&gt; functions from &lt;a class="" href="https://help.codesys.com/webapp/idx-SysEthernet-lib;product=SysEthernet" rel="nofollow"&gt;&lt;code&gt;SysEthernet&lt;/code&gt;&lt;/a&gt;. However, to no avail: The result code is &lt;code&gt;16#0C&lt;/code&gt; in both cases, which should map to &lt;code&gt;ERR_NOTIMPLEMENTED&lt;/code&gt; 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:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;SysEthernetGetMediaCounters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="k"&gt;Set&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;Ethernet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MACAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;which&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;checking&lt;/span&gt; &lt;span class="k"&gt;out&lt;/span&gt;
    &lt;span class="n"&gt;macAddress&lt;/span&gt;                      &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;abMacAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Setting&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt; &lt;span class="n"&gt;yields&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt; &lt;span class="k"&gt;result&lt;/span&gt;
    &lt;span class="n"&gt;xGetAndClear&lt;/span&gt;                    &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;FALSE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;pSysEthernetMediaCounters&lt;/span&gt;       &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ADR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sMediaCounters&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;SysEthernetGetMediaCounters&lt;/span&gt;     &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;uiMediaRes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So far I have been greatly unsuccessful in finding adequate functions or function blocks in either &lt;code&gt;CommFB&lt;/code&gt; 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.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>