· 1 Introduction
· 2 System requirements
· 3 Content of the Evaluation Kit
· 4 Preparation of the ER-ST-EVAL-EVAL evaluation board
· 5 Startup of the Example Application
· 6 Implemented Functionality
· 7 Examples
· 7.1 Manipulating LEDs and Bar Graph on Color TFT Display by SDO Download
· 7.2 Manipulating LEDs and Bar Graph on Color TFT Display using PDO Write Protocols
· 7.3 Testing Heartbeat Producer and Consumer Functionality
· 8 Order Numbers
· 9 References
Quick Start Guide
Protocol Software
Quick Start Guide for STMicroelectronics STM32F107 Evaluation Software on ER-ST-EVAL-EVAL Development Board
ixxat
Headquarter US Sales Office
Ixxat Automation GmbH Ixxat Inc. Leibnizstr. 15 120 Bedford Center Road D-88250 Weingarten USA-Bedford, NH 03110
Tel.: +49 (0)7 51 / 5 61 46-0 Phone: +1-603-471-0800 Fax: +49 (0)7 51 / 5 61 46-29 Fax: +1-603-471-0880 Internet: www.Ixxat.de Internet: www.Ixxat.com e-Mail: info@Ixxat.de e-Mail: sales@Ixxat.com
Support
In case of unsolvable problems with this product or other Ixxat products please contact Ixxat in written form by:
Fax: +49 (0)7 51 / 5 61 46-29 e-Mail: support@Ixxat.de
For customers from the USA/Canada
Fax: +1-603-471-0880 e-Mail: techsupport@Ixxat.com
Copyright
Duplication (copying, printing, microfilm or other forms) and the electronic distribution of this document is only allowed with explicit permission of Ixxat Automation GmbH. Ixxat Automation GmbH reserves the right to change technical data without prior announcement. The general business conditions and the regulations of the license agreement do apply. All rights are reserved.
Document number: 1.02.0124-ER-ST-EVAL-EVAL Version: 1.0
1 Introduction ....................................................................................7 2 System requirements.....................................................................7 3 Content of the Evaluation Kit ........................................................7 4 Preparation of the ER-ST-EVAL-EVAL evaluation board................8 5 Startup of the Example Application ..............................................9 6 Implemented Functionality ..........................................................11 7 Examples ......................................................................................12
7.1 Manipulating LEDs and Bar Graph on Color TFT Display by SDO Download ............................................................................ 12
7.2 Manipulating LEDs and Bar Graph on Color TFT Display using PDO Write Protocols......................................................... 13
7.3 Testing Heartbeat Producer and Consumer Functionality 15 8 Order Numbers.............................................................................18 9 References....................................................................................18
1 Introduction
The canopen example application demonstrates the Ixxat CANOpen Protocol Software for the STM32F107 micro controller on the ER-ST-EVAL EVAL development board by STMicroelectronics [1]. This evaluation kit has been build using the Keil MDK-ARM by Keil Inc [4], a version build with IAR Embedded Workbench for ARM [5] is available as well.
The functionality implemented in the example application covers canopen services such as SDO, PDO protocol processing, and heartbeat, as well as simple digital and analog input and output via the on-chip peripherals of the STM32F107 controller and the color TFT mounted on the ER-ST-EVAL-EVAL.
2 System requirements
The CANOpen example application requires following components:
· ER-ST-EVAL-EVAL development board by STMicroelectronics [1]
· Flash Loader Demonstrator by STMicroelectronics [2] or any other Flash loader tool supporting download of Intel HEX files into the STM32F107
· CAN interface with a CAN/canopen bus monitor, for example CAN-to-USB compact and MiniMon V3 or cananalyser V2.7 by Ixxat Automation GmbH [3]. To follow some of the examples described in this guide, it is required to transmit CAN frames to the ER-ST-EVAL-EVAL.
3 Content of the Evaluation Kit
The Ixxat canopen slave example for the STM32F107 micro controller respectively the ER-ST-EVAL-EVAL board by STMicroelectronics is supplied as compressed ZIP archive. The archive file contains a downloadable CANOpen application in Intel HEX file format, as well as corresponding CANOpen device description files both in EDS and XDD format according to CiA 306 and CiA
311. Also included as PDF file are this document and a document describing the terms and conditions under which the evaluation kit is made available.
Figure 1: Content of the STM32F107 CANOpen evaluation kit
4 Preparation of the ER-ST-EVAL-EVAL evaluation board
After unpacking the archive file, the canopen slave executable has to be downloaded to the ER-ST-EVAL-EVAL evaluation board. STMicroelectronics provides a free of charge Flash loader demonstrator on their home page that supports connecting to the ER-ST-EVAL-EVAL via a RS232 interface (Figure 2). The Flash loader demonstrator is designed to work with all STMicroelectronics devices that support the system memory boot mode UART protocol. The tool requires Microsoft Windows 2000, XP, Vista or Windows 7.
Please follow the installation instructions in the corresponding documentation provided by STMicroelectronics [2]. To connect to the ER-ST-EVAL-EVAL, the evaluation board must be configured to boot from System Memory (SW1: 0, SW2: 1). Please consult the ER-ST-EVAL-EVAL user manual [1] for details.
Figure 2: Setup of the RS232 connection to the ER-ST-EVAL-EVAL
After a successful connection the user may proceed until a wizard page requests the selection of the HEX file that shall be downloaded into the Flash memory of the STM32F107.
Select the ER-ST-EVALEVAL.hex file included with the example distribution and continue with Next ( Figure 3). After successful download and verification of the application the boot selection switches can be reset such that the ER-ST-EVAL-EVAL boots from User Flash (SW2: 0) after the next reset or power cycle.
Figure 3: Selection of the HEX file with the canopen example application
5 Startup of the Example Application
To start the example application, proceed with the following steps:
1. Set up the hardware.
• Use a suitable adapter to connect the CAN bus to the CAN header CN3 (CAN1) on the ER-ST-EVAL-EVAL board
1. Connect and start a suitable CAN analyzer tool. Set the bit rate to 125 Kbit/s.
2. Power-on the evaluation board.
3. The CANOpen example application will display a small welcome note on the color TFT followed by status information on CAN bit rate and used node-ID. Subsequently the example application will attempt to transmit the CANOpen NMT boot-up message. The application is build with a fixed node-ID 10d and bit rate of 125 Kbit/s.
5. If the ER-ST-EVAL-EVAL board is not connected to any other active CAN device, the application will continue transmitting its NMT boot-up message and displaying a Wait for ACK.... status message on the color TFT display until any other CAN device acknowledges the NMT boot-up message (Figure 4).
Figure 4: Startup screen of the canopen example application
6. Provided that a CAN analyzer such as the ixxat cananalyser [3] is connected to the ER-ST-EVAL-EVAL board, the boot-up message will be recorded in the trace window of the analyzer (Figure 5, depicted is the trace window of the canopen Module for Ixxat cananalyser 2.7).
The startup screen will now display additional information on Consumer heartbeat and digital respectively analog output status (Figure 6).
Figure 5: NMT boot-up message of the canopen example application, data as interpreted by the CANOpen Module for cananalyser V2.7 by ixxat Automation GmbH Figure 6: Full content of TFT color LCD display
6 Implemented Functionality
The ixxat canopen Protocol Software example application for the STM32F107 on the ER-ST-EVAL-EVAL evaluation board implements a simple I/O device according to CiA 401CANOpen device profile for generic I/O modules. The application starts a CANOpen slave device with node-ID 10d on CAN1 at a CAN bit rate of 125 Kbit/s. The following features are implemented:
· 1 × SDO server
· 2 × RPDO (static)
· 2 × TPDO (static)
· Node guarding
· Producer heartbeat time, Consumer heartbeat time (1 entry)
· Error behavior (Communication error)
· Digital inputs (mapped on joystick U15)
· Digital outputs (mapped on 3.2” TFT color LCD)
· Analog input (mapped on potentiometer RV1)
· Analog output (mapped on 3.2” TFT color LCD)
The default RPDO mapping maps object 6200h sub-index 01h (8 simulated LEDs on 3.2” TFT color LCD, text line Digital Out) on RPDO1, and object 6411h sub-index 01h (Bar graph on 3.2” TFT color LCD, text line Analog Out) on RPDO2.
The default TPDO mapping maps object 6000h sub-index 01h (mapped on joystick U15) on RPDO1, and object 6401h sub-index 01h (mapped on potentiometer RV1) on RPDO2.
7 Examples
7.1 Manipulating LEDs and Bar Graph on Color TFT Display by SDO Download
Digital and analog output data are routed to the TFT color LCD via objects 6200h sub-index 01h, and 6411h sub-index 01h. To manipulate the digital outputs SDO protocols may be used as described below (Figure 7, Figure 8).
Transmit the following message (CAN frame No 1) from a suitable CAN tool:
Figure 7: SDO download to node-ID 10d object 6200h sub-index 01h, data 53h
CAN frame No 1 uses the expedited SDO download protocol with CAN-ID 60Ah to write one data byte 53h to the addressed application object. The response frame No 2 with CAN-ID 58Ah confirms the download request.
Figure 8: Color TFT status after SDO download of value 53h to object 6200h sub-index 01h
Copyright ixxat Automation GmbH 12 STMicroelectronics STM32F107 Evaluation Kit Version 1.0
Performing a similar operation on the analog output will result in the following screen. Transmit the following frame (TX frame):
TX 60Ah 8 2Bh 11h 64h 01h A8h 61h 00h 00h
RX 58Ah 8 60h 11h 64h 01h 00h 00h 00h 00h
The SDO expedited download confirmation corresponds to the RX frame in the table above, the resulting screen after the SDO download will be approximately as shown in Figure 9.
Figure 9: Color TFT display after SDO downloads of value 61 A8h (25000d) to object 6411h sub-index 01h. Please note the Little-Endian representation of the two Byte data value
For object 6411h sub-index 01h software limits are set to 1000h respectively F000h. Any attempt to write a value outside this range is aborted by the device.
7.2 Manipulating LEDs and Bar Graph on Color TFT Display using PDO Write Protocols
To use PDO protocols the canopen slave device has to be transferred into NMT state Operational (Figure 10). This is achieved transmitting a NMT start remote node command (CAN frame No 1).
Note that any other canopen devices present in the network will be addressed as well by frame No 1. Use direct addressing of node-ID 10d (data content 01 0Ah) instead if the NMT broadcast message may interfere with the operation of any other device in the network.
Upon entering NMT state Operational the CANOpen slave device will transmit once all its TPDOs with transmission type 255 (frames No 2 and No 3).
Following this you may transmit PDOs with CAN-ID 20Ah – the default CAN-ID for RPDO1 of node-ID 10d according to the CiA 301 Pre-defined connection set – from your CAN tool containing one data byte 5Ah (frame No 4), or with CAN-ID 30Ah – the default CAN-ID for RPDO2 – with two data bytes 00 A0h (note: Little-Endian representation). The resulting screen will be comparable to Figure 11. For reasons of simplicity object 6411h sub-index 01h has been implemented with a dynamic range from 0 – 216 -1.
The examples above can be reproduced with any CAN tool supporting manual configuration and transmission of CAN frames. For a further evaluation of the canopen slave shipped with the evaluation kit and the possibilities of the CANOpen protocol it is recommended to purchase commercial tools such as the ixxat cananalyser ( Figure 5, Figure 7, and Figure 10) or the Ixxat canopen
Device Manager (Figure 12).
Another feature offered by the canopen example application is consumer heartbeat functionality with support for monitoring one CANOpen device. To evaluate this functionality one additional CANOpen device is required that acts as heartbeat producer.
The following example first resets the canopen network to obtain a well-defined state. Then, the consumer heartbeat time on our evaluation board with node-ID 10d is configured to expect a heartbeat message transmitted by the additional device every 1200 ms at latest. Node-ID 10d will also be configured to return to NMT state Pre-operational on detection of a communication error. After the producer heartbeat time on the second device has been configured, monitoring starts with the first heartbeat message received by the CANOpen device that is monitored and the monitoring status can be observed on the color TFT display.
Assuming that the additional canopen device uses node-ID 1d, perform the following configuration steps (messages denoted with TX) from your CAN tool:
(c) (d)
Figure 13: (a) Consumer heartbeat time (1016h sub-index 01h) on node-ID 10d, monitoring not yet active, (b) first Producer heartbeat message by node-ID 1d received, monitoring active, node-ID 1d in NMT state Preoperational, LED yellow (c) The heartbeat monitor indicates that the monitored device is in NMT state Operational, LED green (d) The heartbeat monitor indicates the detection of a communication error, LED red
[1] STMicroelectronics, http://www.st.com/ , ER-ST-EVAL-EVAL , UM0600 , User manual, ER-ST-EVAL-EVAL evaluation board, Rev 3, STMicroelectronics, October 2009
[2] STM32™ STM8™ Flash loader demonstrator UM0462 , User manual, STM32 ™ STM8 ™ Flash loader demonstrator, Rev7, STMicroelectronics, November 2009
[3] ixxat Automation GmbH, http://www.ixxat.com/ , canopen Protocol Software , USB-to-CAN compact , Ixxat CANOpen Device Manager , ixxat cananalyser
[4] Keil Microcontroller Development Kit (MDK-ARM)
[5] IAR Embedded Workbench® for ARM
canopencananalyserixxat