5213 CAN driver

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

5213 CAN driver

7,287 Views
JayJay
Contributor I
Hello
 
Does anyone have a CAN driver source for the 5213?
 
Thanks
Jay
Labels (1)
0 Kudos
12 Replies

921 Views
hjo
Contributor I
this might be helpful

http://www.port.de/engl/can4linuxCF.html

contains a pointer to the uClinux CAN device driver

Heinz
0 Kudos

921 Views
DavidS
NXP Employee
NXP Employee

Hi JayJay,

Enclosed is some MCF5282 CAN code that should help get you going.

TechOnLine has a MCF5282 CAN demo as well:

http://www.techonline.com/community/prod_eval/devel_systems/29527

Regards,

DavidS

0 Kudos

921 Views
krishna123
Contributor I
Hi DavidS,
 
       This is krishna new to CAN drivers but having a basic knowledge @ application level. Now I am Interested in writing CAN drivers for MCF5282.Can You help me if you have any source for CAN ? Can I know the Can.zip file you posted is for linux or windows ? As I am interested in windows and it will be helpful if you suggest how to start a CAN driver like any documents to read ?
 
Awaiting for your positive reply
Regards
krishna
0 Kudos

921 Views
DavidS
NXP Employee
NXP Employee
Hi Krishna,
I've attached an old CodeWarrior project that has some simple FlexCAN test code.
This code was used to verify the CAN interface physical connection of the evaluation board by the board manufacturer. 
Regards,
David
0 Kudos

921 Views
krsihna1234
Contributor I
Hi David,
 
    Can I get any document related to the code you posted (can.zip) to understand the drivers.
    Your reply is very helpful.
 
   With Regards,
   krishna
0 Kudos

921 Views
SARY
Contributor III

hi

 I m new  to CAN drivers.  Now I am  writing CAN drivers for MC9S12XHZ512.Actually, I m not able to transmit data on CAN,though I can receive it.Can You help me if you have any source code for CAN ?

or have any idea about register settings for MC9S12XHZ512.Awaiting for your positive reply.

0 Kudos

921 Views
JayJay
Contributor I
Krishna,

I guess you are getting confuesed by the CAN bit timings, you can take a look at the following links to clarify why the values are there for:-

http://www.mjschofield.com/timesync.htm
http://books.google.com/books?id=6EI640dkJGEC&pg=RA2-PA490&lpg=RA2-PA490&dq=tini+can+timing&source=w...

HTH
Jay
0 Kudos

921 Views
admin
Specialist II
Hi Jay,
 
I have gone through the code (can.zip) but i have one query in flex_unit_init() function.
 
Actually in this function a long pointer is declared and is assigned with  (0x00000000+0x0220) address.
later point of time this pointer is pointed to can_rx interrupt etc.
 
I am not clear what exactly happening here. Is the pointers used to register the isr's or whatelse??
 
If you have any idea about this, please let me know.
 
Code snippet:
 
/*------------------------------------------------------*/
can_flexcan_init(void)
{
    uint8  j, i;
 unsigned long *mbuf0 = (unsigned long *) (0x00000000+0x0220);
 unsigned long *mbuf1 = (unsigned long *) (0x00000000+0x0224);
 unsigned long *mbuf2 = (unsigned long *) (0x00000000+0x0228);
 unsigned long *mbuf3 = (unsigned long *) (0x00000000+0x022C);
 unsigned long *mbuf4 = (unsigned long *) (0x00000000+0x0230);
 unsigned long *mbuf5 = (unsigned long *) (0x00000000+0x0234);
 unsigned long *mbuf6 = (unsigned long *) (0x00000000+0x0238);
 unsigned long *mbuf7 = (unsigned long *) (0x00000000+0x023C);
 unsigned long *mbuf8 = (unsigned long *) (0x00000000+0x0240);
 unsigned long *mbuf9 = (unsigned long *) (0x00000000+0x0244);
 unsigned long *mbuf10 = (unsigned long *) (0x00000000+0x0248);
 unsigned long *mbuf11 = (unsigned long *) (0x00000000+0x024C);
 unsigned long *mbuf12 = (unsigned long *) (0x00000000+0x0250);
 unsigned long *mbuf13 = (unsigned long *) (0x00000000+0x0254);
 unsigned long *mbuf14 = (unsigned long *) (0x00000000+0x0258);
 unsigned long *mbuf15 = (unsigned long *) (0x00000000+0x025C);
 unsigned long *fl_error = (unsigned long *) (0x00000000+0x0260);
 unsigned long *fl_boff = (unsigned long *) (0x00000000+0x0264);
 unsigned long *fl_wakeup = (unsigned long *) (0x00000000+0x0268);
 
 *mbuf0 = (unsigned long) can_Rx;
 *mbuf1 = (unsigned long) can_Rx;
 *mbuf2 = (unsigned long) can_Rx;
 *mbuf3 = (unsigned long) can_Rx;
 *mbuf4 = (unsigned long) can_Rx; 
 *mbuf5 = (unsigned long) can_Rx; 
 *mbuf6 = (unsigned long) can_Rx; 
 *mbuf7 = (unsigned long) can_Rx; 
 *mbuf8 = (unsigned long) can_Rx; 
 *mbuf9 = (unsigned long) can_Rx; 
 *mbuf10 = (unsigned long) can_Rx; 
 *mbuf11 = (unsigned long) can_Tx; 
 *mbuf12 = (unsigned long) can_Remote; 
 *mbuf13 = (unsigned long) can_Remote; 
 *mbuf14 = (unsigned long) can_Rx; 
 *mbuf15 = (unsigned long) can_Rx;
 
 *fl_error = (unsigned long) can_Error ;
 *fl_boff = (unsigned long) can_Bus_Off ;
 *fl_wakeup = (unsigned long) can_Wake_Up ;
 
}
/*------------------------------------------------------*/
 
