I’ve got can shield and am looking to write my own code with the use of the supplied Seeedstudio library.
I have two questions can anyone help?
1.) I am using the only library download I can find 0.1, when I send an extended message in loopback mode it is not received, presumably there is a mistake in the filter setup in the library? I don’t know enough C to fix it, unless I make a mistake?
CAN.begin(CAN_125KBPS); // init can bus : baudrate = 125k
CAN.mcp2515_setCANCTRL_Mode(MODE_CONFIG);
//CAN.init_Mask(1, 1 , 0x000); #ifdef DEBUG_MODE
CAN.mcp2515_setCANCTRL_Mode(MODE_LOOPBACK); // Loopback for debug #else
CAN.mcp2515_setCANCTRL_Mode(MODE_LISTENONLY);
#endif
}[/code]
#ifdef DEBUG_MODE
Serial.println("Debug");
CAN.sendMsgBuf(0x1800008, true, 8, stmp); // If this is true I don't get anything back, false I do.
delay(100);
#endif
The code for receiving messages uses the interrupt as per your demo sketch.
2.) Can someone please give me an example of setting the masks and filters using this library? I can’t seem to figure it out.
If I change 0x00 to 0x60 (0x60 is bypass filters and masks) then I receive extended frames, this leads me to believe that the default CAN init does not allow for receiving extended frames
hi John~ about MODE_LOOPBACK and MODE_LISTENONLY, I am shame to tell you that I have never use.
You know, it’s just a basic library, it’ll just contains some basic function~
But if some guy will update the library, we’ll be pleasure to add it to the library or the wiki
I think it’s necessary to write an example about how to use masks and filters, I’ll find a time to do it… maybe next week.
When I finished it, I’ll contract you asap.