µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: tr111 on November 14, 2007, 10:30:12 AM
-
I can't understand that :
switch (pars->ulSpeed) { // M5223X EVB
case 1000000:
CANCTRL = ((3 << 24) | RJW_2 | EXTAL_CLK_SOURCE | PROPSEG_BIT_TIME2 | PHASE_BUF_SEG1_LEN3 | PHASE_BUF_SEG2_LEN2); // Initialise the CAN controller with the required speed and parameters
break;
default: // 40 KHz
CANCTRL = ((24 << 24) | RJW_2 | EXTAL_CLK_SOURCE | PROPSEG_BIT_TIME8 | PHASE_BUF_SEG1_LEN8 | PHASE_BUF_SEG2_LEN8); // Initialise the CAN controller with the required speed and parameters
break;
}
BUT I want to get the 100 khz,how can I get???
-
Hi
The calculation of the bit times is not that easy and so there are two values in the driver:
- a slow one which can be useful if the bus seems to be unreliable (assuming that slower speeds are more likely to work even when there is a problem with the connection). 40kHz was chosen.
- the 'normal' speed which most people use - 1MHz.
If you need a different frequency you can add a set using a new case statement with the speed you need. It is best to carefully calculate the set up of the speed (it is not really possible to calculate it from a formular since there are various times which need to be set to suit it. This is a bit imperical.)
Regards
Mark