Home
CANopen user`s reference manual
Contents
1. Use this function to process incoming PDO data and EMCY messages Parameters net CAN network cob communication object Return Value void ssCANopen User s Manual 36 Chapter 4 ssCANopen Application Program Interface canopen_app_update Function Prototype void canopen_app_update void Description This function is called periodically from the CANopen stack Use this function to process incoming PDO data and EMCY messages Parameters void Return Value void ssCANopen User s Manual 37 Chapter 4 ssCANopen Application Program Interface canopen_app_time Function Prototype void canopen_app_time uint8_t net canopen timestamp t ts Description This function is called with every TIME message received by the CANopen stack Use this function to synchronize the node s clock with the network time The TIME message is given a CAN ID with high priority however there still may be some latency due to other messages being transmitted first If additional precision is required the high resolution timestamp object 1013h can be mapped into a PDO Parameters net CAN network ts timestamp containing days and milliseconds since epoch midnight Jan 1 1984 Return Value void ssCANopen User s Manual 38 Chapter 4 ssCANopen Application Program Interface canopen app will change state Function Prototype void canopen app will change state uint8 t net uint8 t canopen state current
2. define VENDOR 0x00455341L stdefine OD PRODUCT CODE 0x00010002L define REVISION 0x00010020L amp define OD SERIAL OxFFFFFFFFL CANopen Special Object Dictionary Entries These definitions indicate to the program the position object dictionary entries such as heartbeat and error register Do not modify these values Hdefine HB 0 Hdefine ER 1 CANopen PDO Entry Layout These definitions define the location of PDO value in the object dictionary These definitions are used by canopen c Do not modify these values Hdefine PDO ID define PDO TYPE define PDO INHIBIT Mtdefine PDO EVENT 55 User s Manual 46 Chapter 6 Examples Chapter 6 Examples This chapter breaks down example s which provide an example of how to implement the ssCANopen protocol stack 6 Example Slave Engine Hours The slave example demonstrates a node that simulates a measured value called engine hours and reports them back to a master node via an asynchronous PDO transmission Engine hours are stored in the slave object dictionary at index 0 6000 subindex 0x01 The engine hour value is updated periodically in app_update uint8 t init engine hours 4 0 0 0 O canopen write od 0x6000 0x01 init engine hours 4 TPDO_1 on the slave is configured to transmit on the default address 0x182 0x180 0x02 6 m Example Master The slave example demonstrates an NMT master node that i
3. the most significant bit of frame gt id i e bit 31 is set it indicates an extended CAN frame else it indicates a standard CAN frame Parameters frame Points to memory where the received CAN frame should be stored Return Value 1 No CAN frame was read from the receive buffer 0 A CAN frame was successfully read from the receive buffer ssCANopen User s Manual 10 Chapter 3 CAN Hardware Abstraction Layer can_tx Function Prototype uint8_t can tx can t frame Description If memory is available inside of the transmit buffer can_tx copies the memory pointed to by frame to the transmit buffer If transmission of CAN frames is not currently in progress then it will be initiated If the most significant bit of frame gt id i e bit 31 is set it indicates an extended CAN frame else it indicates a standard CAN frame Parameters frame Points to the CAN frame that should be copied to the transmit buffer Return Value 1 No CAN frame was written to the transmit buffer 0 The CAN frame was successfully written to the transmit buffer ssCANopen User s Manual 11 Chapter 4 Chapter 4 ssCANopen Application Program Interface ssCANopen Application Program Interface This chapter describes the application program interface API for the CANopen module Function Prototypes void canopen_init void void canopen_update void void canopen_process uint8_t net canopen_t msg void canopen t
4. uint8 t canopen state final Description This function is called when the CANopen device is changing operational state Parameters net CAN network canopen state current current state canopen state final destination state Return Value void ssCANopen User s Manual 39 Chapter 4 ssCANopen Application Program Interface sync Function Prototype void app sync uint8_t net uint8 t counter Description This function is called from the CANopen stack when a SYNC message is received Use this function to synchronize behavior across CANopen nodes Sample data here in preparation for a synchronous PDO transmission See CiA 7 2 2 2 for more information about synchronous PDO transmission The counter byte may be implemented on devices implementing CiA 301 v4 1 The counter allows for multiple virtual SYNC messages on the same CANopen network to distribute bus load or have varied SYNC behavior across nodes Parameters net CAN network counter one byte of counter data may be implemented in some devices Return Value void ssCANopen User s Manual 40 Chapter 4 ssCANopen Application Program Interface canopen app handle sdo Function Prototype void canopen app handle sdo uint8 t net uint8 t nodeid uint16 t index uint8 t subindex uint8 t buf uint8 t buf len Description This function is called from the CANopen stack when an SDO response has been r
5. PLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 6 Limitation of Liability Simma Software s cumulative liability to Client or any other party for any loss or damages resulting from any claims demands or actions arising out of or relating to this License Agreement shall not exceed the license fee paid to Simma Software for the use of the Software In no event shall Simma Software be liable for any indirect incidental consequential special or exemplary damages or lost profits even if Simma Software has been advised of the possibility of such damages SOME STATES DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY TO CLIENT 7 Governing Law This License Agreement shall be construed and governed in accordance with the laws of the State of Indiana 8 Severability Should any court of competent jurisdiction declare any term of this License Agreement void or unenforceable such declaration shall have no effect on the remaining terms hereof 9 No Waiver The failure of either party to enforce any rights granted hereunder or to take action against the other party in the event of any breach hereunder shall not be deemed a waiver by that party as to subsequent enforcement of rights or subsequent actions in the event of future breaches ssCANopen User s Manual 2 Chapter 1 TABLE CONTENTS Table of Contents SSCANOPEN
6. USER S MANUAL SSCANOPEN PROTOCOL STACK LICENSE CHAPTER 1 INTRODUCTION CHAPTER 2 INTEGRATION OF SSCANOPEN CHAPTER 3 CAN HARDWARE ABSTRACTION LAYER 3 1 DATA TYPE DEFINITIONS CAN T 3 2 FUNCTION APIs INIT CAN RX CAN TX CHAPTER 4 SSCANOPEN APPLICATION PROGRAM INTERFACE 4 1 DATA TYPE DEFINITIONS RPDO T TPDO T INDEX T SUBINDEX T COD T COD SUBINDEX T COB T T 4 1 M DATA TYPE DEFINITIONS MASTER ONLY NSD T 4 2 API FUNCTIONS CANOPEN INIT CANOPEN UPDATE CANOPEN PROCESS CANOPEN TX TPDO CANOPEN SET ERROR CANOPEN CLEAR ERRORS CANOPEN SET STATE CANOPEN READ OD CANOPEN WRITE OD CANOPEN READ REMOTE OD ssCANopen User s Manual Introduction CO i 10 11 12 12 12 14 15 16 17 18 19 20 21 21 22 22 23 24 25 26 27 28 29 30 31 Chapter 1 CANOPEN_WRITE_REMOTE_OD CANOPEN_SYNC_ENABLE CANOPEN_SYNC_DISABLE 4 2 FUNCTIONS MASTER ONLY CANOPEN_SET_STATE_REMOTE_NODE 4 2 APPLICATION CALLBACK FUNCTIONS CANOPEN_APP_PROCESS CANOPEN_APP_UPDATE CANOPEN_APP_TIME CANOPEN_APP_WILL_CHANGE_STATE CANOPEN_APP_SYNC CANOPEN_APP_HANDLE_SDO CHAPTER 5 CONFIGURATION PROJECT SETTINGS DEVICE SETTINGS DEVICE SETTINGS CHAPTER 6 EXAMPLES ssCANopen User s Manual Introduction 32 33 34 35 35 36 36 37 38 39 40 41 42 42 43 ERROR BOOKMARK NOT DEFINED 47 Chapter 1 Introduction Chapter 1 Introduction ssCANo
7. ansmit is changed This parameter allows other parts of the code to manually flag this TPDO as changed Under canopen update is changed is set to 1 with regard to event time and set to O with regard to inhibit time Return Value 1 Message was not buffered for transmission 0 Message was buffered for transmission ssCANopen User s Manual 25 Chapter 4 ssCANopen Application Program Interface canopen_set_error Function Prototype void canopen_set_error uint8_t net uint16_t emcy_code uint8_t mfg_code Description Call to set the error state indicating an internal error has occurred This will add the error to the error field object 1003h and transmit the error on the CANopen network using the EMCY object Supporting the EMCY object is optional however if implemented the device should support at minimum the 0000h Error reset and 1000h Generic error codes See canopen clear errors for clearing an error state Parameters net CAN network emcy code CANopen EMCY code best representing internal error See canopen h for a partial list and CIA 301 7 2 7 1 for the complete list mfg code An optional 5 byte manufacture specific error code Return Value void ssCANopen User s Manual 26 Chapter 4 ssCANopen Application Program Interface canopen_clear_errors Function Prototype void canopen_clear_errors uint8_t net Description Call to clear the CANopen device s error state This will cl
8. do_t is a data type used to store RPDO configuration information It contains the command byte the position in canopen_od and the number of object dictionary entries it spans Definition typedef struct uint8 t com uint8 t entry uint8 t entries t ssCANopen User s Manual 13 Chapter 4 ssCANopen Application Program Interface tpdo t Description t is data type used to store configuration information It contains the command byte the position in canopen od and the number of object dictionary entries it spans It also stores the timestamps for event and inhibit timers if enabled Definition typedef struct uint8 t com uint8 t entry uint8 t entries uint8 t type uint16 t event timestamp uint16 t inhibit timestamp tpdo t ssCANopen User s Manual 14 Chapter 4 ssCANopen Application Program Interface index_t Description index_t is a data type used to store each dynamic object dictionary entry It contains the object dictionary index no correlation to position in array subindex array and the number of subindexes allocated and up to 4 bytes of data canopen_od is an array of this data type Definition typedef struct uint16 t index uint8 t subindexes subindex t subindex index t ssCANopen User s Manual 15 Chapter 4 ssCANopen Application Program Interface subindex_t Description subindex_t is a data type used to store each d
9. ds and receives on all CAN networks Independent will create an independently configured and operating CANopen device for each network d Set your CANopen node ID between 1 and 127 e As needed add and or customize entries in the object dictionary f As needed add PDO and PDO mapping entries in the object dictionary for all RPDOs and TPDOs the device will support ssCANopen User s Manual 6 Chapter 2 Integration of ssCANopen g Export the canopen cfg c and canopen cfg h files from the configuration tool 6 Optional Implement canopen app handle sdo to use SDO client functionality 7 Optional Implement canopen app time to support synchronizing the device to network time ssCANopen User s Manual 7 Chapter 3 CAN Hardware Abstraction Layer Chapter 3 CAN Hardware Abstraction Layer The hardware abstraction layer HAL is a software module that provides functions for receiving and transmitting controller area network CAN data frames Because CAN peripherals typically differ from one microcontroller to another this module is responsible for encompassing all platform depended aspects of CAN communications The HAL contains three functions that are responsible for initializing the CAN hardware and handling buffered reception and transmission of CAN frames Function Prototype Function Description void can_init void Initializes CAN hardware uint8 t can rx uint8 t p can t frame Receives CAN frame buffer
10. e s object dictionary to read Return Value void ssCANopen User s Manual 31 Chapter 4 ssCANopen Application Program Interface canopen_write_remote_od Function Prototype void canopen_write_remote_od uint8_t net uint8 t node id uint16 t index uint8 t subindex uint8 t uint8 t len Description Changes the value at a given location in a remote object dictionary Node ID specifies the remote node index and subindex indicate the locate in the object dictionary This function initiates an SDO transfer to the remote node s SDO server to transfer the data If the data is less than 4 bytes an expedited transfer is used If the data exceeds 4 bytes segmented transfer is used Block transfer is not supported Parameters net CAN network node id node id of the remote node index index in the remote node s object dictionary to modify subindex subindex in the remote node s object dictionary to modify buf data bytes to write len number of data bytes to write Return Value void ssCANopen User s Manual 32 Chapter 4 ssCANopen Application Program Interface canopen_sync_enable Function Prototype void canopen_sync_enable uint8_t net Description Enables the node to begin transmitting the SYNC message according to the configured SYNC inhibit period Only one node on a network should be a SYNC producer Parameters net CAN network Return Value void ssCANopen User s Manual 33 Chap
11. ear the error field object 1003h and transmit an EMCY message with the CANOPEN_EMCY_ERROR_RESET code signaling to EMCY consumers that the error condition has been cleared Parameters net CAN network Return Value void ssCANopen User s Manual 27 Chapter 4 ssCANopen Application Program Interface canopen_set_state Function Prototype uint8_t canopen_set_state uint8_t net uint8_t canopen_nmt_state Description Requests a change in the operational state of the CANopen device See diagram operational states for permissible state changes The state change will only occur if it is a permitted state change Example A device in the Initialization state cannot switch to Operational directly Parameters net CAN network canopen nmt state state to transition to See CANOPEN STATE in canopen h Return Value uint8 t success code O success 1 fail ssCANopen User s Manual 28 Chapter 4 ssCANopen Application Program Interface read od Function Prototype void canopen read od uint8 t net uint16_t index uint8 t subindex uint8 t buf uint8 t len Description Read the object dictionary location specified by index and subindex into buf Parameters net CAN network index index in the remote node s object dictionary subindex subindex in the remote node s object dictionary buf buffer to store read value len bytes to read Return Value void ssCANopen User s Manua
12. eceived Parameters net CAN network nodeid node ID of remote SDO server index index of object dictionary entry subindex subindex of object dictionary entry buf data bytes buf len number of data bytes Return Value void ssCANopen User s Manual 41 Chapter 5 Configuration Chapter 5 Configuration This chapter describes all configurable items of the CANopen module All of these configurations can be set using the configuration tool application which has been designed to make configuration of the object dictionary easier The application will export all settings and the object dictionary to two C language files canopen_cfg c and canopen_cfg h Requirements Environment The configuration tool is designed to operate on Windows 7 and emit standard C files for inclusion with the CANopen stack files Projects can be saved from the configuration tool to a text based format Some systems including Windows XP will require NET 4 0 to be installed from the following link http www microsoft com en us download details aspx id 17851 Project Settings Project Settings General Fixed tick period ms 20 Export Filename c myCANopenProject canopen_cfg c h Developer Version 1 1 Notes This profile is forthe sample slave device that generates an engine hours value and transmits it on RPDO 0 CAN Number of CAN networks 1 Device Mode 9 Mirored One CANopen Device Independent Unique CANopen device per CAN
13. ed 1 0 uint8 t can tx uint8 t p can t frame Transmits CAN frame buffered 1 0 Table 3 1 HAL functions 3 1 Data Type Definitions can t Data type can t Description can tis a data type used to store CAN frames It contains the CAN frame identifier the CAN frame data the size of data and CAN network number NOTE If the most significant bit of id i e bit 31 is set it indicates an extended CAN frame else it indicates a standard CAN frame Definition typedef struct uint32 t id uint8 t buf 8 uint8 t buf len can_t ssCANopen User s Manual 8 Chapter 3 CAN Hardware Abstraction Layer 3 2 Function APIs can init Function Prototype void can init void Description can init initializes the CAN peripheral for reception and transmission of CAN frames at a network speed of 250 kbps Any external hardware that needs to be initialized can be done inside of can init The sample point should be as close to 0 875 as possible but should not exceed it See CANOPEN 11 and CANOPEN 15 for additional bit timing and sample point information Parameters void Return Value void ssCANopen User s Manual 9 Chapter 3 CAN Hardware Abstraction Layer can rx Function Prototype uint8 t can rx can t frame Description can rx checks to see if there is a CAN data frame available in the receive buffer If one is available it is copied into the can t structure which is pointed to by frame If
14. f struct uint8 t fcode uint8 t src uint8 t buf uint8 t buf len i cob t ssCANopen User s Manual 19 Chapter 4 ssCANopen Application Program Interface canopen_timestamp_t Description canopen_timestamp_t is a data type used to store and transmit the network time It contains 28bits representing milliseconds 4 reserved bits and 16 bits for days since the reference time of midnight January 1 1984 This data type is used by object dictionary index 0x1012 and the timestamp consumer producer functions Definition typedef struct uint32 t milliseconds uint16 t days canopen timestamp t ssCANopen User s Manual 20 Chapter 4 ssCANopen Application Program Interface 4 1 m Data Type Definitions Master only nsd t Description NSD t is a data type used to store the status of nodes observed on the CANopen network It contains the nodeid operational state and timestamp representing the time the last heartbeat was observed canopen nsd is an array of this data type Definition typedef struct uint8 t nodeid uint8 t state uint8 t flags Uint32 tlastseen timestamp nsd t ssCANopen User s Manual 21 Chapter 4 4 2 Functions canopen_init Function Prototype void canopen_init void Description Initializes the CANopen module Parameters void Return Value void ssCANopen User s Manual ssCANopen Application Program Interface 22 Cha
15. he node ID must be between 1 and 127 Nodeid number between 1 and 127 NMT Master This flag enables NMT master functionality in the given node Only one node on a CANopen network can be master Requires sSCANopen master MASTER O disabled or 1 enabled ssCANopen User s Manual 43 Chapter 5 Configuration CANopen Heartbeat Configure the interval at which heartbeats are transmitted from this node in milliseconds Heartbeat must be greater than 0 Node guarding not supported define OD HB TIME 3000U CANOPENCFG_TICK_PERIOD SYNC Producer This flag enables SYNC producer functionality in the given node Only one node on a CANopen network can be a SYNC producer not necessarily the master SYNC communication cycle period is the period in microseconds of the SYNC signal SYNC_MAX_VALUE sets the highest value for the counter object 1019h This should be a multiple of the highest synchronous PDO cycle to guarantee that the lowest frequency synchronous PDO will be transmitted in one counter cycle SYNC PRODUCER O disabled or 1 enabled SYNC_CYCLE_TIME 3000U CANOPENCFG_TICK_PERIOD SYNC MAX VALUE 100 ssCANopen User s Manual 44 Chapter 5 Object Dictionary Add Index Project amp CAN Settings CANopen Device 0 Device Settings B Object Dictionary 01000 Device Type Information 01001 Error Register 01005 COB ID SYNC 01006 Sync cycle period us required for SYNC p
16. l 29 Chapter 4 ssCANopen Application Program Interface canopen write od Function Prototype void canopen write od uint8 t net uint16 t index uint8 t subindex uint8 t buf uint8 t len Description Writes the value in buf to the object dictionary location specified by index and subindex Parameters net CAN network node id node id of the remote node index index in the remote node s object dictionary to modify subindex subindex in the remote node s object dictionary to modify buf data bytes to write len number of data bytes to write Return Value void ssCANopen User s Manual 30 Chapter 4 ssCANopen Application Program Interface canopen_read_remote_od Function Prototype void canopen_read_remote_od uint8_t net uint8_t node_id uint16_t index uint8_t subindex Description Read the object dictionary value at a given location in a remote node s object dictionary Node ID index and subindex values indicate the node and location of the value to read This function requests an SDO transfer from the remote node s SDO server If the data is less than 4 bytes an expedited transfer is used if length exceeds 4 bytes segmented transfer is used Block transfer is not supported The returned data is passed to canopen app handle sdo Parameters net CAN network node id node id of the remote node index index in the remote node s object dictionary to read subindex subindex in the remote nod
17. ma Software s Rights Client acknowledges and agrees that the Software and the documentation are proprietary products of Simma Software and are protected under U S copyright law Client further acknowledges and agrees that all right title and interest in and to the Software including associated intellectual property rights are and shall remain with Simma Software This License Agreement does not convey to Client an interest in or to the Software but only a limited right of use revocable in accordance with the terms of this License Agreement 3 License Fees The Client in consideration of the licenses granted under this License Agreement will pay a one time license fee 4 Term This License Agreement shall continue until terminated by either party Client may terminate this License Agreement at any time Simma Software may terminate this License Agreement only in the event of a material breach by Client of any term hereof provided that such shall take effect 60 days after receipt of a written notice from Simma Software of such termination and further provided that such written notice allows 60 days for Client to cure such breach and thereby avoid termination Upon termination of this License Agreement all rights granted to Client will terminate and revert to Simma Software Promptly upon termination of this Agreement for any reason or upon discontinuance or abandonment of Client s possession or use of the Software Client must return or destroy as re
18. network Figure 5 1 Configuring project settings CANopen System Tick Period Configuration After configuring the system to call canopen update at a fixed periodic interval the definition CANOPENCFG TICK PERIOD should be set to match the number of ssCANopen User s Manual 42 Chapter 5 Configuration milliseconds in the period This provides the time base for the CANopen module It is recommended that this function be called at least every 25 ms 2 System s fixed tick period in milliseconds Hdefine CANOPENCFG TICK PERIOD 20U Export Filename Set the path and filename for the exported CANopen settings file Defaults are canopen cfg c canopen cfg h Export filename filename and path Developer The developer fields version and notes are provided solely for the developer s use and could be used to track the version of the device profile and a descriptive comment version Text for developer s use notes Text comment for developer s use CAN Configure the number of CAN networks minimum 1 then select the device mode Mirrored will create one CANopen device which sends and receives on all CAN networks Independent will create an independently configured and operating CANopen device for each network CAN NETWORKS number of CAN networks to use DEVICE MODE 1 independent Device Settings CANopen node ID The node ID identifies the CANopen device s unique address on the network T
19. pen is high performance CANopen protocol stack written in ANSI ssCANopen adheres to both the SAE CANopen specification and to the software development best practices described in the MISRA C guidelines ssCANopen is a modularized design with an emphasis on software readability and performance ssCANopen is easy to understand and platform independent allowing it to be used on any CPU or DSP with or without an RTOS ssCANopen has been shown to be up to 500 faster and 61 smaller than other commercially available CANopen protocol stacks ssCANopen implements the data link layer described in CIA 301 See that document for a complete understanding of the CANopen protocol and specification ssCANopen also implements NMT Master behavior node boot up process SYNC producer and TIME producer as described in CIA DSP 302 See that document for a complete understanding of those additional specifications Filenames File Description Core header file for 55 Do not modify ssCANopen configuration file Modification allowed ssCANopen configuration header file Modification allowed End user application Modification allowed End user application Modification allowed Table 1 1 ssCANopen files ssCANopen User s Manual 5 Chapter 2 Integration of ssCANopen Chapter 2 Integration of sSCANopen This chapter describes how to integrate ssCANopen into your application After this is complete you
20. pter 4 ssCANopen Application Program Interface canopen update Function Prototype void canopen update void Description Provides the periodic time base for the CANopen module This function should be called by the application at the period defined in CANOPENCFG TICK PERIOD Parameters void Return Value void ssCANopen User s Manual 23 Chapter 4 ssCANopen Application Program Interface canopen_process Function Prototype void canopen process uint8 t net canopen t msg Description Processes received CANopen message This function is called by the CANopen module with a complete CANopen message and is the intended location for the application layer to handle received CANopen messages Multipacket messages are not supported in this version Parameters net CAN network msg Pointer to received CANopen message Return Value void ssCANopen User s Manual 24 Chapter 4 ssCANopen Application Program Interface canopen tx tpdo Function Prototype void canopen tx tpdo uint8 t net uint8 Description This function can be called from the application to send an event based TPDO Note TPDOs can also be transmitted from canopen update under the context of either inhibit time or a SYNC message For event time is changed is always set to 1 but inhibit time actually checks if the PDO data has changed before transmitting Parameters net CAN network n Designates which TPDO to tr
21. quested by Simma Software all copies of the Software in Client s possession and all other materials pertaining to the Software including all copies thereof Client agrees to certify compliance with such restriction upon Simma Software s request 5 Limited Warranty Simma Software warrants for Client s benefit alone for a period of one year called the Warranty Period from the date of delivery of the software that during this period the Software shall operate substantially in accordance with the functionality described in the User s Manual If during the Warranty Period a defect in the Software appears Simma Software will make all reasonable efforts to cure the defect at no cost to the Client Client agrees that the foregoing constitutes Client s sole and exclusive remedy for breach by Simma Software of any warranties made under this Agreement Simma Software is not responsible for obsolescence of the Software that may result from changes in Client s requirements The foregoing warranty shall apply only to the most current version of the Software issued from time to time by Simma Software Simma Software assumes no responsibility for the use of superseded outdated or uncorrected versions of the licensed software EXCEPT FOR THE WARRANTIES SET FORTH ABOVE THE SOFTWARE AND THE SOFTWARE CONTAINED THEREIN ARE LICENSED AS IS AND SIMMA SOFTWARE DISCLAIMS ANY AND ALL OTHER WARRANTIES WHETHER EXPRESS OR IMPLIED INCLUDING WITHOUT LIMITATION ANY IM
22. roducers 01015 Sync inhibit time required for SYNC producers 01017 Heartbeat Time 1 01018 Identity Object x01 Vendor ID 0 02 Product Code 0x03 Revision Number 0 04 Serial Number 01400 RPDO 0 01401 RPDO 1 01600 RPDO 0 Mapping 01601 RPDO 1 Mapping 0180 Startup 05302 06000 User OD Entry for storing Engine Hours 0 6200 User OD Entry for storing RPDO 0 output Subindex Entry Index Sub Index Description Type Length Access Value Configuration 01018 002 Product Code UNSIGNED32 RO v 00001000201 Figure 5 2 Configuring object dictionary index 1018h subindex 0x02 Product Code Object Dictionary The object dictionary values are set automatically based on the number of object dictionary entries TPDOs and RPDOs that are defined using the configuration tool Hdefine CANOPEN_CFG_NUMBER_TPDOS define CANOPEN_CFG_NUMBER_RPDOS Hdefine CANOPEN_CFG_MAX_PDO_SIZE define CANOPEN_ COD SIZE amp define OD SIZE ssCANopen User s Manual 2 0 1 8 4 12 45 Chapter 5 Configuration CANopen Proprietary Application Settings These are miscellaneous fields representing the node id device type vendor id product code product revision and serial number See the CANopen specification CIA 301 for details These are stored in objects 1001h and 1018h define CANOPEN_NODE_ID 0x01 define OD DEVICE TYPE 0x000F0191L
23. s designed to receive engine hour transmissions from the example slave After initializing the master resets all of the nodes on the network then after receiving the init heartbeat from the slave node in canopen process the master commands the example slave to go pre operational and finally operational RPDO the master configured to receive the message from the slave Received values are stored at index 0 6200 subindex 0x01 Periodically in canopen app update the master reads the stored value from that location and places it temporarily in a variable called hours ssCANopen User s Manual 47
24. ssCANopen User s Manual Created by the CANopen Experts Version 1 4 February 10th 2014 Copyright 2014 Simma Software Inc Simma Software 55 Protocol Stack License READ THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT CAREFULLY BEFORE OPENING THE PACKAGE CONTAINING THE PROGRAM DISTRIBUTION MEDIA DISKETTES CD ELECTRONIC MAIL THE COMPUTER SOFTWARE THEREIN AND THE ACCOMPANYING USER DOCUMENTATION THIS SOURCE CODE IS COPYRIGHTED AND LICENSED NOT SOLD BY OPENING THE PACKAGE CONTAINING THE SOURCE CODE YOU ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT IF YOU ARE NOT WILLING TO BE BOUND BY THE TERMS OF THIS LICENSE AGREEMENT YOU SHOULD PROMPTLY RETURN THE PACKAGE IN UNOPENED FORM AND YOU WILL RECEIVE A REFUND OF YOUR MONEY THIS LICENSE AGREEMENT REPRESENTS THE ENTIRE AGREEMENT CONCERNING THE CANOPEN PROTOCOL STACK BETWEEN YOU AND SIMMA SOFTWARE INC REFERRED TO AS LICENSOR AND IT SUPERSEDES ANY PRIOR PROPOSAL REPRESENTATION OR UNDERSTANDING BETWEEN THE PARTIES 1 Corporate License Grant Simma Software hereby grants to the purchaser herein referred to as the Client a royalty free non exclusive license to use the CANopen protocol stack source code collectively referred to as the Software as part of Client s product Except as provided above Client agrees to not assign sublicense transfer pledge lease rent or share the Software Code under this License Agreement 2 Sim
25. ter 4 ssCANopen Application Program Interface canopen_sync_disable Function Prototype void canopen_sync_disable uint8_t net Description Disables SYNC message transmission Parameters net CAN network Return Value void ssCANopen User s Manual 34 Chapter 4 ssCANopen Application Program Interface 4 2 m API Functions Master only canopen_set_state_remote_node Function Prototype void canopen set state remote node uint8_t net uint8 t node id uint8 t canopen nmt state Description Requests a change in the operational state of the remote CANopen device See diagram operational states for permissible state changes The state change will only occur if it is a permitted state change Example A device in the Initialization state cannot switch to Operational directly Parameters net CAN network node id node id of the remote node Use 0 to affect all nodes canopen nmt state state to transition to See CANOPEN STATE in canopen h Return Value void ssCANopen User s Manual 35 Chapter 4 ssCANopen Application Program Interface 4 2 Application Callback Functions app process Function Prototype void canopen app process uint8 t net cob t Description This function is called from the CANopen stack with every CANopen message while the device is operational cob contains the function code source address the number of data bytes and up to 8 bytes of data
26. will be able to receive and transmit CANopen messages over CAN For implementation details please see the chapters covering the APIs for CANopen and CAN Integration Steps 1 Develop or purchase a CAN device driver which adheres to the CAN API specified in Chapter 3 2 Before using any of the CANopen module features make sure the CAN driver has been initialized by calling can init Typically it is called shortly after power on reset and before the application is started 3 Before using any of the sSCANopen module features make sure the ssCANopen has been initialized by calling canopen init Typically it is called after can init and before the application is started 4 Call canopen update at a fixed periodic interval e g every 10 ms This provides the time base for the CANopen module It is recommended that this function be called at least every 25 ms 5 Use the configuration tool to set the key CANopen settings and export them into canopen cfg c and canopen cfg h files These files define the CANopen device s object dictionary and key configuration values Base master and slave profiles are provided as a starting point for creating your device profile See the Configuration and Examples chapters for full details a Set your system s fixed periodic interval described above in step H4 b Setthe number of CAN networks that will be used minimum 1 C Setthe device mode Mirrored will create one CANopen device which sen
27. x tpdo uint8 t net uint8 tn void canopen set error uint8 t net uint16 t emcy code uint8 t mfg code void canopen clear errors uint8 t net uint8 t canopen set state uint8 t net uint8 t canopen nmt state void canopen read od uint8 t net uint16 t index uint8 t subindex uint8 t buf uint8 t len void canopen write od uint8 t net uint16 t index uint8 t subindex uint8 t buf uint8 t len void canopen read remote od uint8 t net uint8 t node id uint16_t index uint8 t subindex void canopen write remote od uint8 t net uint8 t node id uint16 t index uint8 t subindex uint8 t buf uint8 t len void canopen sync enable uint8 t net void canopen sync disable uint8 t net void canopen set state remote node uint8 t net uint8 t node id uint8 t canopen nmt state Table 4 1 API functions 4 1 Data Type Definitions rpdo t ssCANopen User s Manual Function Descriptions Initializes protocol stack Provides periodic time base Processes received CANopen messages Transmits an event based TPDO Set error state Reset error state Set device operational state Read local object dictionary entry Write local object dictionary entry Read remote object dictionary entry SDO client Write remote object dictionary entry SDO client Enable SYNC producer Disable SYNC producer Set remote node state Master only 12 Chapter 4 ssCANopen Application Program Interface Description rp
28. ynamic object dictionary subindex entry It contains the number of data elements and array of up to 4 bytes of data Each index in canopen_od contains an array of this data type Definition typedef struct uint8 t len uint8 t data subindex t ssCANopen User s Manual 16 Chapter 4 ssCANopen Application Program Interface cod t Description cod t is a data type used to store each constant object dictionary entry It contains the index the number of subindexes and an array of subindex entries canopen od is an array of this data type Definition typedef struct uint16 t index uint8 t num subindexes cod subindex t subindexes i cod t ssCANopen User s Manual 17 Chapter 4 ssCANopen Application Program Interface cod_subindex_t Description cod_subindex_t is a data type used to store each object dictionary subindex entries It contains a command byte and up to 32 bits of data Each index in canopen_cod contains an array of this data type Definition typedef struct uint8 t cmd uint8 t data cod subindex t ssCANopen User s Manual 18 Chapter 4 ssCANopen Application Program Interface cob t Description COB t is a data type used to store a communication object COB It contains the function code source address the number of data bytes and up to 8 bytes of data Incoming CANopen messages are passed to the application layer using this object Definition typede
Download Pdf Manuals
Related Search
Related Contents
Timex TX6130 User's Manual Notice du Robot pétrin multi-fonction E201803 - EXPERT カタログはコチラ VERGEMASTER RX ™ Amazing performance, breathtaking mobile multimedia PDFをダウンロード User Manual - amo Copyright © All rights reserved.
Failed to retrieve file