cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F091RC=please tell me detailed procedure for can bit time calculation,to find value of these hcan.Instance = hcan.Init.Prescaler = hcan.Init.SyncJumpWidth = hcan.Init.TimeSeg1 = hcan.Init.TimeSeg2 =

Wilson
Associate II
 
10 REPLIES 10

CAN BIT RATE = (APBCLOCK / PRESCALER) / (SJW + TS1 + TS2)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Wilson
Associate II

can u explain each terms?

Wilson
Associate II

at 48 mhz clock frequency,baudrate=50 kbps

I'm sure the definitions are in the Reference Manual

SJW, TS1 and TS2 are the bit timing quanta, they have ranges as described in the manual. You sum these together to understand how many clock ticks you will need.

The CAN peripheral is clocked by the APB (Peripheral Bus) to which it is attached. Presumably 48 or 24 MHz depending on the dividers you have selected.

48,000,000 / 50,000 = 960

960 / 60 = 16

If you set the Prescaler to 60, the sum of SJW+TS1+TS2 needs to be 16, find a combination that fits.. Say 1, 7 and 8 ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Wilson
Associate II

ok

Wilson
Associate II

how did you choose 1,7,8?

sjw=1,ts1=7,ts2=8?

[OT] It's nice how in explanation of a ST's chip you refer to a document to be found at NXP, which refers to "Motorola CAN" in a Freescale chip... 😉

(Sorry for the OT, I couldn't resist. No, no need to explain.)

JW

That actually contains CAN SPECIFICATION.

Or do you find a lot of differences compared to the Bosch-spec?

http://esd.cs.ucr.edu/webres/can20.pdf