CANopen Master Documentation
Version 6.06.04
Loading...
Searching...
No Matches
com_lss.h File Reference

Detailed Description

LSS offers the possibility to inquire and change the settings of certain parameters of the local layers on a CANopen module with LSS Slave capabilities by a CANopen module with LSS Master capabilities via the CAN Network. The following parameters can be inquired and/or changed by the use of LSS:

  • Node-ID of the CANopen Slave
  • Bit timing parameters of the physical layer (baud rate)
  • LSS address (Identity Object, Index 1018H)

By using LSS a LSS Slave can be configured for a CANopen network without using any devices like DIP-switches for setting the parameters.

+ Include dependency graph for com_lss.h:

Data Structures

struct  ComLssAddress_s
 

Typedefs

typedef struct ComLssAddress_s ComLssAddress_ts
 

Enumerations

enum  ComLssMode_e {
  eCOM_LSS_MODE_WAITING = 0 ,
  eCOM_LSS_MODE_CONFIGURATION
}
 
enum  ComLssProt_e {
}
 
enum  ComLssStat_e {
  eCOM_LSS_STAT_ACTIVE = 1 ,
  eCOM_LSS_STAT_SUCCESS ,
  eCOM_LSS_STAT_ERROR ,
  eCOM_LSS_STAT_TIMEOUT
}
 
enum  ComLssInqSrv_e {
  eCOM_LSS_INQ_SRV_VID = 0 ,
  eCOM_LSS_INQ_SRV_PRD ,
  eCOM_LSS_INQ_SRV_REV ,
  eCOM_LSS_INQ_SRV_SRN ,
  eCOM_LSS_INQ_SRV_NID
}
 

Functions

ComStatus_tv ComLssConfigureBitTiming (uint8_t ubNetV, uint8_t ubBittimeSelV)
 
ComStatus_tv ComLssConfigureNodeId (uint8_t ubNetV, uint8_t ubNodeIdV)
 
void ComLssEventReceive (uint8_t ubNetV, uint8_t ubLssProtocolV)
 
ComStatus_tv ComLssFastscan (uint8_t ubNetV, uint32_t ulVendorIdV, uint32_t ulProdCodeV, uint32_t ulRevisionNumV, uint32_t ulSerialNumV)
 
uint32_t ComLssGetAddrSerialNum (uint8_t ubNetV)
 
ComStatus_tv ComLssGetIdentity (uint8_t ubNetV, ComLssAddress_ts *ptsLssAddressV)
 
ComStatus_tv ComLssGetStatus (uint8_t ubNetV, uint8_t *pubStatusV)
 
ComStatus_tv ComLssIdentifyNonConfiguredSlave (uint8_t ubNetV)
 
ComStatus_tv ComLssIdentifyRemoteSlave (uint8_t ubNetV, uint32_t ulVendorIdV, uint32_t ulProdCodeV, uint32_t ulRevisionNumLowV, uint32_t ulRevisionNumHighV, uint32_t ulSerialNumLowV, uint32_t ulSerialNumHighV)
 
ComStatus_tv ComLssInquiryService (uint8_t ubNetV, uint8_t ubServiceV)
 
ComStatus_tv ComLssSetTimeout (uint8_t ubNetV, uint16_t uwTimeV)
 
ComStatus_tv ComLssStoreConfiguration (uint8_t ubNetV)
 
ComStatus_tv ComLssSwitchModeGlobal (uint8_t ubNetV, uint8_t ubModeV)
 
ComStatus_tv ComLssSwitchModeSelective (uint8_t ubNetV, uint32_t ulVendorIdV, uint32_t ulProdCodeV, uint32_t ulRevisionNumV, uint32_t ulSerialNumV)
 

Typedef Documentation

◆ ComLssAddress_ts

CANopen Master - LSS address.

The structure ComLssAddress_s defines a 128-bit number to identify each node uniquely, consisting of the vendor-ID, product code, revision number and serial number with 32 bit each, defined in /CiA301/ object 1018h. The value can be determined by calling ComLssGetIdentity() after an successful LSS fastscan procedure.

Enumeration Type Documentation

◆ ComLssInqSrv_e

CANopen Master LSS inquire services

Enumerator
eCOM_LSS_INQ_SRV_VID 

inquire vendor ID

eCOM_LSS_INQ_SRV_PRD 

inquire product code

eCOM_LSS_INQ_SRV_REV 

inquire revision number

eCOM_LSS_INQ_SRV_SRN 

inquire serial number

eCOM_LSS_INQ_SRV_NID 

inquire node ID

◆ ComLssMode_e

See also
ComLssSwitchModeGlobal() LSS mode

