Dear Janko
Here is my code
Code: Select all
const long Node1_ID0 = 12300,
Node1_ID1 = 12301,
Node1_ID2 = 12302,
Node1_ID3 = 12303,
ID_2nd = 12344,
ID_3rd = 1; // node IDs
//***********************************
// Initialize CAN module
// set CONFIGURATION mode
//***********************************
CANInitialize(1,3,3,3,1,Can_Init_Flags);
CANSetOperationMode(_CAN_MODE_CONFIG,0xFF);
CANSetMask(_CAN_MASK_B1,-1,_CAN_CONFIG_XTD_MSG); // set all mask1 bits to ones
CANSetMask(_CAN_MASK_B2,0xFFFFFFFE,_CAN_CONFIG_XTD_MSG); // set all mask2 bits to ones
CANSetFilter(_CAN_FILTER_B2_F4,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B2_F4 to 2nd node ID */
/
As I told when I send a messege with ID=0 or ID=1 the messege is accepted.
I read the datasheet and I noticed that when RXFnSIDH,RXFnSIDL,RXFnEIDH,RXFnSIDL are not initialized
They may be 1 or zero.So in my case although I have set the B2_F4 filter,I guessed maybe the other filter value be zero.
so I changed my code as below
Code: Select all
//***********************************
// Initialize CAN module
// set CONFIGURATION mode
//***********************************
CANInitialize(1,3,3,3,1,Can_Init_Flags);
CANSetOperationMode(_CAN_MODE_CONFIG,0xFF);
CANSetMask(_CAN_MASK_B1,-1,_CAN_CONFIG_XTD_MSG); // set all mask1 bits to ones
CANSetMask(_CAN_MASK_B2,0xFFFFFFFE,_CAN_CONFIG_XTD_MSG); // set all mask2 bits to ones
CANSetFilter(_CAN_FILTER_B2_F4,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B2_F4 to 2nd node ID */
CANSetFilter(_CAN_FILTER_B2_F3,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B2_F3 to 2nd node ID */
CANSetFilter(_CAN_FILTER_B2_F2,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B2_F2 to 2nd node ID */
CANSetFilter(_CAN_FILTER_B2_F1,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B2_F1 to 2nd node ID */
CANSetFilter(_CAN_FILTER_B1_F2,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B1_F2 to 2nd node ID */
CANSetFilter(_CAN_FILTER_B1_F1,ID_2nd,_CAN_CONFIG_XTD_MSG);// set id of filter B1_F1 to 2nd node ID */
So it means that I set all filters to the ID_2nd(12344) and it worked!!!
What is you idea?