Mscan configuartion in can driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mscan configuartion in can driver

4,725 Views
candriver
Contributor I
Dear friends..
 
Sorry i am asking very stupid quetion at this stage....i am working on demo board of MC9S12XDT512...i have to send my data to 0x100 ID....so i configuerd MSCAN module register like this:

#define CANIDAC_CAN0  IDAM0                  /* 4 x 16-bit filters */

#define CANIDAR0_CAN0 0x10

#define CANIDAR1_CAN0 0

#define CANIDMR0_CAN0 0xFF      /* mask all bits */

#define CANIDMR1_CAN0 0xFF      /* mask all bits */

?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:smileysurprised:ffice:smileysurprised:ffice" /> 

 

 

#define CANIDAR2_CAN0 0x10

#define CANIDAR3_CAN0 0

#define CANIDMR2_CAN0 0xFF      /* mask all bits */

#define CANIDMR3_CAN0 0xFF      /* mask all bits */

 

 

#define CANIDAR4_CAN0 0x10

#define CANIDAR5_CAN0 0

#define CANIDMR4_CAN0 0xFF      /* mask all bits */

#define CANIDMR5_CAN0 0xFF      /* mask all bits */

 

 

#define CANIDAR6_CAN0 0x10

#define CANIDAR7_CAN0 0

#define CANIDMR6_CAN0 0xFF      /* mask all bits */

#define CANIDMR7_CAN0 0xFF      /* mask all bits */

 

but when i run this configuration in can driver using cw4.5 it is not properly working.....if there s any mistake plzzz find it out for me???i configuired as a loop back mode....

:
Labels (1)
0 Kudos
10 Replies

1,120 Views
tranvkhoa
Contributor I
Dear Can Driver
 
If possible, could you send me the can driver that works on MC9S12XDT512. I want to test CAN communication on my demo boards DEMO9S12XDT512.
 
Thanks so much.
0 Kudos

1,120 Views
Alban
Senior Contributor II
Hello,

CAN Drivers are available for download from the product page in Application Notes.
They are included in the Gateway Application.

I do not send files via email since this is the opposite spirit of a Forum.

Regards,
Alban.
0 Kudos

1,120 Views
tranvkhoa
Contributor I
Dear Alban
 
Could you tell me what CAN application notes that can be applied for this MCU?
 
Thanks,
Khoa
 
0 Kudos

1,120 Views
Alban
Senior Contributor II
Hello,

Freescale search engine is the way to look for things.
It allows everyone to get an immediate reply and prevent delays from waiting for replies.

That is exactly what I did:

AN3145  XGATE Library: Using the Freescale XGATE Software LibraryApplication NotesFREESCALEpdf14202/28/2006
AN3333  XGATE Library: Signal Gateway. Implementing CAN and LIN Signal Level GatewayApplication NotesFREESCALEpdf575011/7/2006
AN2726  MSCAN Driver for MC9S12XDP512 Using XGATEApplication NotesFREESCALEpdf22614/21/2006

Alban.
0 Kudos

1,120 Views
tranvkhoa
Contributor I
Dear Alban
 
Thanks for your kind help.
I also found this application notes, however, I'm wondering if there is any CAN driver for XDT512 without using XGate. Sorry for the unclear question before.
 
Best regards.
Khoa
0 Kudos

1,120 Views
Alban
Senior Contributor II
In this case, I advise you to look for S12 resource.
The msCAN module used is the same (except user transparent internal fix) on the S12XD as it is on S12D.
For instance, if you find code for the MC9S12DG128, it will be a perfect fit.

Nevertheless, I would strongly encourage you to use the XGATE.

Alban.
0 Kudos

1,120 Views
andrea_mocci
Contributor II

Hi Alban,

I am using an MC912G48 and, unfortunately, it does not have any XGATE co-processor. Do you have a driver version for this target? I am googling for it but I have not found yet anything!!!

Any suggestion would be appreciated!!!

Thank you in advance,

Best regards,

Andrea Mocci

0 Kudos

1,120 Views
DannyM83
Contributor III
By setting the mask bits to 0xFF you are turning off the comparison. Only bits with a corresponding mask bit of 0 are compared, those with a mask bit of 1 are ignored.

Your code should look something like this:

Code:
#define CANIDAC_CAN0  IDAM0  /* 4 x 16-bit filters */#define CANIDAR0_CAN0 0x0010            /* set 16 bit acceptance register */#define CANIDAR1_CAN0 0               #define CANIDMR0_CAN0 0xFFFFF800 /* compare only first 11-bits as per CAN spec */#define CANIDMR1_CAN0 0xFFFFFFFF /* mask all bits */

 

0 Kudos

1,120 Views
candriver
Contributor I
Thanks a lot sir....again i have to ask 1 question sir suppose i have to send messsage to different IDs like 0x123 and 0x700 then how should i configure IDR and mask registers..........
 
Thanks
0 Kudos

1,120 Views
DannyM83
Contributor III
The ID is message specific, not node specific. If you consult the CAN spec you will find that nodes are not labelled.

If you wish a node to accept several message ID's you should setup the IDAR and IDMR registers correctly.

e.g.

If IDAR = 0011 and IDMR = 000F then the node will accept two different message id's: 0010 and 0011.

0 Kudos