-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eric Bénard wrote:
> Le 17/06/2010 16:33, Marc Kleine-Budde a écrit :
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Eric Bénard wrote:
>>> Hi Marc,
>>>
>>> Le 17/06/2010 16:21, Marc Kleine-Budde a écrit :
>>>> +static struct can_bittiming_const flexcan_bittiming_const = {
>>>> + .name = DRV_NAME,
>>>> + .tseg1_min = 4,
>>>
>>> why do you use 4 here ? From the manual this can be 1.
>>
>> I'm using the mx25 datasheet, see section 26/40, figure 26-18, it says:
>>
>> Time Segment 1 = PROG_SEG + PSEG1 +2 = 4...16
>> Time Segment 2 = PSEG2 + 1 = 2...8
>>
> seems a very good reason ;-)
the "funny" thing is the currently used algorithm provides better values
with a tseg_min of 4 the with 2. The bitrate errors percentage is
comparable low, but the sample point error is bigger.
Probably due to this:
If you have lesser number of entities (I means this blocks with the
length of a time quanta), you loose time resolution to position your
sample point.
> [frog...@hardanger:berlios-can-utils (test)]$ ./can-calc-bit-timing flexcan
tseg1_min == 4, 49.875000 MHz ref clock
> Bit timing parameters for flexcan with 49.875000 MHz ref clock
> nominal real Bitrt nom real SampP
> Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP Bitrate Error SampP SampP Error
> CAN_CTRL
> 1000000 200 1 1 2 1 10 997500 0.2% 75.0% 60.0% 20.0%
> 0x09010000
> 800000 180 2 2 2 1 9 791666 1.0% 80.0% 71.4% 10.8%
> 0x08090001
> 500000 401 1 1 2 1 20 498750 0.2% 87.5% 60.0% 31.4%
> 0x13010000
> 250000 802 1 1 2 1 40 249375 0.2% 87.5% 60.0% 31.4%
> 0x27010000
> 125000 421 7 8 3 1 21 125000 0.0% 87.5% 84.2% 3.8%
> 0x143a0006
> 100000 1664 1 2 2 1 83 100150 0.1% 87.5% 66.6% 23.9%
> 0x52090000
> 50000 3328 1 2 2 1 166 50075 0.1% 87.5% 66.6% 23.9%
> 0xa5090000
> 20000 3568 5 6 2 1 178 20014 0.1% 87.5% 85.7% 2.1%
> 0xb1290004
> 10000 4350 8 8 6 1 217 9992 0.1% 87.5% 73.9% 15.5%
> 0xd83d0007
>
tseg1_min == 2
> Bit timing parameters for flexcan with 49.875000 MHz ref clock
> nominal real Bitrt nom real SampP
> Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP Bitrate Error SampP SampP Error
> CAN_CTRL
> 1000000 100 3 3 3 1 5 997500 0.2% 75.0% 70.0% 6.7%
> 0x04120002
> 800000 180 2 2 2 1 9 791666 1.0% 80.0% 71.4% 10.8%
> 0x08090001
> 500000 200 3 4 2 1 10 498750 0.2% 87.5% 80.0% 8.6%
> 0x09190002
> 250000 501 2 3 2 1 25 249375 0.2% 87.5% 75.0% 14.3%
> 0x18110001
> 125000 421 7 8 3 1 21 125000 0.0% 87.5% 84.2% 3.8%
> 0x143a0006
> 100000 1002 3 4 2 1 50 99750 0.2% 87.5% 80.0% 8.6%
> 0x31190002
> 50000 1664 4 5 2 1 83 50075 0.1% 87.5% 83.3% 4.8%
> 0x52210003
> 20000 3568 5 6 2 1 178 20014 0.1% 87.5% 85.7% 2.1%
> 0xb1290004
> 10000 4350 8 8 6 1 217 9992 0.1% 87.5% 73.9% 15.5%
> 0xd83d0007
>
tseg1_min == 4, 66.500000 MHz ref clock
> Bit timing parameters for flexcan with 66.500000 MHz ref clock
> nominal real Bitrt nom real SampP
> Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP Bitrate Error SampP SampP Error
> CAN_CTRL
> 1000000 165 1 2 2 1 11 1007575 0.8% 75.0% 66.6% 11.2%
> 0x0a090000
> 800000 210 1 2 2 1 14 791666 1.0% 80.0% 66.6% 16.8%
> 0x0d090000
> 500000 105 7 8 3 1 7 500000 0.0% 87.5% 84.2% 3.8%
> 0x063a0006
> 250000 285 5 6 2 1 19 250000 0.0% 87.5% 85.7% 2.1%
> 0x12290004
> 125000 571 5 6 2 1 38 125000 0.0% 87.5% 85.7% 2.1%
> 0x25290004
> 100000 526 7 8 3 1 35 100000 0.0% 87.5% 84.2% 3.8%
> 0x223a0006
> 50000 1428 5 6 2 1 95 50000 0.0% 87.5% 85.7% 2.1%
> 0x5e290004
> 20000 2631 7 8 3 1 175 20000 0.0% 87.5% 84.2% 3.8%
> 0xae3a0006
> 10000 ***bitrate not possible***
>
tseg1_min == 2
> Bit timing parameters for flexcan with 66.500000 MHz ref clock
> nominal real Bitrt nom real SampP
> Bitrate TQ[ns] PrS PhS1 PhS2 SJW BRP Bitrate Error SampP SampP Error
> CAN_CTRL
> 1000000 90 3 4 3 1 6 1007575 0.8% 75.0% 72.7% 3.1%
> 0x051a0002
> 800000 180 2 2 2 1 12 791666 1.0% 80.0% 71.4% 10.8%
> 0x0b090001
> 500000 105 7 8 3 1 7 500000 0.0% 87.5% 84.2% 3.8%
> 0x063a0006
> 250000 285 5 6 2 1 19 250000 0.0% 87.5% 85.7% 2.1%
> 0x12290004
> 125000 571 5 6 2 1 38 125000 0.0% 87.5% 85.7% 2.1%
> 0x25290004
> 100000 526 7 8 3 1 35 100000 0.0% 87.5% 84.2% 3.8%
> 0x223a0006
> 50000 1428 5 6 2 1 95 50000 0.0% 87.5% 85.7% 2.1%
> 0x5e290004
> 20000 2631 7 8 3 1 175 20000 0.0% 87.5% 84.2% 3.8%
> 0xae3a0006
> 10000 ***bitrate not possible***
>
cheers, Marc
- --
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkwaOggACgkQjTAFq1RaXHO2yACeLglHICSBpctN9JFHwi340FtX
9x4An2aUdc1Dd1rCKPNZEHM8PM+RtxLT
=cObF
-----END PGP SIGNATURE-----
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core