<div dir="ltr">In the function ec_master_clear_device_stats in master/master.c, the fields tx_frame_rates and tx_byte_rates are initialized to zero but not their rx counterparts. This causes the 'Common' section of the 'ethercat master' command to report incorrect RX stats.<div>
<br></div><div>I fixed this by adding two lines to the for loop in this function as follows:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="courier new, monospace">master->device_stats.rx_frame_rates[i] = 0;</font></div>
</div><div><div><font face="courier new, monospace">master->device_stats.rx_byte_rates[i] = 0;</font></div></div></blockquote><div><br></div><div>So that the function now looks like this:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><font face="courier new, monospace">void ec_master_clear_device_stats(</font></div></div><div><div><font face="courier new, monospace"> ec_master_t *master /**< EtherCAT master */</font></div></div><div>
<div><font face="courier new, monospace"> )</font></div></div><div><div><font face="courier new, monospace">{</font></div></div><div><div><font face="courier new, monospace"> unsigned int i;</font></div></div><div>
<div><font face="courier new, monospace"><br></font></div></div><div><div><font face="courier new, monospace"> // zero frame statistics</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.tx_count = 0;</font></div>
</div><div><div><font face="courier new, monospace"> master->device_stats.last_tx_count = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.rx_count = 0;</font></div></div>
<div><div><font face="courier new, monospace"> master->device_stats.last_rx_count = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.tx_bytes = 0;</font></div></div><div>
<div><font face="courier new, monospace"> master->device_stats.last_tx_bytes = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.rx_bytes = 0;</font></div></div><div><div>
<font face="courier new, monospace"> master->device_stats.last_rx_bytes = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.last_loss = 0;</font></div></div><div><div><font face="courier new, monospace"><br>
</font></div></div><div><div><font face="courier new, monospace"> for (i = 0; i < EC_RATE_COUNT; i++) {</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.tx_frame_rates[i] = 0;</font></div>
</div><div><div><font face="courier new, monospace"> master->device_stats.tx_byte_rates[i] = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.rx_frame_rates[i] = 0;</font></div>
</div><div><div><font face="courier new, monospace"> master->device_stats.rx_byte_rates[i] = 0;</font></div></div><div><div><font face="courier new, monospace"> master->device_stats.loss_rates[i] = 0;</font></div>
</div><div><div><font face="courier new, monospace"> }</font></div></div><div><div><font face="courier new, monospace">}</font></div></div></blockquote><div><br></div><div><br></div></div>