CAN API: Structures and Data Types#

Contents:

CAN Bus API: Structures and Data Types#

CAN Bus API : Structures and Data Types

Contents:

CAN_CTRLR_HW_INFO#

Files#

can_bus.h

Structure Member Descriptions#

Name

Definition

Description

.BaseAddr

CPU_ADDR

Controller's registers base address.

.InfoExtPtr

const void *

Extended (driver specific) hardware information.

.IF_Rx

CPU_INT08U

BSP RX interface.

.IF_Tx

CPU_INT08U

BSP TX interface.

CAN_CTRLR_DRV_INFO#

Files#

can_bus.h

Structure Member Descriptions#

Name

Definition

Description

.HW_Info

CAN_CTRLR_HW_INFO

Hardware information structure.

.BSP_API_Ptr

const CAN_CTRLR_BSP_API *

Pointer to BSP API structure.

CAN_CTRLR_BSP_API#

Files#

can_bus.h

Structure Member Descriptions#

Name

Definition

Description

.Open

void(* Open) (void)

BSP open function pointer.

.Close

void(* Close) (void)

BSP close function pointer.

.IntCtrl

void(* IntCtrl) (CAN_BUS_HANDLE bus_handle)

BSP interrupt control pointer.

.TmrCfg

void(* TmrCfg) (CPU_INT32U tmr_period)

BSP timer configuration pointer.

CANopen API: Structures and Data Types#

CANopen API : Structures and Data Types

Contents:

CANopen Core API: Structures and Data Types#

CANopen Core API : Structures and Data Types

Contents:

CANOPEN_NODE_STATE#

Files#

canopen_types.h

Enum Type Descriptions#

Name

Description

CANOPEN_INVALID

Device in INVALID state.

CANOPEN_INIT

Device in INIT state.

CANOPEN_PREOP

Device in PRE-OPERATIONAL state.

CANOPEN_OPERATIONAL

Device in OPERATIONAL state.

CANOPEN_STOP

Device in STOP state.

CANOPEN_STATE_QTY

Number of device states.

CANOPEN_NMT_RESET#

Files#

canopen_types.h

Enum Type Descriptions#

Name

Description

CANOPEN_RESET_NODE

Reset application (and communication).

CANOPEN_RESET_COMM

Reset communication.

CANOPEN_RESET_QTY

Number of reset types.

CANOPEN_EVENT_FNCTS#

Files#

canopen_core.h

Structure Member Descriptions#

Name

Definition

Description

.RpdoOnRx

CPU_INT16S(* RpdoOnRx) (CANOPEN_NODE_HANDLE handle, CANOPEN_IF_FRM *p_frm)

This callback is used when a RPDO is received.

.TpdoOnTx

void(* TpdoOnTx) (CANOPEN_NODE_HANDLE handle, CANOPEN_IF_FRM *p_frm)

This callback is used before a TPDO is transmitted.

.StateOnChange

void(* StateOnChange) (CANOPEN_NODE_HANDLE handle, CANOPEN_NODE_STATE state)

This callback is used when the NMT state is changed.

.HbcOnEvent

void(* HbcOnEvent) (CANOPEN_NODE_HANDLE handle, CPU_INT08U node_id)

This callback is used when a heartbeat consumer monitor timer elapses, before receiving the corresponding heartbeat message.

.HbcOnChange

void(* HbcOnChange) (CANOPEN_NODE_HANDLE handle, CPU_INT08U node_id, CANOPEN_NODE_STATE state)

This callback is used when a heartbeat consumer monitor detects a state change, of a monitored node.

.ParamOnLoad

CPU_BOOLEAN(* ParamOnLoad) (CANOPEN_NODE_HANDLE handle, CANOPEN_PARAM *p_pg)

This callback is used when the NMT slave node is reseted by the NMT master node.

.ParamOnSave

CPU_BOOLEAN(* ParamOnSave) (CANOPEN_NODE_HANDLE handle, CANOPEN_PARAM *p_pg)

This callback is used when the standard object "Store" at index 0x1010 is written.

.ParamOnDflt

CPU_BOOLEAN(* ParamOnDflt) (CANOPEN_NODE_HANDLE handle, CANOPEN_PARAM *p_pg)

