型号: PXF3306
· 3 Content of the Evaluation Kit
· 4 Preparation of the ER-ST-EVAL-EVAL evaluation board
· 5 Startup of the Example Application
· 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
Quick Start Guide for STMicroelectronics STM32F107 Evaluation Software on ER-ST-EVAL-EVAL Development Board
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
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
Fax: +1-603-471-0880 e-Mail: techsupport@ixxat.com
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
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.
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.
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
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
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
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.
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.
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).
[4] Keil Microcontroller Development Kit (MDK-ARM)
[5] IAR Embedded Workbench® for ARM