--- 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;
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;
}