This callback is used when the standard object "Restore default parameters" at index 0x1011 is written.

canopen_tmr_action#

Files#

canopen_types.h

Structure Member Descriptions#

Name

Definition

Description

.Id

CPU_INT16U

Unique action identifier.

.NextActionPtr

CANOPEN_TMR_ACTION *

Link to next action.

.Fnct

CANOPEN_TMR_FNCT

Pointer to callback function.

.ParamPtr

void *

Callback function parameter.

.CycleTime

CPU_INT32U

Action cycle time in ticks.

Notes / Warnings#

This structure holds all data, which are needed for managing a timer timed action.

CANOPEN_TMR_MEM#

Files#

canopen_types.h

Structure Member Descriptions#

Name

Definition

Description

.Action

canopen_tmr_action

Memory portion for action info.

.Tmr

canopen_tmr_time

Memory portion for timer info.

Notes / Warnings#

This structure is intended to simplify the memory allocation in the application. The number of actions and timer structures are always the same, therefore we can reduce the configuration effort to the memory array, and the length of this memory array.

CANOPEN_PARAM#

Files#

canopen_param.h

Structure Member Descriptions#

Name

Definition

Description

.MemBlkSize

CPU_INT32U

Size of parameter memory block.

.StartMemBlkPtr

CPU_INT08U *

Start of parameter memory block.

.DfltMemBlkPtr

CPU_INT08U *

Start of default memory block.

.ResetType

CANOPEN_NMT_RESET

Parameter reset type.

.IdPtr

void *

Pointer to User Identification-Code for this group.

.Val

CPU_INT32U

Value when reading parameter object.

CANOPEN_INIT_CFG#

Files#

canopen_core.h

Structure Member Descriptions#

Name

Definition

Description

.SvcTaskStkSizeElements

CPU_INT32U

Service task's stack size, in quantity of elements.

.SvcTaskStkPtr

void *

Pointer to Service stack's stack base.

.MemSegPtr

MEM_SEG *

Pointer to memory segment used for internal data.

.EventQtyTot

CPU_SIZE_T

Number of events allocated from the pool.

.HwTmrPeriod

CPU_INT32U

Timer base time in microsecond.

CANOPEN_OBJ#

Files#

canopen_obj.h

Structure Member Descriptions#

Name

Definition

Description

.Key

CPU_INT32U