This enumeration defines the allowed modes for the LSS switch mode global command.

Enumerator
eCOM_LSS_MODE_WAITING 

switch LSS state machine to LSS waiting mode

eCOM_LSS_MODE_CONFIGURATION 

switch LSS state machine to LSS configuration mode

◆ ComLssProt_e

CANopen Master LSS protocol

Enumerator
eCOM_LSS_PROT_SWI_GLB 

switch global command

eCOM_LSS_PROT_SWI_VID 

switch mode selective, vendor ID

eCOM_LSS_PROT_SWI_PRD 

switch mode selective, product code

eCOM_LSS_PROT_SWI_REV 

switch mode selective, revision number

eCOM_LSS_PROT_SWI_SRN 

switch mode selective, serial number

eCOM_LSS_PROT_IDENT_VID 

identify remote slave, vendor ID

eCOM_LSS_PROT_INQ_VID 

inquire vendor ID

eCOM_LSS_PROT_INQ_PRD 

inquire product code

eCOM_LSS_PROT_INQ_REV 

inquire revision number

eCOM_LSS_PROT_INQ_SRN 

inquire serial number

eCOM_LSS_PROT_INQ_NID 

inquire node ID

eCOM_LSS_PROT_CONF_STORE 

store configuration

eCOM_LSS_PROT_CONF_ID 

configure node ID

eCOM_LSS_PROT_CONF_BIT 

configure bit-timing

eCOM_LSS_PROT_FASTSCAN 

execute fastscan procedure

eCOM_LSS_PROT_IDENTIFY 

identify non-configured slave

◆ ComLssStat_e

CANopen Master LSS status

Enumerator
eCOM_LSS_STAT_ACTIVE 

LSS communication active

eCOM_LSS_STAT_SUCCESS 

LSS communication success

eCOM_LSS_STAT_ERROR 

LSS protocol error

eCOM_LSS_STAT_TIMEOUT 

LSS communication timeout

Function Documentation

◆ ComLssConfigureBitTiming()

