To all,
From the datasheet it's my understanding that the RXM0 and RXM1 bits in both RXB0CTRL and RXB1CTRL control how each buffer receives messages.
If both bits are 0, then filters apply... if either 01 or 10 then either only std or ext messages can get in. If 11 then anything goes and filters don't apply.
Are the above modes only valid if the controller is in Listening mode? Or should they apply in Normal mode as well? I've written code, based on canduino, here:
http://modelrail.otenko.com/arduino/arduino-controller-area-network-can (download link is at the very bottom)
and all works well... but my toggleRxAcceptance functions don't seem to be working.
void CANClass::toggleRxAcceptance(byte buffer, bool std, bool ext) {
delay(100);
digitalWrite(SS_PIN, LOW);
SPI.transfer(BIT_MODIFY);
SPI.transfer(buffer); //target
SPI.transfer(0b01100000);
SPI.transfer(((ext ? 1 : 0) << 6)|((std ? 1 : 0) << 5));
digitalWrite(SS_PIN, HIGH);
delay(100);
}
The code above definitely sets the registers... do I then need to reset the controller? Delay before setting into a proper mode? The datasheet seems to just suggest that it'll work as soon as you set the bits.
Does the MCP2515 need to be in Configuration mode to set these values? I've tried the RXM0/1 bits with a selection of controller modes, filters, etc... but it seems that messages just always seem to arrive on buffer 0 with no issues. Filters still apply and function nicely.
Am more than appreciative if anyone else can share their issues/solutions on how to use the RXM0/1 bits. I can't see them actually being extremely useful in practical applications, but I'm more adamant to just get them working for anyone who wants to use them.
Steven.