Which is, when you get an interrupt you scan ALL of the BDs.
I wasn't clear in my first post - When I get an interrupt I start from the last BD I scanned, so the ISR usually touches at most 2 BDs (the one with data, and the next one, which is empty, terminating the scan). The location of the empty BD is then where it begins at the next interrupt.
This CPU is meant to have hardware to give the FEC priority (for bus access) over the CPU so it doesn't get starved. But it doesn't seem to work.
According to the errata for this chip (SECF016), the BDE and V bits should not both be set as simultaneous access occasionally results in incorrect data. This is supposed to be fixed in the mask for the chip I have, however. I've tried it both ways (BDE only, and BDE + V) without an apparent difference in overflows.
Deepest FIFOs.
I have varied R_FSTART between 0x70 and 0x20. This seemed reduce overflow occurrences for my 10 second test case when R_FSTART was at 0x60, however it did not eliminate them. This seems strange, as the higher the number, the smaller the portion of the FIFO allocated for receive. The default is 0x40. The datasheet recommends 0x48 or higher.
Highest priority. BDs in the half of the SRAM where they're meant to have priority (or the SRAM set up so the FEC has highest priority on all of it).
I have RAMBAR[PRIU,PRIL] set to [00] which gives priority to the SRAM backdoor for both banks. Again, I did not notice much difference when I flipped these to [11]. (With RAMBAR[V] bit set, of course).
Are you sure the CPU is accessing the SRAM through the "back door" and not over the bus. On some of these chips you can get this wrong. Make sure RAMBAR[V] is set. Make sure the Address Space Masks are zero (except C/I). Prove this is working by writing test code that measures the SRAM access speed.
Yes. I get about a 30% difference between CPU vs. backdoor.
Why does C/I need to be set? The datasheet says "In most applications, the C/I bit is set" but it doesn't say why. It seems these are most useful for power management, which I'm not concerned with.
But the "priority" stuff doesn't seem to work if the CPU is rapidly reading uncached memory or SRAM.
Isn't that the whole purpose of the prioritization for the arbiter?
Instead of the "brute force and ignorance" coding of scanning all the BDs, you should start from the "next expected" one. You should then read "around the ring" until the first "unused" one and then stop.
> I have tried increasing my receive buffer descriptor count up to 256,
That should make the problem worse, as you're fighting the FEC a lot more. Did it?
See above - it's not brute force, it starts at the 'next expected' location. Increasing or increasing the BD count didn't seem to make a difference either way.
Are you running full-duplex? Can you force half-duplex and see if the problem goes away?
I've been autonegotiating to 100/Full, but to check I've forced other modes
100/Full: Present
100/Half: Present
10/Half: Present
10/Full: Present
Placing descriptors in non-cached SDRAM, with buffers in cached SDRAM seems to make things much worse.