ComStatus_tv ComLssConfigureBitTiming ( uint8_t  ubNetV,
uint8_t  ubBittimeSelV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubBittimeSelVNew bit-timing value
Returns
Value of enumeration ComErr_e

By means of the Configure Bit Timing Parameters service the LSS Master sets the new bit-timing on a LSS Slave.

◆ ComLssConfigureNodeId()

ComStatus_tv ComLssConfigureNodeId ( uint8_t  ubNetV,
uint8_t  ubNodeIdV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubNodeIdVNew Node-ID value
Returns
Value of enumeration ComErr_e

By means of this service the LSS Master configures the NMT-address parameter of a LSS Slave. This service allows only one LSS Slave in configuration mode. The remote result parameter confirms the success or failure of the service. In case of a failure optionally the reason is confirmed.

◆ ComLssEventReceive()

void ComLssEventReceive ( uint8_t  ubNetV,
uint8_t  ubLssProtocolV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubLssProtocolVLSS protocol

The function is called by the LSS master state machine upon reception of a LSS response message issued by the LSS slave device. The parameter ubNetV defines the CANopen network. The value of the parameter ubLssProtocolV is defined by the enumeration ComLssProt_e.

An example implementation is available in the file com_user.c.

◆ ComLssFastscan()

ComStatus_tv ComLssFastscan ( uint8_t  ubNetV,
uint32_t  ulVendorIdV,
uint32_t  ulProdCodeV,
uint32_t  ulRevisionNumV,
uint32_t  ulSerialNumV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ulVendorIdVVendor ID (1018h, sub 1)
[in]ulProdCodeVProduct code (1018h, sub 2)
[in]ulRevisionNumVRevision number (1018h, sub 3)
[in]ulSerialNumVSerial number (1018h, sub 4)
Returns
Value of enumeration ComErr_e

◆ ComLssGetAddrSerialNum()

uint32_t ComLssGetAddrSerialNum ( uint8_t  ubNetV)
Deprecated:
This function is deprecated and will be removed in a future version of the CANopen Master protocol stack. Please use ComLssGetIdentity() as a replacement.
Parameters
[in]ubNetVCANopen Network channel
Returns
Serial number

The function returns the serial number of a LSS slave device that was found by the LSS fastscan protocol.

◆ ComLssGetIdentity()

ComStatus_tv ComLssGetIdentity ( uint8_t  ubNetV,
ComLssAddress_ts ptsLssAddressV 
)
Parameters
[in]ubNetVCANopen Network channel
[in,out]ptsLssAddressVPointer to LSS address structure
Returns
Value of enumeration ComErr_e

The function allows access to the elements of the LSS address structure ComLssAddress_ts after a LSS slave device was found by the LSS fastscan protocol.

◆ ComLssGetStatus()

ComStatus_tv ComLssGetStatus ( uint8_t  ubNetV,
uint8_t *  pubStatusV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]pubStatusVPointer to status variable
Returns
Value of enumeration ComErr_e

This function returns the status of the LSS master state machine. Valid codes passes the the pointer pubStatusV are given in the enumeration ComLssStat_e.

◆ ComLssIdentifyNonConfiguredSlave()

ComStatus_tv ComLssIdentifyNonConfiguredSlave ( uint8_t  ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Value of enumeration ComErr_e

This function starts the Identify non-configured remote slave protocol. If there are non-configured remote slaves in the network, the status will be set to eCOM_LSS_STAT_SUCCESS, otherwise the status will be eCOM_LSS_STAT_TIMEOUT.

◆ ComLssIdentifyRemoteSlave()

ComStatus_tv ComLssIdentifyRemoteSlave ( uint8_t  ubNetV,
uint32_t  ulVendorIdV,
uint32_t  ulProdCodeV,
uint32_t  ulRevisionNumLowV,
uint32_t  ulRevisionNumHighV,
uint32_t  ulSerialNumLowV,
uint32_t  ulSerialNumHighV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ulVendorIdVVendor ID (1018h, sub 1)
[in]ulProdCodeVProduct code (1018h, sub 2)
[in]ulRevisionNumLowVRevision number (1018h, sub 3)
[in]ulRevisionNumHighVRevision number (1018h, sub 3)
[in]ulSerialNumLowVSerial number (1018h, sub 4)
[in]ulSerialNumHighVSerial number (1018h, sub 4)
Returns
Value of enumeration ComErr_e

This function starts the Identify remote slave protocol. The boundaries are included in the interval. All LSS slave devices with matching vendor-ID and product-code and whose major revision-number and serial-numbers are located within the given ranges, shall identify themselves with the LSS identify slave service.

◆ ComLssInquiryService()

ComStatus_tv ComLssInquiryService ( uint8_t  ubNetV,
uint8_t  ubServiceV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubServiceVService type (ComLssInqSrv_e)
Returns
Value of enumeration ComErr_e

The inquiry services are available only in configuration mode.

◆ ComLssSetTimeout()

ComStatus_tv ComLssSetTimeout ( uint8_t  ubNetV,
uint16_t  uwTimeV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]uwTimeVTimeout value in milliseconds
Returns
Value of enumeration ComErr_e

This function sets a timeout value for a LSS communication. If the response to a LSS request by the master takes longer than this timeout value, the state of the communication will be changed to eCOM_LSS_STAT_TIMEOUT. The state of the LSS communication can be evaluated by calling ComLssGetStatus(). Please note that the timeout value is a multiple of the timer period (COM_TIMER_PERIOD). A value supplied to this function will be rounded towards the next lower value if necessary.

For LSS Fastscan, the configured timeout value is uwTimeV / 10 in order to increase the speed of # Fastscan algorithm.

◆ ComLssStoreConfiguration()

ComStatus_tv ComLssStoreConfiguration ( uint8_t  ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Value of enumeration ComErr_e

This function is used to store the configured parameters.

◆ ComLssSwitchModeGlobal()

ComStatus_tv ComLssSwitchModeGlobal ( uint8_t  ubNetV,
uint8_t  ubModeV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubModeVLSS mode
Returns
Value of enumeration ComErr_e
See also
ComLssSwitchModeSelective()

The Switch Mode Services control the mode attribute of a LSS Slave. LSS provides three ways to put LSS Slave into configuration mode:

Switch Mode Selective and Fastscan switch exactly one LSS Slave from operation mode to configuration mode. Switch Mode Global switches all LSS Slaves from operation mode to configuration mode and vice versa.

Possible values for the parameter ubModeV are defined by the enumeration ComLssMode_e.

◆ ComLssSwitchModeSelective()

ComStatus_tv ComLssSwitchModeSelective ( uint8_t  ubNetV,
uint32_t  ulVendorIdV,
uint32_t  ulProdCodeV,
uint32_t  ulRevisionNumV,
uint32_t  ulSerialNumV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ulVendorIdVVendor ID (1018h, sub 1)
[in]ulProdCodeVProduct code (1018h, sub 2)
[in]ulRevisionNumVRevision number (1018h, sub 3)
[in]ulSerialNumVSerial number (1018h, sub 4)
Returns
Value of enumeration ComErr_e
See also
ComLssSwitchModeGlobal()

The Switch Mode Services control the mode attribute of a LSS Slave.