cancel
Showing results for 
Search instead for 
Did you mean: 

Can bit segments?

turboscrew
Senior III

What are the CAN bit segment 1 and 2?

CAN specification doesn't use those names.

Are they PROP_SEG and PHASE_SEG1 or PHASE_SEG1 and PHASE_SEG2?

All three are programmable by the CAN spec, but PHASE_SEG2 should be max. of PHASE_SEG1 and INFORMATION PROCESSING TIME which is "less than or equal to 2 time quanta".

I would guess that bit segment 1 = PROP_SEG and bit segment 2 = PHASE_SEG1. PHASE_SEG2 is then probably equal to PHASE_SEG1.

Is that right?

I also realized that in STM32F427 data sheets it says that CAN can work upto 1Mbps.

I wonder how? Is there Cube restriction or why it seems impossible?

With "full speed" (APB1@45MHz) I tried to set prescaler to 5, bit segment1 to 2 and bit segment2 to 3, but CubeMX says they are too small values.

I'd think that it would mean:

Tq=111.11 ns,

SYNC_SEG = 1Tq

PROP_SEG = 2Tq

PHASE_SEG1=3Tq

PHASE_SEG2=3Tq

Total 9Tq/bit = 999.99ns

12 REPLIES 12
turboscrew
Senior III

Funny. At work CubeMX accepted my settings, and also the prescaler was decremented.

Maybe I have some very old version at home...?

With the chip mentioned, the APB clock is 45MHz (max), and prescaler 5 and bit segments 5 and 3 gave 1Mbps rate. No errors - at least in the first about 130000 messages.

Time quantum is a prescaler tick. It's defined in CAN specs.

The can specs also say that the minimum number of quanta per bit is 8.

 "TIME QUANTUM

The TIME QUANTUM is a fixed unit of time derived from the oscillator period. There

exists a programmable prescaler, with integral values, ranging at least from 1 to 32.

Starting with the MINIMUM TIME QUANTUM, the TIME QUANTUM can have a length

of

TIME QUANTUM = m * MINIMUM TIME QUANTUM

with m the value of the prescaler."

turboscrew
Senior III

But note that in HAL, the StdId and ExtId are not like in CAN specs. Only one of them is used for the whole ID. They are not standard part and extended part. Can't really understand why, because both are 32-bit. Why not just one ID? The selection is made by IDE anyway...