CAN Example
Introduction
Hardware
Software
PCAN-View
PCAN-Explorer
Download
 

Introduction

This is a small weather station where the data is transmitted over CAN. The hardware support sensors for temperature, humidity and barometric pressure. In general it is a small example to show how to use CAN on a STM32F103.

Hardware

For this example the following components was used:

All in all it looks like:

To connect the PC to the CAN network a PCAN-USB adapter was used.

Software

The software use the following key components:

  • CMSIS - Cortex Microcontroller Software Interface Standard
  • STM32F10x Standard Peripherals Library v3.5.0
  • CTL - CrossWorks Tasking Library

For the compiler, CrossWorks for ARM v2.3.1 was used. The project with my source can be found under the download section.

PCAN-View

PCAN-View is a simple CAN monitor for viewing, sending and recording CAN data traffic. For more information about PCAN-View take a look at the PEAK-System page. In case of our example the output from PCAN-View will look like:

Unfortunately it is difficult to identify the real data like Temperature, Pressure and Humidity. Here only the hex values will be displayed. But this problem can be solved with the use of PCAN-Explorer.

PCAN-Explorer

Without a Symbol file the output of the "Receive" window will look like:

(Click inside the picture to expand)

But the problem can be solved with a Symbol file which can be created with the PCAN-Symbol Editor. The Symbol file for our example will look like:

(Click inside the picture to expand)

The data like Temperature, Pressure and Humidity can now be easily identified by using the Symbol file. The output of the "Receive" window will look like:

(Click inside the picture to expand)

Download

can-example-20130505 (298 KB)