Hi All,
I'm looking for an application note about the flexcan. I am not interesting on the example , I just want to understand how can change and set the main registers.
I saw the examples made by freescale for other but very similar microcontroller ( for example k60) but they don't have any notes about the implementantion.
Can someone help me?
Thanks
Hi Hui_Ma,
my TWR k70 at moment work fine at different baude rate from 83,3 k to 250 k with two clock reference ( 60 Mhz generated from PLL0 and 50 Mhz generated from external clock). I tryed to set the baud rate at 500k and 1M but the communication gets always errors.
I know the PLL clock has problem at high baud rate( tolerance problem) but using the external clock I should solve it.
Below you can see the register setting for two different baud rate 125k and 250 k respectively using as clock reference the external clock at 50 MHz:
125 K 50Mhz:
50M/50= 1M sclock,
1M/125k= 8Tq
PROPSEG = 2, RJW = 2, PSEG1 = 2, PSEG2 =2, PRESDIV = 50
So the register setting becames:
pFlexCANReg->CT2L1 = (0 | FLEXCAN_CTRL_PROPSEG(1)
| FLEXCAN_CTRL_RJW(1)
| FLEXCAN_CTRL_PSEG1(1)
| FLEXCAN_CTRL_PSEG2(2)
| FLEXCAN_CTRL_PRESDIV(49));
And
250 K 50Mhz:
50M/25= 2M sclock,
2M/250k= 8Tq
PROPSEG = 2 RJW = 1, PSEG1 = 2, PSEG2 =3, PRESDIV =2 4
So the register setting becames:
pFlexCANReg->CTRL1 = (0 | FLEXCAN_CTRL_PROPSEG(1)
| FLEXCAN_CTRL_RJW(1)
| FLEXCAN_CTRL_PSEG1(1)
| FLEXCAN_CTRL_PSEG2(2)
| FLEXCAN_CTRL_PRESDIV(24));
Using the same concepts if I tryed to set at 500 or 1000k with 50Mhz (external clock) the communication would get only faults .
Below the register setting:
** 50M/10= 5M sclock,
5M/500k=10Tq
** PROPSEG = 3
** RJW = 2, PSEG1 = 3, PSEG2 =3, PRESDIV = 10
*/
/* pFlexCANReg->CTRL1 = (0 | FLEXCAN_CTRL_PROPSEG(2)
| FLEXCAN_CTRL_RJW(2)
| FLEXCAN_CTRL_PSEG1(2)
| FLEXCAN_CTRL_PSEG2(2)
| FLEXCAN_CTRL_PRESDIV(9));
Do you have any suggests? Or any register setting that work fine?
Thanks in advance.
G.
Hi ,
I was able to set up a can communication in loop_mode( k70 sends and receives the same data enabling the loop_mode bit). Now I want to send message from k70 and visualize it with an oscilloscope or signal analyzer. My k70 is the only node of the bus and obviously it doesn't receive any ACK. In that configuration it sends always the same message ( because not receive ACK).
So, my question is :
Is there a way to avoid this problem and to send the message just when I want to send ( not continuously)?
Or otherwise, Is there a way to avoid that the k70 sends again the message?
Thanks in advance.
G.
Hi Hui_Ma,
your document will be very useful for my work.
Thank you very much.
Regards.
Gaetano
Hi Gaetano Anania,
I think , you can according to the chapter of flexcan in reference manual, it describe flexcan in details.
By the way, in our www.freescale.com, I find this link about can: http://www.freescale.com/webapp/sps/site/application.jsp?code=APLCAN
And, there are some documents, maybe is useful to you!
I wish it helps you!
Best regards!
Jing
Hi Jing,
thank you for your help. I 'll take you known about the improvment of my work...and I hope to have good news :-) !!!!
Regards.
Gaetano