I am having the exact same Problem. From my test setup I found out the hard way, that invalid messages seem to be comming through on a unregular basis in listen only mode. In my set up there the MCP is (in certain wanted conditions) initialized to a fixed Baud rate (125k) and listen only mode, whilste the Baud rate on the connected CAN bus is a totally different one (100k). In theory the MCP2515 should just receive no (valid) messages because there cant be a valid message and also aliasing should be detected (due to incorrect CRC). But instead it "detects" all kinds of messages (std, ext, etc.) with different length and data because it seems to simply also disable CRC checking. That is a problem for me because it handles interrupt pin and flag registers (CANINTF=01
) as if it was a valid message that is acutally not there. Also these "invalid" messages come in at a lower rate than acual messages on the bus (for every 7-16 real messages on the bus it detects one unreal messages with bullshit ID and data). I strongly suspect this is aliasing in sampling and interpretation without CRC cecking. 1. inconsistant statements in Data sheet DS20001801J-page 59:10.3 Listen-Only ModeListen-Only mode provides a means for the MCP2515 toreceive all messages (including messages with errors)by configuring the RXM[1:0] bits (RXBnCTRL[6:5]). Thismode can be used for bus monitor applications or fordetecting the baud rate in ‘hot plugging’ situations.For Auto-Baud Detection (ABD), it is necessary that atleast two other nodes are communicating with eachother. The baud rate can be detected empirically bytesting different values until valid messages arereceived.Listen-Only mode is a silent mode, meaning nomessages will be transmitted while in this mode(including error flags or Acknowledge signals). InListen-Only mode, both valid and invalid messages willbe received, regardless of filters and masks or theReceive Buffer Operating Mode bits, RXMn. The errorcounters are reset and deactivated in this state. TheListen-Only mode is activated by setting the RequestOperation Mode bits (REQOP[2:0]) in the CANCTRLregister.
I feel like in listen only mode it not only doesnt do filters but also doesnt do CRC (also invalid msg) and therefore pics up the alias sampling (100k vs. 125k) as data. So data sheet is wrong in the first statement.
How to solve the issue, I want listen only because I am not allowed to influence the CAN bus (by Errorframes or anything = Listen only) and if connected to the wrong Bus (different boud rate) do nothing.
Currently I do Baudrate detection that fails on the first invalid message for a baudrate, which works 95% of the time to thow out the wrong baudrate. But if real baudrate is not among the rates I check for it gets initialized with a default (or a wrongly detected 5%) and then this aliasing problem occours. My work around is to detect as many possible rates (95%) and then deliberately do nothing in endless loop. But in 5% the device will detect a baudrate I am looking for, even though it is not really there. That error case I can't catch.