Hello, all

I am one of the socketcan users. The kernel I am using is 2.6.29.1. So I can 
only change the baud rate of the can bus using the ioctl() function. I find 
this usage from the cantest project. If I want to set the baud rate as 1Mbps, I 
should write the code as follows:

struct ifreq ifr;
int s;
.......
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
ifr.ifr_ifru.ifru_ivalue = 1000000;
ret = ioctl(s, SIOCSCANBAUDRATE, &ifr);

But I find that the actual baud rate is 666.7Kbps, which is 2/3 of 1000Kbps. 
Then I try some other values. I find that all of the actual baud rate is 2/3 of 
the setting value. It is very strange. I find that that is a function in the 
file ./net/can/dev.c, named can_calc_bit_time. This function change the baud 
rate to bit rate. So does this function correct ?

Plus, the board I am using is TWR-MPC5125 provided by freescale.




Guohu Li
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to