Bitmap with information about object (see Note #2).

.TypePtr

canopen_obj_type *

Pointer to object access specialized functions. See Note #3.

.Data

CPU_INT32U

Address of value/data structure or data value for direct access.

Notes / Warnings#

(1) This structure holds all data, needed for managing a single object entry.

(2) The key field is encoded as follows: 16-bit index + 8-bit sub-index + 8-bit flags. The flags are the following:

  • bit 0: 1 = read access allowed

  • bit 1: 1 = write access allowed

  • bit 2: 1 = PDO mappable

  • bit 3: 1 = signed value

  • bit 4: |- valid bytes in 2^n; used if

  • bit 5: | Type=0, or Type->Size ptr=0

  • bit 6: 1 = +/- node-id on read/write

  • bit 7: 1 = direct access, 0 = access via specialized functions

(3) This pointer is optional. If the pointer is null, the object value is accessed directly via the field 'Data'. If the pointer is defined, the object value is accessed by some specialized functions referenced by 'TypePtr'.

canopen_tmr_time#

Files#

canopen_types.h

Structure Member Descriptions#

Name

Definition

Description

.NextPtr

CANOPEN_TMR_TIME *

Link to next timer.

.ActionPtr

canopen_tmr_action *

Root of linked action list.

.ActionEndPtr

canopen_tmr_action *

Last element in linked action list.

.Delta

CPU_INT32U

Delta ticks from previous timer event.

Notes / Warnings#

This structure holds all data, which are needed for managing a timer event.

CANOPEN_IF_FRM#

Files#

canopen_if.h

Structure Member Descriptions#

Name

Definition

Description

.MsgId

CPU_INT32U

CAN message identifier.

.Data

CPU_INT08U

CAN message Data (payload).

.DLC

CPU_INT08U

CAN message data length code (DLC).

.MsgNbr

CPU_INT08U

CAN message number.

Notes / Warnings#

This type definition ensures the independence of the stack from interface driver definitions.

canopen_obj_type#

Files#

canopen_obj .h

Structure Member Descriptions#

Name

Definition

Description

.SizeCb

CANOPEN_OBJ_SIZE_FNCT

Get size of type function.

.CtrlCb

CANOPEN_OBJ_CTRL_FNCT

Special type control function.

.RdCb

CANOPEN_OBJ_RD_FNCT

Read function.

.WrCb

CANOPEN_OBJ_WR_FNCT

Write function.

Notes / Warnings#

This structure holds all data, needed for managing a special object entry type.

CANOPEN_NODE_SPEC#

Files#

canopen_core.h

Structure Member Descriptions#

Name

Definition

Description

.NodeId

CPU_INT08U

Default Node ID.

.Baudrate

CPU_INT32U

Default baudrate for this node.

.DictPtr

CANOPEN_OBJ *

Pointer to object dictionary associated to node.

.DictLen

CPU_INT16U

Object dictionary (maximum) length.

.EmcyCodePtr

CANOPEN_EMCY_TBL *

Pointer to application EMCY information fields.

.TmrMemPtr

CANOPEN_TMR_MEM *

Pointer to timer memory blocks.

.TmrQty

CPU_INT16U

Number of timer memory blocks.

.SdoBufPtr

CPU_INT08U *

Pointer to SDO transfer buffer memory.

Notes / Warnings#

This data structure holds all configurable components of a complete CANopen node.

CANOPEN_DOMAIN_STR#

Files#

canopen_obj.h

Structure Member Descriptions#

Name

Definition

Description

.DataMemStartPtr

CPU_INT08U *

Pointer to Domain/String memory region.

.DataMemSize

CPU_INT32U

Domain/String memory region size, in bytes.

.DataMemOffset

CPU_INT32U

Offset within Domain/String memory region.

Notes / Warnings#

This structure holds all data, which are needed for the domain and string objects management within the object directory.

CANopen Communication Object API: Structures and Data Types#

CANopen Communication object API : Structures and Data Types

Contents:

CANOPEN_EMCY_HIST#

Files#

canopen_emcy.h

Structure Member Descriptions#

Name

Definition

Description

.TotLen

CPU_INT08U

Total length of EMCY history.

.HistQty

CPU_INT08U

Number of EMCY in history.

.Offset

CPU_INT08U

Sub-index-Offset to newest EMCY entry.

CANOPEN_EMCY_TBL#

Files#

canopen_emcy.h

Structure Member Descriptions#

Name

Definition

Description

.Reg

CPU_INT08U

Bit number (0..7) in error register.

.Code

CPU_INT16U

Error code (See Note #1).

Notes / Warnings#

(1) Some pre-defined standard error code values are listed in the section EMERGENCY CODE

CANOPEN_EMCY_USR#

Files#

canopen_emcy.h

Structure Member Descriptions#

Name

Definition

Description

.Hist

CPU_INT16U

Manufacturer specific field in History.

.Emcy

CPU_INT08U

Manufacturer specific field in EMCY message.

Notes / Warnings#

(1) This structure holds the optional manufacturer specific fields for the EMCY message and for the EMCY history.

(2) To reduce memory consumption, the configuration values of CANOPEN_EMCY_HIST_MAN_EN and CANOPEN_EMCY_HIST_MAN_EN may remove some bytes. If no manufacturer specific field is enabled, the structure holds an unused dummy byte.

canopen_hbcons#

Files#

canopen_nmt.h

Structure Member Descriptions#

Name

Definition

Description

.NextPtr

CANOPEN_HBCONS *

Link to next consumer in active chain.

.State

CANOPEN_NODE_STATE

Received Node-State.

.TmrId

CPU_INT16S

Timer Identifier.

.TimeMs

CPU_INT16U

Time (Bit 00-15 when read object).

.NodeId

CPU_INT08U

Node ID (Bit 16-23 when read object).

.MissedEventCnt

CPU_INT08U

Event Counter.

Notes / Warnings#

(1) This structure holds all data, which are needed for the heartbeat consumer handling within the object dictionary.