
CAN modules
ST10F252M
The interrupt identifier IntId in the interrupt register indicates the cause of the interrupt.
When no interrupt is pending, the register holds the value zero. If the value of the interrupt
register is not zero, there is an interrupt pending and, if IE is set, the interrupt line to the
CPU, IRQ_B, is active. The interrupt line remains active until the interrupt register is back to
value zero (the cause of the interrupt is reset) or until IE is reset.
The value 0x8000 indicates that an interrupt is pending because the CAN core has updated
(not necessarily changed) the status register (error interrupt or status interrupt). This
interrupt has the highest priority. The CPU can update (reset) the status bits RxOk, TxOk
and LEC, but a write access of the CPU to the status register can never generate or reset an
interrupt.
All other values indicate that the source of the interrupt is one of the message objects, IntId
points to the pending message interrupt with the highest interrupt priority.
The CPU controls whether a change of the status register may cause an interrupt (bits EIE
and SIE in the CAN control register) and whether the interrupt line becomes active when the
interrupt register is not zero (bit IE in the CAN control register). The interrupt register is
updated even when IE is reset.
The CPU has two possibilities to follow the source of a message interrupt. First it can follow
the IntId in the interrupt register and second it can poll the interrupt pending register (see
An interrupt service routine reading the message that is the source of the interrupt may read
the message and reset the message object’s IntPnd at the same time (bit ClrIntPnd in the
command mask register). When IntPnd is cleared, the interrupt register points to the next
message object with a pending interrupt.
18.9.10
Configuration of bit timing
Even if minor errors in the configuration of the CAN bit timing do not result in immediate
failure, the performance of a CAN network can be reduced significantly.
In many cases, the CAN bit synchronization amends a faulty configuration of the CAN bit
timing to such a degree that only an occasional error frame is generated. In the case of
arbitration however, when two or more CAN nodes simultaneously try to transmit a frame, a
misplaced sample point may cause one of the transmitters to become error passive.
The analysis of such sporadic errors requires a detailed knowledge of the CAN bit
synchronization inside a CAN node and of the CAN nodes’ interaction on the CAN bus.
Bit time and bit rate
CAN supports bit rates in the range of lower than 1 kBit/s up to 1000 kBit/s. Each member of
the CAN network has its own clock generator, usually a quartz oscillator. The timing
parameter of the bit time (that is, the reciprocal of the bit rate) can be configured individually
for each CAN node, creating a common bit rate even though the CAN nodes’ oscillator
periods (fosc) may be different.
The frequencies of these oscillators are not absolutely stable, small variations are caused
by changes in temperature or voltage and by deteriorating components. As long as the
variations remain inside a specific oscillator tolerance range (df), the CAN nodes are able to
compensate for the different bit rates by resynchronising to the bit stream.
According to the CAN specification, the bit time is divided into four segments (see