Datasheet

Copyright © 2013 ARM Ltd. All rights reserved
CAN: Controller Area Network Lab using ST STM32 Cortex-M processors. www.keil.com
14
CAN Demonstration Software:
In order to experiment with a CAN network it is useful to try a simulator before the real hardware. This document shows
how to use the complete device simulation included in the Keil
®
Microcontroller Development Kit (MDK-ARM) for the
STM32 ARM
®
Cortex™-M3 microcontroller. No hardware is needed. We provide an example for the Discovery STM32F4.
You can download the latest version of MDK-ARM (4.70 or later) at: www.keil.com/arm/mdk.asp
There is no charge for this software. Please install this software on your PC in the default directory. This is C:\Keil.
Complete technical information on the ST CAN module is found in the Reference Manual RM0008 and RM0090 available
from www.st.com/stm32 . Other manufacturers have similar documentation available on their websites.
STMicroelectronics CAN Controller for Cortex-M3 Processors.
Shown is a block diagram of the CAN controller. Here are the main points of all CAN controllers:
1. I/O Pins: These connect to the CAN transceiver chip pins R and D as already described.
2. Parallel-Serial Converters: CAN is a serial bus while the processor is parallel. Conversion happens here.
3. Tx mailbox: The messages to be transmitted are written here. ID, data (if any) and the DLC go here.
4. Acceptance Filter: This passes only specified messages to the processor via the FIFOs. By default at RESET, these
filters pass all messages to the FIFOs. Your software must configure them to filter messages.
5. FIFO 0 & 1: Each Receive FIFO can hold 3 CAN messages. They provide a buffering system to the processor.
6. Control, Status, Configuration registers: Your software must configure these registers, usually at initialization.
Various flags and switches are found here. Examples are set CAN speed, request transmission, manage receive
messages, enable interrupts and obtain diagnostic information. Keil provides examples on how to set and use these
registers.
All CAN controllers have the same basic architecture. Different controllers will have differences in the number of receive
FIFO buffers, transmit buffers, size of acceptance filters and the bit mapping, addresses and definitions of the various
configuration registers. All CAN controllers are licensed by Robert Bosch GmbH in Germany and therefore they are able to
exert considerable control over basic CAN attributes to make them consistent with various manufacturers.
This means that all CAN controllers can communicate with other brands in a reliable and predictable manner.
Note: Your ST CAN controller might be slightly different from this model. Check your datasheet.
Tx
Mailbox
(3)
Parallel-Serial
Converter
Serial-Parallel
Converter
ARM
Cortex-M3
Processor
Acceptance
Filter
(14)
FIFO 0
FIFO 1
Control, Status, Config Registers
CAN Tx
PB9
CAN Rx
PB8
I/O Pins
To transceiver