@HwAoRrDk the atmega328p is running at 16Mhz, using the clock out pin to feed the 3 mcp2515 at 16Mhz, using the interrupt pin from each mcp2515 to the atmega, spi bus is running at 10Mhz. I’m doing all the filtering in software, no masks or filters set, using a switch statement to filter out required messages and passing all others through the default. I can post some code tonight if needed.
Ah, you may think the SPI bus is running at 10 MHz, but it won't be.
The ATmega328P can only run the SPI SCK at certain fractions of the main clock frequency (divide by 2, 4, 8, etc), with a maximum of half the main clock speed. If you have used the Arduino SPI library and specified
SPISettings(10000000, ...), what the Arduino library does is try to achieve the
nearest SCK speed to what you specify, which in this case will probably be 8 MHz (16 MHz / 2). You'd have to have the AVR running at 20 MHz to get 10 MHz SPI bus. All this will mean your communications with the MCP2515s are not as fast as you think.
I suspected you might be doing the filtering in software. If applicable, try using the message ID filtering and masking features of the MCP2515. I'm not sure whether that may help in a gateway/relay context though, where you want to pass through everything except certain messages. It would certainly be helpful the other way round; the fewer messages the AVR has to see in the first place the better. The MCP2515 can even do filtering on the first two message data/payload bytes (albeit only when using standard 11-bit message IDs).
Make sure you're also using the shortcut commands on the MCP2515 rather than generic
READ and
WRITE commands. For example, using the dedicated
READ STATUS command saves one byte of SPI traffic, because you skip having to specify the register address. If you're using a library for the MCP2515, this may already be done, but maybe not.
Posting code can't hurt - maybe there's something obvious you've missed, or some ways you could re-architect things.