On Tue, Mar 09, 2010 at 02:36:51PM +0100, Wolfgang Grandegger wrote: > Kurt Van Dijck wrote: > > On Tue, Mar 09, 2010 at 01:39:53PM +0100, Wolfgang Grandegger wrote: > >> Schubert, Thorsten wrote: > >>> I am struggling with the CAN bit-timing. I implemented an SJA1000 driver > >>> on top of the SJA1000 kernel module which comes with Linux 2.6.31. So > >>> far it > >>> seems to work except that the bitrate is off by factor two, i.e. a > >> To be clear here, for the SJA1000 you have to set "priv->can.clock.freq" > >> to half of the oscillator frequency, e.g. to 8000000 for 16MHz. This is > >> actually the frequency before the pre-scaler, which is used by the > >> bit-timing calculation algorithm. This is special to the SJA1000. > >> > > [...] > >> values. To avoid further confusion, we might think of adding a field > >> .brp_div, which we would set to "2" for the SJA1000. All other (or > >> most?) CAN controllers would use "1". > > ack. This would avoid confusion. > > ... added in struct can_bittiming_const would be my guess. > > Is it worth the effort? Only the SJA1000 will need it, IIRC. not sure on this. The effort in socketcan itself is limited (I think), but the effort in platform_data's all over the world may be bigger. But I understand the confusion very well. I have been struggling with the same issue in the past (non-socketCAN) for sja1000.
Maybe some documentation next to the SJA1000 platform data can hold too, saving transient problems and some effort. > > Wolfgang. Kurt _______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
