hello,
i want to send MSgCAN with ID 0x1 from CAN1 to CAN2
and send MSgCAN with ID 0x2 from CAN2 to CAN1
CAN_TXframe temp2 ={0x00080000,0x00000002,0xA2A2A2A2,0xB2B2B2B2};
CAN_TXframe temp1 ={0x00080000,0x00000001,0xA1A1A1A1,0xB1B1B1B1};
i must in my driver to use CAN filter acceptance
well i have a problem :
i have developped this function
but i don't understand why
i must Add filter receive 0x1,0x2 to CAN1 and 0x1, 0x2 to CAN2
for the driver work
in datasheet i have understand that i add filter only the ID i must to receive,
but when i configure filter CAN1 to receive 0x2, and other ID for example 0xA
and configure CAN2 to receive 0x1 and other ID for example 0xB , but the driver
not work.
this is tha addfilter function work when i configure 0x1,0x2 filter to CAN1 and
CAN2:
void addfilter(void)
{
C1MOD =1; C2MOD =1;
AFMR = 0x00000001; // Disable the Acceptance filters to allow setup of
the table
SFF_sa = 0x00000000; // Set start address of Standard table
StandardFilter0 = 0x20012002;
StandardFilter1 = 0x40014002;
SFF_GRP_sa = 0x00000008; // Set start address of Standard group table
EFF_sa = 0x00000008; // Set start address of Extended table
EFF_GRP_sa = 0x00000008; // Set start address of Extended group table
ENDofTable = 0x00000008; // Set end of table address
AFMR = 0x00000000; // Enable Acceptance filters
C1MOD =0; C2MOD =0;
}
and this is the addfilter function when i configure 0x1 to CAN2 and 0x2 to CAN1
and the driver not work despite i send Msg with ID 0x2 to CAN1 and Msg with ID
0x1 to CAN2
void addfilter(void)
{
C1MOD =1; C2MOD =1;
AFMR = 0x00000001; // Disable the Acceptance filters to allow setup of
the table
SFF_sa = 0x00000000; // Set start address of Standard table
StandardFilter0 = 0x2002200A;
StandardFilter1 = 0x4001400B;
SFF_GRP_sa = 0x00000008; // Set start address of Standard group table
EFF_sa = 0x00000008; // Set start address of Extended table
EFF_GRP_sa = 0x00000008; // Set start address of Extended group table
ENDofTable = 0x00000008; // Set end of table address
AFMR = 0x00000000; // Enable Acceptance filters
C1MOD =0; C2MOD =0;
}
Acceptance filter CAZN problem LPC2129
Started by ●April 14, 2011
Reply by ●April 14, 20112011-04-14
hello, all my friend
the program work with the tow function,
but it work only when i press reset.
it have any relation with change value of parts of Filter Memory ?
thank you.
the program work with the tow function,
but it work only when i press reset.
it have any relation with change value of parts of Filter Memory ?
thank you.
Reply by ●April 14, 20112011-04-14
--- In l..., "zied130187" wrote:
>
> hello, all my friend
>
> the program work with the tow function,
>
> but it work only when i press reset.
>
> it have any relation with change value of parts of Filter Memory ?
>
> thank you.
>
i have found the problem.
i must be clear all memory before Set ID ACCeptance filters
//-------------------------
// Function Clear_filter()
//
//-------------------------
void Clear_filter(void)
{
AFMR = 0x01;
StandardFilter0 = 0x00;
StandardFilter1 = 0x00;
SFF_sa = 0x00;
SFF_GRP_sa = 0x00;
EFF_sa = 0x00;
EFF_GRP_sa = 0x00;
ENDofTable = 0x00;
AFMR = 0x00;
}
>
> hello, all my friend
>
> the program work with the tow function,
>
> but it work only when i press reset.
>
> it have any relation with change value of parts of Filter Memory ?
>
> thank you.
>
i have found the problem.
i must be clear all memory before Set ID ACCeptance filters
//-------------------------
// Function Clear_filter()
//
//-------------------------
void Clear_filter(void)
{
AFMR = 0x01;
StandardFilter0 = 0x00;
StandardFilter1 = 0x00;
SFF_sa = 0x00;
SFF_GRP_sa = 0x00;
EFF_sa = 0x00;
EFF_GRP_sa = 0x00;
ENDofTable = 0x00;
AFMR = 0x00;
}