Thanks in advance.
 
Warm Regards
Srinivas
0 Kudos

921 Views
krishna123
Contributor I
Hi David,
 
      Thanks for your valuable response.
 
      As I said before we have to write CAN drivers for freescale MCF5282. I would like to know the code posted by you(can.zip (18 kb) on 2006-04-08  ) is for linux ? Can I know for writing CAN drivers MCF5282 datasheet is sufficient or anything we have to read any other doc's  ?
 
Awaiting for your positive reply.
 
Thanx in advance
Regards,
krishna
0 Kudos

921 Views
JayJay
Contributor I
Hello Krishna,

The code David has posed is for Codewarrior Development Tool targetting the ColdFIre processor. As far as I know the CodeWarrior only runs on Windows. If you would like to develop under linux, then you might have to port the code to gcc and yes you would need all the help from the device datasheet for it.

Hope this helps.

Regds
Jay
0 Kudos

921 Views
krsihna1234
Contributor I
HI Jay,
 
   Thanks for your valuable response.
 
   I am having few doubts regarding CAN driver. Please help me regarding this.The questions related here are based on the can.zip provided by Mr.David.
 
1. can you explain the below structure how you got the values.
 
FileName :- can_init.c
 
can_SpeedParam_t can_SpeedParam[] = {
 {125000, 15, 16, 3, 8, 4, 2, 0,  1},
 {250000, 7, 16, 3, 8, 4, 2, 0,  1},
 {500000, 3, 16, 8, 5, 2, 2, 0,  1},
 {800000, 3, 10, 4, 3, 2, 2, 0,  1},
 {1000000, 3, 8, 2, 3, 2, 2, 0,  1}
 
2.In Function void can_flexcan_init(void)
 
  unsigned long *mbuf0 = (unsigned long *) (0x00000000+0x0220);
 
  In above line how *mbuf0 is pointing to 0x00000220 address ? Is there any requirement or from where 0x0220 value got ?
 
3.*mbuf0 = (unsigned long) can_Rx;
 
    In above line Can_Rx is a interrupt which returns nothing i.e void then why is type casted to (unsigned long) can we call the interrupt like that ? can you please explain ?
 
4.MCF5282_INTC1_ICR08 = MCF5282_INTC_ICR_IL(5) | MCF5282_INTC_ICR_IP(2); // MBUF0
 
  In the above line how the Interrupt flag is setting ? what is MCF5282_INTC_ICR_IL and MCF5282_INTC_ICR_IP stands for ? those are #defines value.
 
 can you explain the above line(point 4) please.
 
5. In one file under fat folder (FLEXCAN_test) there one line says that
set s-clock to 500kHz. i.e MCF5282_FLEXCAN_PRESDIV = 0x83 can you explain how it is set to 500kHz.I have read the bit timming reuirements but not understood properely. As per formulae to find
s-clock =  fsys/2(PRESDIV+1), As per the formulae I am not getting 500kHz.Help me in this regards.
 
Awaiitng for your positive reply.
 
Regards,
krishna
 
 
 
 
 
 
 
0 Kudos

921 Views
JayJay
Contributor I

Hello David,

Thanks for the files, I will try it out on the 5213EVB :smileyhappy:

Cheers
Jay

 

 

 

0 Kudos