English
Language : 

AN2628 Datasheet, PDF (1/27 Pages) STMicroelectronics – Programming ST10F27x CAN interrupt drivers
AN2628
Application note
Programming ST10F27x CAN interrupt drivers
Introduction
This application note describes the CAN interrupt drivers of the ST10F27x and provides
programming examples that can be used to define interrupt schemes and write interrupt
drivers. Two C-CAN modules are implemented on ST10F27x, mapped on XBUS.
Interrupt sources, the way the sources of interrupts are identified and the two methods of
handling interrupts are described: One using the hardware features of the CAN modules
and the other through polling internal sources.
Programming the CAN interrupt drivers through CAN hardware features uses the RXIE and
TXIE bits of each message object. All 32 message objects are accessed through interface
registers. Two sets of register are available for each module, for example CANxIF1 registers
can be used to read from a message object whereas CANxIF2 registers can be used to
write into a message object. Whenever a message is transmitted or received by a message
object, the corresponding interrupt is serviced according to its priority (based on the value of
IntId). This method requires minimum CPU overhead and is the preferred method for most
applications.
CAN polling generates an interrupt whenever a successful transmission or reception occurs.
Polling is high in CPU overhead, as the CPU is interrupted every time a message is
acknowledged on the CAN bus. Therefore, programming the interrupt driver using polling is
only recommended for small networks.
Sample programs are provided for each method as examples.
October 2007
Rev 1
1/28
www.st.com