i have found this example of CAN bitrate calculation :
CAN clock setting for 100 usec
CLK = 14745600
(VPBDIV=0) -> PCLK = CLK/4
Example
BRP = 0x16 " SJW = 0
TSEG1 = 0xC TSEG2 = 1
(BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
BIT = -------
PCLK
23 * ( 1+13+2 ) 23*16
BIT = --------------------- = ------------- = 100 usec
14745600 / 4 14745600 / 4
CANBTR register setting (C1BTR and C1BTR)
SAM=0 Bus is sampled once
TSEG1 = 0xC
TSEG2 = 1
SJW = 0
BRP = 0x16 "
**************************************************************
i don't found this formula in datasheet !!
how to know if the formula is correct or not ??
and how choose the value of paramaters (SAM=0 ? , TSEG1 = 12 ? , ...)
any one can explaine me who calculate the bitrate of CAN for LPC2129
thank you
LPC2129 CAN bitrate calculation problem
Started by ●December 28, 2010
Reply by ●December 28, 20102010-12-28
i have found this example of CAN bitrate calculation
** CAN clock setting for 100 usec
** CLK = 1/14745600
** PCLK = 1/(4*CLK) (VPBDIV=0) -> PCLK = CLK/4
**
** Example
** BRP = 0x16 " SJW = 0
** TSEG1 = 0xC TSEG2 = 1
**
** (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
** BIT = -------
** PCLK
**
** 23 * ( 1+13+2 ) 23*16
** BIT = --------------------- = ------------- = 100 usec
** 14745600 / 4 14745600 / 4
**
**
** CANBTR register setting (C1BTR and C1BTR)
** SAM=0 Bus is sampled once
** TSEG1 = 0xC
** TSEG2 = 1
** SJW = 0
** BRP = 0x16 "
*****************************************************************
i don't found this formula in datasheet !!
(BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
BIT = -------
PCLK
who to know if this formula is correct or not ?
and why he choose this value of paramaters ?
SAM=0 Bus is sampled once
TSEG1 = 0xC
TSEG2 = 1
SJW = 0
BRP = 0x16 "
can someone explain me why TSEG1 = 12 and not = 13 ?
and for others paramaters
thank you
** CAN clock setting for 100 usec
** CLK = 1/14745600
** PCLK = 1/(4*CLK) (VPBDIV=0) -> PCLK = CLK/4
**
** Example
** BRP = 0x16 " SJW = 0
** TSEG1 = 0xC TSEG2 = 1
**
** (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
** BIT = -------
** PCLK
**
** 23 * ( 1+13+2 ) 23*16
** BIT = --------------------- = ------------- = 100 usec
** 14745600 / 4 14745600 / 4
**
**
** CANBTR register setting (C1BTR and C1BTR)
** SAM=0 Bus is sampled once
** TSEG1 = 0xC
** TSEG2 = 1
** SJW = 0
** BRP = 0x16 "
*****************************************************************
i don't found this formula in datasheet !!
(BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
BIT = -------
PCLK
who to know if this formula is correct or not ?
and why he choose this value of paramaters ?
SAM=0 Bus is sampled once
TSEG1 = 0xC
TSEG2 = 1
SJW = 0
BRP = 0x16 "
can someone explain me why TSEG1 = 12 and not = 13 ?
and for others paramaters
thank you
Reply by ●December 28, 20102010-12-28
Once upon a time there was a german company with a funny idea:
http://www.silabs.com/Support%20Documents/TechnicalDocs/Bosch_CAN_Users_\
Guide.pdf
_Guide.pdf>
or google "C_CAN user's manual" BOSCH
In this manual you will formulas, formulas and formulas....
--- In l..., "zied130187" wrote:
>
> i have found this example of CAN bitrate calculation
>
> ** CAN clock setting for 100 usec
> ** CLK = 1/14745600
> ** PCLK = 1/(4*CLK) (VPBDIV=0) -> PCLK = CLK/4
> **
> ** Example
> ** BRP = 0x16 " SJW = 0
> ** TSEG1 = 0xC TSEG2 = 1
> **
> ** (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> ** BIT = -------
> ** PCLK
> **
> ** 23 * ( 1+13+2 ) 23*16
> ** BIT = --------------------- = ------------- = 100 usec
> ** 14745600 / 4 14745600 / 4
> **
> **
> ** CANBTR register setting (C1BTR and C1BTR)
> ** SAM=0 Bus is sampled once
> ** TSEG1 = 0xC
> ** TSEG2 = 1
> ** SJW = 0
> ** BRP = 0x16 "
>
> *****************************************************************
> i don't found this formula in datasheet !!
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> who to know if this formula is correct or not ?
>
> and why he choose this value of paramaters ?
>
> SAM=0 Bus is sampled once
> TSEG1 = 0xC
> TSEG2 = 1
> SJW = 0
> BRP = 0x16 "
>
> can someone explain me why TSEG1 = 12 and not = 13 ?
> and for others paramaters
>
> thank you
>
http://www.silabs.com/Support%20Documents/TechnicalDocs/Bosch_CAN_Users_\
Guide.pdf
_Guide.pdf>
or google "C_CAN user's manual" BOSCH
In this manual you will formulas, formulas and formulas....
--- In l..., "zied130187" wrote:
>
> i have found this example of CAN bitrate calculation
>
> ** CAN clock setting for 100 usec
> ** CLK = 1/14745600
> ** PCLK = 1/(4*CLK) (VPBDIV=0) -> PCLK = CLK/4
> **
> ** Example
> ** BRP = 0x16 " SJW = 0
> ** TSEG1 = 0xC TSEG2 = 1
> **
> ** (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> ** BIT = -------
> ** PCLK
> **
> ** 23 * ( 1+13+2 ) 23*16
> ** BIT = --------------------- = ------------- = 100 usec
> ** 14745600 / 4 14745600 / 4
> **
> **
> ** CANBTR register setting (C1BTR and C1BTR)
> ** SAM=0 Bus is sampled once
> ** TSEG1 = 0xC
> ** TSEG2 = 1
> ** SJW = 0
> ** BRP = 0x16 "
>
> *****************************************************************
> i don't found this formula in datasheet !!
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> who to know if this formula is correct or not ?
>
> and why he choose this value of paramaters ?
>
> SAM=0 Bus is sampled once
> TSEG1 = 0xC
> TSEG2 = 1
> SJW = 0
> BRP = 0x16 "
>
> can someone explain me why TSEG1 = 12 and not = 13 ?
> and for others paramaters
>
> thank you
>
Reply by ●January 3, 20112011-01-03
> i don't found this formula in datasheet !!
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> who to know if this formula is correct or not ?
In general all register values are decrement by 1. Therefor in your formula
all values are increment by 1. Means, in your formula you have to calculate
the register values, not the real values.
--
Mit freundlichen Gren
Regards
Steffen Rose
port - Professionals in Industrial Communication
Frohe Festtage und die besten Wsche f ein erfolgreiches neues Jahr.
Greetings of the season and our best wishes for a prosperous New Year.
+
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> who to know if this formula is correct or not ?
In general all register values are decrement by 1. Therefor in your formula
all values are increment by 1. Means, in your formula you have to calculate
the register values, not the real values.
--
Mit freundlichen Gren
Regards
Steffen Rose
port - Professionals in Industrial Communication
Frohe Festtage und die besten Wsche f ein erfolgreiches neues Jahr.
Greetings of the season and our best wishes for a prosperous New Year.
+
Reply by ●January 3, 20112011-01-03
Just a friendly recommendation.
To use CAN, do NOT use a 14.7456 MHz crystal, use 12 or 16 MHz.
With 12 MHz or 16 MHz you can generate all standard CAN baudrates, with your crystal you can only get close to the very slow ones.
Bob
--- In l..., "zied130187" wrote:
>
> i have found this example of CAN bitrate calculation :
>
> CAN clock setting for 100 usec
> CLK = 14745600
> (VPBDIV=0) -> PCLK = CLK/4
>
> Example
> BRP = 0x16 " SJW = 0
> TSEG1 = 0xC TSEG2 = 1
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> 23 * ( 1+13+2 ) 23*16
> BIT = --------------------- = ------------- = 100 usec
> 14745600 / 4 14745600 / 4
> CANBTR register setting (C1BTR and C1BTR)
> SAM=0 Bus is sampled once
> TSEG1 = 0xC
> TSEG2 = 1
> SJW = 0
> BRP = 0x16 "
>
> **************************************************************
>
> i don't found this formula in datasheet !!
> how to know if the formula is correct or not ??
>
> and how choose the value of paramaters (SAM=0 ? , TSEG1 = 12 ? , ...)
>
> any one can explaine me who calculate the bitrate of CAN for LPC2129
>
> thank you
>
To use CAN, do NOT use a 14.7456 MHz crystal, use 12 or 16 MHz.
With 12 MHz or 16 MHz you can generate all standard CAN baudrates, with your crystal you can only get close to the very slow ones.
Bob
--- In l..., "zied130187" wrote:
>
> i have found this example of CAN bitrate calculation :
>
> CAN clock setting for 100 usec
> CLK = 14745600
> (VPBDIV=0) -> PCLK = CLK/4
>
> Example
> BRP = 0x16 " SJW = 0
> TSEG1 = 0xC TSEG2 = 1
>
> (BRP+1) * ( (SJW+1)+(TSEG1+1)+(TSEG2+1) )
> BIT = -------
> PCLK
>
> 23 * ( 1+13+2 ) 23*16
> BIT = --------------------- = ------------- = 100 usec
> 14745600 / 4 14745600 / 4
> CANBTR register setting (C1BTR and C1BTR)
> SAM=0 Bus is sampled once
> TSEG1 = 0xC
> TSEG2 = 1
> SJW = 0
> BRP = 0x16 "
>
> **************************************************************
>
> i don't found this formula in datasheet !!
> how to know if the formula is correct or not ??
>
> and how choose the value of paramaters (SAM=0 ? , TSEG1 = 12 ? , ...)
>
> any one can explaine me who calculate the bitrate of CAN for LPC2129
>
> thank you
>