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.