4.14 Controller Area Network (CAN)
2
Electrocardiogram (Ecg) Signals
In Medium-density and High-density devices the USB and CAN share a dedicated 512-byte
Controller-area network (CAN or CAN-bus) is a vehicle bus standard designed to allow micro-
SRAM memory for data transmission and reception, and so they cannot be used
controllers and devices to communicate with each other within a vehicle without a host computer.
concurrently (the shared SRAM is accessed through CAN and USB exclusively). The USB
The Electrocardiogram (Ecg)
It was designed specifically for automotive applications but is now also used in other areas. De-
and CAN can be used in the same application but not at the same time.
velopment of the CAN-bus started originally in 1983 at Robert Bosch GmbH. The protocol was
• Ecg: electrical manifestation of heart activity recorded
officially released in 1986 at the Society of Automotive Engineers (SAE) congress in Detroit, Michi-
General description
from the body surface
gan. The first CAN controller chips, produced by Intel and Philips, came on the market in 1987.
Bosch published the CAN 2.0 specification in 1991.
In today's CAN applications, the number of nodes in a network is increasing and often
• monitoring of heart rate
several networks are linked together via gateways. Typically the number of messages in the
The STM32F103RB CAN is compliant with specifications 2.0A and B (active) with a bit rate up to
system (and thus to be handled by each node) has significantly increased. In addition to the
1 Mbit/s. It can receive and transmit standard frames with 11-bit identifiers as well as extended
application messages, Network Management and Diagnostic messages have been
frames with 29-bit identifiers. It has three transmit mailboxes, two receive FIFOs with 3 stages
introduced.
and 14 scalable filter banks.
The Ecg signal can be recorded fairly easily with surface
●
An enhanced filtering mechanism is required to handle each type of message.
electrodes placed on the limbs and/or the chest, see pages
Sends the string hello with 500Bit/s over the CAN. Receives the internal looped signal
can1
below.
using polling (mode: CAN Mode LoopBack). Therefore no message can be received! Uses the
Furthermore, application tasks require more CPU time, therefore real-time constraints
caused by message reception have to be reduced.
serial interface at 115200Baud.
●
A receive FIFO scheme allows the CPU to be dedicated to application tasks for a long
As can1 but able to receive CAN data (mode: CAN Mode Normal).
can2
time period without losing messages.
The standard HLP (Higher Layer Protocol) based on standard CAN drivers requires an
efficient interface to the CAN controller.
Figure 190. CAN network topology
MCU
Application
CAN
Controller
CAN
Rx
CAN
Transceiver
CAN
High
CAN Bus
Josef Goette
CAN 2.0B active core
The bxCAN module handles the transmission and the reception of CAN messages fully
autonomously. Standard identifiers (11-bit) and extended identifiers (29-bit) are fully
supported by hardware.
Control, status and configuration registers
By default the CAN and USB share same pins PA11/EXT1-1 and PA12/EXT1-3, so you can't use
The application uses these registers to:
both CAN and USB on same time. A remap (see example) can be done to PB8/PB9.
●
Configure CAN parameters, e.g. baud rate
Make sure you set up a filter even if you want to receive all CAN messages.
●
Request transmissions
●
Handle receptions
●
Manage interrupts
40
●
Get diagnostic information
CAN
Tx
CAN
Low
2
Figure 4.15: CAN Network Topology
4 Peripherals
1 Intro
6–16
2009
STM32 Cortex-M3 Tutorial
RM0008
Need help?
Do you have a question about the STM32 Cortex-M3 and is the answer not in the manual?