CANopenNode for ADSP-CM408F
Setup and User Guide
Platform: ADZS-CM408F EZ-Board
CANopenNode-for-ADSP-CM408F
December 12, 2014
Copyright, Disclaimer & Trademark Statements
Copyright Information
Copyright (c) 2014 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog
Devices, Inc. and its licensors. This document may not be reproduced in any form without prior, express
written consent from Analog Devices, Inc.
Disclaimer
Analog Devices, Inc. (“Analog Devices”) reserves the right to change this product without prior notice.
Information furnished by Analog Devices is believed to be accurate and reliable. However, no
responsibility is assumed by Analog Devices for its use; nor for any infringement of patents or other rights
of third parties which may result from its use. No license is granted by implication or otherwise under the
patent or other rights of Analog Devices.
Trademark and Service Mark Notice
Analogy Devices, the Analog Devices logo, Blackfin, SHARC, TigerSHARC, CrossCore, VisualDSP,
VisualDSP++, VisualAudio, EZ-KIT Lite, EZ-Extender, SigmaStudio and Collaborative are the exclusive
trademarks and/or registered trademarks of Analog Devices, Inc (“Analog Devices”).
All other brand and product names are trademarks or service marks of their respective owners.
Analog Devices’ Trademarks and Service Marks may not be used without the express written consent of
Analog Devices, such consent only to be provided in a separate written agreement signed by Analog
Devices. Subject to the foregoing, such Trademarks and Service Marks must be used according to
Analog Devices’ Trademark Usage guidelines. Any licensee wishing to use Analog Devices’ Trademarks
and Service Marks must obtain and follow these guidelines for the specific marks at issue.
Table of Contents
INTRODUCTION
3
THINGS TO ACQUIRE
3
HARDWARE
SOFTWARE
3
3
SOFTWARE DOWNLOADS AND INSTALLATION
4
HARDWARE ECN’S FOR CAN TRANSCEIVER ON ADZS-CM408F EZ-KIT
5
PREPARING CANOPENNODE SLAVE ON ADZS-CM408F EZ-KIT
6
(A). DIRECT FLASHING WITH ADSP-CM40Z UART FLASH PROGRAMMER
(B) USING IAR EWARM IDE
HARDWARE SETUP & TESTING THE CANOPENNODE WITH MASTER
CANOPEN MASTER AND SLAVE HARDWARE SETUP
HMS CANOPEN MASTER BRING-UP
VALIDATING CANOPEN COMMUNICATION WITH CANOPENNODE
READ/WRITE OBJECT COMMUNICATION
6
6
8
8
8
9
10
ANNEXURE I
12
ANNEXURE II
14
ANNEXURE III
15
CANopenNode for ADSP-CM408F Setup User Guide
2
Introduction
CANopen is the internationally standardized (EN 50325-4) CAN-based higher-layer protocol for
embedded control system, and the CANopenNode is simple and reliable open source software stack used
industrial and home automation for serial communication of multiple devices over the CAN/CANopen
Network.
The open source CANopenNode (https://sourceforge.net/projects/canopennode/) is ported on to Analog
Devices ADSP-CM408F mixed signal controller (http://www.analog.com/en/processors-dsp/cm4xx/adspcm408f/products/cm40x-ez/eb.html), and a support package has been created to quickly bring up
CANopenNode devices using ADSP-CM408F mixed signal controller based ADZS-CM408F EZ-Board
platform. The required CAN drivers and code to perform CANopen slave operation on ADSP-CM408F
with an easy to use IAR embedded environment is packaged as “Analog Devices ADSP-CM408F
Support Package for CANopenNode”. Together with the open source CANopenNode (3_10) code,
users will be able to build and setup the serial communication with several CANopen devices.
This document intended to help users in setting up the CANopen network with ADSP-CM408F based
slave(s) and any CANopen Master (HMS CANopen master simulator in used in this testing)
Things to Acquire
Hardware
-
Analog Devices ADZS-CM408F EZ-KIT with
o
Segger J-LINK Lite ARM emulator
o
5V-3.6A power supply to power up ADZS-CM408F EZ-KIT board.
http://www.analog.com/en/evaluation/cm40x-ez/eb.html
-
HMS CANopen Master Simulator USB dongle ( Article: 019920) - (User can use any master)
http://www.anybus.com/products/products.asp?PID=406&ProductType=Master%20Simulator
-
RJ11- DB9 connectors
-
USBUART Converter (for Serial Downloading, optional)
Software
-
Open Source CANopenNode stack (CANopen_3_10.zip package).
http://sourceforge.net/projects/canopennode/
-
ADSP-CM40x Software Enablement Package (v1.2.0 version)
http://www.analog.com/en/processors-dsp/cm4xx/adsp-cm408f/products/cm40x-ez/eb.html
-
Click-thru Installer package “CANopenNode_ADSPCM408F_v1.0SF.exe”.
http://sourceforge.net/projects/canopennode-for-adsp-cm408f/?source=directory
-
IAR Embedded workbench for ARM (EWARM v6.5 version or later)
-
HMS CANopen Master Simulator with drivers (3.1.5.200 version)
http://www.anybus.com/upload/Master%20Simulator-2278Master%20Simulator%20CD%203.20.zip
CANopenNode for ADSP-CM408F Setup User Guide
3
Software Downloads and Installation
Three software components including the Analog Devices ADSP-CM408F Support Package for
CANopenNode constitute of building the CANopenNode. It is recommended that the CANopenNode
source code and the Support code reside in separate folders under one main project folder (say
myCANopenProject) to enable the users to directly use the supplied IAR project environment setup.
This way the users will be able to quickly build and setup the CANopen network.
Follow the sequence:
 CANopenNode source code : http://sourceforge.net/projects/canopennode/
Download the “CANopen_3_10.zip” file from the above link and extract the contents to
“myCANopenProject\CANopen_3_10” folder
 ADSP-CM40x Enablement Software Package (Rel 1.2.0)
http://www.analog.com/en/processors-dsp/cm4xx/adsp-cm408f/products/cm40x-ez/eb.html
Under the PRODUCT DOWNLOAD Download the ADSP-CM40x Enablement Software
package. (Rel 1.2.0 - ~37.7 MB) pointing to http://sdk.analog.com/dw/sdks.aspx?file=ADUSC03
Note: A simple registration to “myAnalog” is required to download this package, and it is
suggested to install the package under “C:\Analog Devices” folder.
 ADSP-CM408F Support Package for CANopenNode (Rel 1.0)
A click-thru installer CANopenNode_ADSPCM408F_v1.0SF.exe can be downloaded from
sourceforge with a search word “CANopenNode-for-ADSP-CM408F”. Installation should be
pointed to “myCANopenProject” folder. This support package once installed, in combination
with first 2 items enables the user to quickly build the CANopenNode solution.
http://sourceforge.net/projects/canopennode-for-adsp-cm408f/?source=directory
CANopenNode for ADSP-CM408F Setup User Guide
4
Hardware ECN’s for CAN transceiver on ADZS-CM408F EZ-KIT
The following simple ECN’s are to be made on the factory built ADZS-CM408F EZ-KIT. Remove R72
& R73 resistors and short them as shown below. These changes will make sure that the 120-Ohm
termination resistor of CAN bus is maintained between CAN high and CAN low communication lines.
Figure 1: Hardware Modifications on ADSP-CM408F board
Figure 2: Directory structure of the CANopenNode (myCANopenProject)
CANopenNode for ADSP-CM408F Setup User Guide
5
Preparing CANopenNode Slave on ADZS-CM408F EZ-KIT
The CANopenNode devices can be prepared easily on ADSP-CM408F based ADZS-CM408F EZ-KIT
platform using 2 methods.
1. Direct Flashing of “CANopenNode for ADSP-CM408” binary
2. IAR Embedded Workbench for ARM v6.5 or later
(A). Direct Flashing with ADSP-CM40z UART Flash Programmer
Analog Devices ADSP-CM40z UART Flash Programmer (WSD.exe) utility is a very useful tool to
quickly validate the CANopenNode. This tool is supplied along with “Analog Devices ADSP-CM40x
Enablement Software Package (Rel 1.2.0)”, allowing user to write the applications to, and then boot, from
the flash memory of ADSP-CM40x devices.
A Prebuilt Binary for CANopenNode with ADSP-CM408F (adCANopenCM408F.hex) is supplied along
with the support package under “CANopenCM408F\PrebuiltBinary” directory.
The procedure for flashing the binaries is described in the README.TXT file under “C:\Analog
Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\tool\UARTFlashProgrammer”.
(B) Using IAR EWARM IDE
The IAR systems Embedded Workbench for ARM enables the users to load the project, build and debug
the project on ADSP-CM408F mixed signal controller.
1. Open “adCANopenNode.eww” IAR workspace you’re your main project folder where you
installed the CANopenNode project (say “myCANopenProject\CANopenCM408F\IDE”)
2. Build the project using “Project optionsRebuild all”. [It can also be done by right clicking on
the Project Rebuild all] as shown in Figure 3 below. In case of any errors during project build,
please refer to “IAR Project Options” section.
3. When connecting multiple nodes in the CANopen network with the same application, the node
addresses need to be modified. Use object number 0x2101 to set the node address. By default this
value will be set to 0x04. For Multi-node hardware connections, refer to Annexure II.
Figure 3: Project options to build
CANopenNode for ADSP-CM408F Setup User Guide
6
4. On successful build, download the software using “ProjectDownloadDownload active
application” option. If running under debug mode, select “ProjectDownload and Debug”.
Figure 4: Loading the software on to ADSP-CM408F platform
IAR Project Options: For successful building of this project, several project options need to be set
properly. The project options for this project include compiler, linker and debugger options as given in
Annexure I.
CANopenNode for ADSP-CM408F Setup User Guide
7
Hardware Setup & Testing the CANopenNode with Master
CANopen Master and Slave Hardware Setup
The RJ11-DB9 hardware connections between the CANopenNode slave ADSP-CM408F board’s CAN
transceiver (CAN_HIGH and CAN_LOW) to HMS CANopen Master (USB) dongle are as shown below.


RJ11 connector pin no.2 CAN HIGH should connect to pin no.7 of DB9 female connector.
RJ11 connector pin no.3 CAN LOW should connect to pin no.2 of DB9 female connector.
HMS CANopen Master Bring-up
The HMS CANopen Master Simulator can be used with nearly all CANopen slaves from different
manufacturers. The network scan function automatically detects and identifies all operational slaves in a
CANopen network.
The Master Simulator consists of Windows based Software and a CANopen USB-interface circuitry
(Dongle). The Dongle is plugged into the USB port of the PC and provides a 9-pin D-Sub connector as
the CANopen Interface. The Dongle is powered from the USB port.
The HMS CANopen Master hardware need to be procured prior to the Software simulator tool that can be
downloaded from the following link
http://www.anybus.com/products/products.asp?PID=406&ProductType=Master%20Simulator
Note: If the USB device is not detected on Windows 7 PC (32/64-bit), the drivers can be obtained from
HMS Master Simulator software under “Master Simulator-2278-Master Simulator CD
3.20\files\button3\Driver\PCAN” directory.
CANopenNode for ADSP-CM408F Setup User Guide
8
Validating CANopen Communication with CANopenNode
The steps below describe the procedure to setup the CANopen network using HMS CANopen Master
Simulator and validate the communication with ADSP-CM408F based CANopenNode slave(s).
1. Instantiating CANopen Master Simulator: The HMS CANopen master can be executed from
“Start Menu All Programs HMS” by double clicking on “CANopen Master Simulator”
executable.
2. Select the CAN Dongle Port: Select USB in the option from the drop down menu. Probably, USB
will be the only option will be displayed there. All the options are shown in Figure 5.
3. Slave Search: Select “Search Salves” from “Address” menu shown in the master screen. Click
“OK” on searching the Slave.
4. Select the Baud Rate: Select the baud rate as 1000 k Baud (1M Baud). The baud rate in the
CANopenNode slave is set to 1Mbaud (by default).
5. Select the slave: Set the current slave Address as 4. The address is by default is set to 0x04 in the
slave. Based on the node address modifications described above, this field can be changed.
6. Start Communication: Select “Start” from “Communication” menu shown in the master screen.
Click “OK” if warning message pops up.
7. Based on successful connection, The Receive PDO’s (from the Slave) can be seen under Input
Data trace window and Transmit PDO’s (From Master) will be shown under Output data as
shown in Figure 6. The default PDOs are set in CANopen node as 1 TPDO with 2 bytes and 4
RPDOs with 2, 4, 6 and 8 bytes each.
Figure 5: HMS CANopen Master Screen (Before connection)
CANopenNode for ADSP-CM408F Setup User Guide
9
Figure 6: CANopen Master window (After succesful connection)
8. Set TPDO values: TPDO values can be edited using edit option on master. Left click on
TPDO byte to modify and use the Edit check boxes to enable/ disable respective bits of the
byte. This is explained in Figure 7.
Figure 7: Edit/ Set TPDOs
Read/Write Object Communication
9. Accessing SDOs: This can be performed by using Read object or Write object option under
Communication tab.
CANopenNode for ADSP-CM408F Setup User Guide
10
10. SDO Read: Assuming to read SDO with Object address “0x2120”. Use Read Object from
Communication tab, enter the values in the field as shown in Figure 8 below and click on
Read button.
Figure 8: SDO Read
11. SDO Write: Assuming to write to SDO with Object address “0x2120”. Use Write object from
Communication tab, Enter values in the field as shown in figure 9 and click on Write button.
Figure 9: SDO Write
12. The written SDO object values can be verified by SDO Read mentioned in step 9.
CANopenNode for ADSP-CM408F Setup User Guide
11
Annexure I
IAR Project Options
Compiler options
By left clicking on the “C/C++ Compiler” option in the Category panel of IAR project options window as
shown below will allow to set the compiler specific options. Make sure, the project options and defined
symbols are matching with the following links.
Note: Make sure to install the Software enablement package in the default destination folder as C:\.
Preprocessor links:
“ProjectOptionsC/C++ CompilerPreprocessor”.
$PROJ_DIR$\..\System\inc
$PROJ_DIR$\..\System\src
$PROJ_DIR$\..\..\CANopen_3_10\CANopen_stack
$PROJ_DIR$\..\..\CANopen_3_10\Example_IO\analogdevices\ADSP-CM408F
$PROJ_DIR$\..\..\CANopen_3_10\CANopen_stack\analogdevices\ADSP-CM408F
C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\src
C :\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\inc
C :\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\inc\services\pwr
Defined symbols:
The defined symbols should match with the following macros.
__ADSPCM40X__
PFC
USE_SAR_ADC
_USE_SIGMA_DELTA
ADI_DEBUG
MONITOR
Project Options: Compiler  Preprocessor options
CANopenNode for ADSP-CM408F Setup User Guide
12
Linker options
By left clicking on Linker options in the category panel, set the “Additional libraries” to match following
links. “ProjectOptionsLinkerLibrary”.
C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libssl40z.a
C :\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libosal40z_noos.a
C :\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\lib\iar\debug\libdrv40z.a
Project Options: Linker  Libraries options
Debugger Options
By left clicking on Debugger options in the category panel. Select the Download Options as shown
below. “ProjectOptionsDebuggerDownload”.
Project Options: Debugger  Download options
CANopenNode for ADSP-CM408F Setup User Guide
13
Annexure II
The hardware connections for multiple CANopen slave nodes is as shown in figure below.
Slave Node
ID= 0x03
HMS CANopen
Master Simulator
on PC
Slave Node
ID= 0x04
CAN_HIGH
Slave Node
ID= 0x05
DB9
HMS CANopen Dongle
CAN_LOW
CANopenNode for ADSP-CM408F Setup User Guide
14
Annexure III
Directory and Project Structure for CANopenCM408F with CANopenNode stack
(CANopen_3_10.zip)
Structural organization of the Project:
1. Create separate analogdevices folders under
“…\CANopen_3_10\CANopen_stack” &
“…\CANopen_3_10\Example_IO” directory.
2. Create separate ADSP-CM408F folders under
“…\CANopen_3_10\CANopen_stack\analogdevices” &
“…\CANopen_3_10\Example_IO\analogdevices” directory.
3. Copy CO_OD.c & CO_OD.h files from “CANopenCM408F\OtherSupport” to the path:
“…\CANopen_3_10\Example_IO\analogdevices\ADSP-CM408F” directory.
4. Copy CO_driver.c and CO_driver.h files from “CANopenCM408F\OtherSupport” to the path:
“…\CANopen_3_10\CANopen_stack\analogdevices\ADSP-CM408F” directory.
Setting-up IAR Project:
1. Open the CANopenNode IAR workspace from the path:
“CANopenCM408F\IDE” directory through IAR IDE v6.5 or later.
2. Under the target workspace window, remove & add respective *.c files with the newly copied
from the CANopenCM408F package except the startup.c & system.c (which are targeted from
the ADI Enablement package).
 CO_OD.c from “…\CANopen_3_10\Example_IO\analogdevices\ADSP-CM408F”.
 CO_driver.c from “…\CANopen_3_10\CANopen_stack\analogdevices\ADSP-CM408F”.
 CANopen_stack files from “…\CANopen_3_10\CANopen_stack”.
 CGUInit.c & SoftConfig_CM408F.c Proc_files from
“…\CANopenCM408F\System\src”.
 Scr files from “…\CANopenCM408F\System\src”.
 Verify startup.c & system.c files are targeted from the path:
“…\C:\Analog Devices\ADSP-CM40x\CM403F_CM408F_EZ-KIT\src”.
3. Once the source files are attached, build the Project.
CANopenNode for ADSP-CM408F Setup User Guide
15