Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
Problem in setting CAN ID filter - folg...@yahoo.com - Mar 11 12:02:28 2009
Hello,
I have a problem with setting the CAN ID filter. I use four 16 bit filter. I want to set
one filter now.
CAN0IDMR0 = 0xFF;
CAN0IDAR0 = 0x00;
CAN0IDMR1 = 0x18;
CAN0IDAR1 = 0x08;
CAN0IDMR2 = 0x00;
CAN0IDAR2 = 0x00;
CAN0IDMR3 = 0x00;
CAN0IDAR3 = 0x00;
CAN0IDMR4 = 0x00;
CAN0IDAR4 = 0x00;
CAN0IDMR5 = 0x00;
CAN0IDAR5 = 0x00;
CAN0IDMR6 = 0x00;
CAN0IDAR6 = 0x00;
CAN0IDMR7 = 0x00;
CAN0IDAR7 = 0x00;
CAN0IDAC |= 0x01;
I want that only messages with ID 001 can be received. But it does not work. I can receive
messages with ID 000 but not with 001. I had a look at the manual but I do not know what I
am doing wrong. Perhaps someone can tell me.
Thank you very much.
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Problem in setting CAN ID filter - kasu nandu - Mar 18 3:29:58 2009
Hello,
=A0
Inorder to receive only message with CAN ID "0x001", set the Mask and Accep=
tance registers as shown below.
=A0
CAN0IDMR0 =3D 0x00;
CAN0IDMR1 =3D 0x00;
=A0
CAN0IDAR0 =3D 0x00;
CAN0IDAR2 =3D 0x20;
=A0
Try the above settings, I hope this helps you./..
=A0
=A0
=A0=A0=A0=A0=A0=A0=A0=A0 =A0regards=20
Yadunandan Kasu(Nandu)
--- On Wed, 11/3/09, f...@yahoo.com
wrote:
From: f...@yahoo.com
Subject: [68HC12] Problem in setting CAN ID filter
To: 6...@yahoogroups.com
Date: Wednesday, 11 March, 2009, 9:30 PM
Hello,
I have a problem with setting the CAN ID filter. I use four 16 bit filter. =
I want to set one filter now.=20
CAN0IDMR0 =3D 0xFF;
CAN0IDAR0 =3D 0x00;
CAN0IDMR1 =3D 0x18;
CAN0IDAR1 =3D 0x08;
CAN0IDMR2 =3D 0x00;
CAN0IDAR2 =3D 0x00;
CAN0IDMR3 =3D 0x00;
CAN0IDAR3 =3D 0x00;
CAN0IDMR4 =3D 0x00;
CAN0IDAR4 =3D 0x00;
CAN0IDMR5 =3D 0x00;
CAN0IDAR5 =3D 0x00;
CAN0IDMR6 =3D 0x00;
CAN0IDAR6 =3D 0x00;
CAN0IDMR7 =3D 0x00;
CAN0IDAR7 =3D 0x00;
CAN0IDAC |=3D 0x01;=20
I want that only messages with ID 001 can be received. But it does not work=
.. I can receive messages with ID 000 but not with 001. I had a look at the=
manual but I do not know what I am doing wrong. Perhaps someone can tell m=
e..
Thank you very much.
Best regards=20
Cricket on your mind? Visit the ultimate cricket website. Enter http:=
//beta.cricket.yahoo.com
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com ) Re: Problem in setting CAN ID filter - folg...@yahoo.com - Mar 19 17:05:56 2009
> Hello,
> Inorder to receive only message with CAN ID "0x001", set the Mask and
> Acceptance registers as shown below.
> CAN0IDMR0 = 0x00;
> CAN0IDMR1 = 0x00;
> CAN0IDAR0 = 0x00;
> CAN0IDAR2 = 0x20;
> Try the above settings, I hope this helps you./..
Hello,
I tried the settings but it does not work. Has anybody another idea. I had a look at the
manual but I do not know what I am doing wrong. Perhaps someone could explain the
structure of the filters to me, which bits are important for the different filters and so
on.
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Re: Problem in setting CAN ID filter - kasu nandu - Mar 20 5:47:41 2009
Hi,
=A0
1. Are you writing "0xFF" to any of the mask registers i.e. CAN0IDMR0~7 ?? =
you should not write the value of "0xFF"=A0to these registers in your case.
=A0
2. What value are setting to the register "CAN0IDAC" ?? It is recommended t=
o set the value of "0x10", if you are using Standard message format. (i.e. =
message with 11-bit CAN ID)
=A0
Try the above settings and check. If it doesnt work.. then I think may be t=
he problem is in your code.
=A0
=A0=A0=A0=A0=A0=A0=A0=A0 =A0regards=20
Yadunandan Kasu(Nandu)
--- On Fri, 20/3/09, f...@yahoo.com
wrote:
From: f...@yahoo.com
Subject: [68HC12] Re: Problem in setting CAN ID filter
To: 6...@yahoogroups.com
Date: Friday, 20 March, 2009, 1:08 AM
> Hello,
> Inorder to receive only message with CAN ID "0x001", set the Mask and=20
> Acceptance registers as shown below.
> CAN0IDMR0 =3D 0x00;
> CAN0IDMR1 =3D 0x00;
> CAN0IDAR0 =3D 0x00;
> CAN0IDAR2 =3D 0x20;
> Try the above settings, I hope this helps you./..
Hello,
I tried the settings but it does not work. Has anybody another idea. I had =
a look at the manual but I do not know what I am doing wrong. Perhaps someo=
ne could explain the structure of the filters to me, which bits are importa=
nt for the different filters and so on.
Best regards
Add more friends to your messenger and enjoy! Go to http://messenger.=
yahoo.com/invite/
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )Re: Problem in setting CAN ID filter - folg...@yahoo.com - Mar 20 10:34:49 2009
Hello,
here are parts of my code:
typedef struct
{
unsigned int IDAC;
unsigned int CANidar0;
unsigned int CANidmr0;
unsigned int CANidar1;
unsigned int CANidmr1;
unsigned int CANidar2;
unsigned int CANidmr2;
unsigned int CANidar3;
unsigned int CANidmr3;
unsigned int CANidar4;
unsigned int CANidmr4;
unsigned int CANidar5;
unsigned int CANidmr5;
unsigned int CANidar6;
unsigned int CANidmr6;
unsigned int CANidar7;
unsigned int CANidmr7;
}FILTER;
FILTER stFilter=
{
0x10, // IDAC
0x00, 0x00, // (CANidar0, CANidmr0)
0x00, 0x00, // (CANidar1, CANidmr1)
0x20, 0x00, // (CANidar2, CANidmr2)
0x00, 0x00, // (CANidar3, CANidmr3)
0x00, 0x00, // (CANidar4, CANidmr4)
0x00, 0x00, // (CANidar5, CANidmr5)
0x00, 0x00, // (CANidar6, CANidmr6)
0x00, 0x00 // (CANidar7, CANidmr7)
};
Filter(stFilter);
char Filter(FILTER fi)
{
CAN0IDAC |= acfi.IDAC;
CAN0IDMR0 = acfi.CANidmr0;
CAN0IDAR0 = fi.CANidar0;
CAN0IDMR1 = fi.CANidmr1;
CAN0IDAR1 = fi.CANidar1;
CAN0IDMR2 = fi.CANidmr2;
CAN0IDAR2 = fi.CANidar2;
CAN0IDMR3 = fi.CANidmr3;
CAN0IDAR3 = fi.CANidar3;
CAN0IDMR4 = fi.CANidmr4;
CAN0IDAR4 = fi.CANidar4;
CAN0IDMR5 = fi.CANidmr5;
CAN0IDAR5 = fi.CANidar5;
CAN0IDMR6 = fi.CANidmr6;
CAN0IDAR6 = fi.CANidar6;
CAN0IDMR7 = fi.CANidmr7;
CAN0IDAR7 = fi.CANidar7;
}
But it does not work. I am only able to receive messages with ID 0x000. For example 0x001
or 0x002 do not work.
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: Re: Problem in setting CAN ID filter - Edward Karpicz - Mar 20 11:07:58 2009
To ignore ID bits, corresponding DMR bits should be set to '1'. You have all
DMR's set to all zeros.
When DMRx bit is zero, then corrsponding IDRx bit should match corrsponding
DARx bit, else message won't pass.
To accept all messages simply set all DMR bits to ones.
If your code receives standard id messages with id 0, then it should receive
also 0x100. In 4x16bit filters mode (IDAC = 0x10), idar2 and idar3 form
16bit filter. If you check message buffer layout (look in datasheets for
figures Receive / Transmit Message Buffer Standard Identifier and the same
for Extended Identifier), then you should find that 0x20 in IDR0 and 0 in
IDR1 means message ID = ((0x20<<8) | 0x00) >> 5 = 0x100.
Edward
----- Original Message -----
From:
To: <6...@yahoogroups.com>
Sent: Friday, March 20, 2009 16:23
Subject: [68HC12] Re: Problem in setting CAN ID filter
> Hello,
>
> here are parts of my code:
>
> typedef struct
> {
> unsigned int IDAC;
> unsigned int CANidar0;
> unsigned int CANidmr0;
> unsigned int CANidar1;
> unsigned int CANidmr1;
> unsigned int CANidar2;
> unsigned int CANidmr2;
> unsigned int CANidar3;
> unsigned int CANidmr3;
> unsigned int CANidar4;
> unsigned int CANidmr4;
> unsigned int CANidar5;
> unsigned int CANidmr5;
> unsigned int CANidar6;
> unsigned int CANidmr6;
> unsigned int CANidar7;
> unsigned int CANidmr7;
> }FILTER;
>
> FILTER stFilter=
> {
> 0x10, // IDAC
> 0x00, 0x00, // (CANidar0, CANidmr0)
> 0x00, 0x00, // (CANidar1, CANidmr1)
> 0x20, 0x00, // (CANidar2, CANidmr2)
> 0x00, 0x00, // (CANidar3, CANidmr3)
> 0x00, 0x00, // (CANidar4, CANidmr4)
> 0x00, 0x00, // (CANidar5, CANidmr5)
> 0x00, 0x00, // (CANidar6, CANidmr6)
> 0x00, 0x00 // (CANidar7, CANidmr7)
> };
> Filter(stFilter);
> char Filter(FILTER fi)
> {
> CAN0IDAC |= acfi.IDAC;
>
> CAN0IDMR0 = acfi.CANidmr0;
> CAN0IDAR0 = fi.CANidar0;
> CAN0IDMR1 = fi.CANidmr1;
> CAN0IDAR1 = fi.CANidar1;
> CAN0IDMR2 = fi.CANidmr2;
> CAN0IDAR2 = fi.CANidar2;
> CAN0IDMR3 = fi.CANidmr3;
> CAN0IDAR3 = fi.CANidar3;
> CAN0IDMR4 = fi.CANidmr4;
> CAN0IDAR4 = fi.CANidar4;
> CAN0IDMR5 = fi.CANidmr5;
> CAN0IDAR5 = fi.CANidar5;
> CAN0IDMR6 = fi.CANidmr6;
> CAN0IDAR6 = fi.CANidar6;
> CAN0IDMR7 = fi.CANidmr7;
> CAN0IDAR7 = fi.CANidar7;
> }
> But it does not work. I am only able to receive messages with ID 0x000.
> For example 0x001 or 0x002 do not work.
>
> Best regards
>
> ------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )Re: Problem in setting CAN ID filter - folg...@yahoo.com - Mar 23 7:00:53 2009
Hello,
thank you very much for the detailed explication!
Best regards
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )