Reading HPS EMAC counters not reliable
UPDATE: Seems EMAC1 is looking OK. The problem, there, was understanding what's meant by "good" in some cases. But EMAC0 looks like it's almost not counting anything. It's quite sporadic when I see anything increment, and this is while sending thousands of packets in/out of it.
------------------- original message, below ---------------
I'm using both HPS EMACs on a design and want to use the counters in them for various purposes. For example, 0xff700180 and 0xff702180 should be frame counters for EMAC0 and EMAC1, respectively.
But when I send a packet to EMAC0, I don't see this counter increment. And when I send, say 10, packets to EMAC1, it counts 3. I know the packets are being sent as they arrive at the destinations just fine, but the EMAC is not counting.
The same for other counters. In the above example, they are UDP packets. But the IP4 and UDP counters are not incrementing by the right number, either.
I'm using DS-5 debugger to read these registers/memory, as well as saving them in variables in my program code and these agree with each other, but are clearly wrong.
Any ideas? Has anyone seen these counters work, properly?
(I am able to read/write status registers and such, just fine, but these counters seem broken.)
Final answer... Set the PR bit, not the RA bit. One does not need both, but the PR bit is the correct one if one wants counters to work. No documentation on this, sadly, but that's what we've deduced.