LSS
CANopen_305

## Files

file | CO_LSS.h
| CANopen Layer Setting Services protocol (common).
file | CO_LSSmaster.h
| CANopen Layer Setting Service - master protocol.
file | CO_LSSslave.h
| CANopen Layer Setting Service - slave protocol.

## Data Structures

union | CO_LSS_address_t
| The LSS address is a 128 bit number, uniquely identifying each node. More...

## Macros

#define | CO_LSS_BIT_TIMING_VALID(index) (index != 5 && (index >= CO_LSS_BIT_TIMING_1000 && index <= CO_LSS_BIT_TIMING_AUTO))
| Macro to check if index contains valid bit timing.
#define | CO_LSS_NODE_ID_ASSIGNMENT 0xFFU
| Invalid node ID triggers node ID assignment.
#define | CO_LSS_NODE_ID_VALID(nid) ((nid >= 1 && nid <= 0x7F) || nid == CO_LSS_NODE_ID_ASSIGNMENT)
| Macro to check if node id is valid.
#define | CO_LSS_ADDRESS_EQUAL(a1, a2)
| Macro to check if two LSS addresses are equal.

## Enumerations

enum

CO_LSS_cs_t {
CO_LSS_SWITCH_STATE_GLOBAL = 0x04U, CO_LSS_SWITCH_STATE_SEL_VENDOR = 0x40U, CO_LSS_SWITCH_STATE_SEL_PRODUCT = 0x41U, CO_LSS_SWITCH_STATE_SEL_REV = 0x42U,
CO_LSS_SWITCH_STATE_SEL_SERIAL = 0x43U, CO_LSS_SWITCH_STATE_SEL = 0x44U, CO_LSS_CFG_NODE_ID = 0x11U, CO_LSS_CFG_BIT_TIMING = 0x13U,
CO_LSS_CFG_ACTIVATE_BIT_TIMING = 0x15U, CO_LSS_CFG_STORE = 0x17U, CO_LSS_IDENT_SLAVE = 0x4FU, CO_LSS_IDENT_FASTSCAN = 0x51U,
CO_LSS_INQUIRE_VENDOR = 0x5AU, CO_LSS_INQUIRE_PRODUCT = 0x5BU, CO_LSS_INQUIRE_REV = 0x5CU, CO_LSS_INQUIRE_SERIAL = 0x5DU,
CO_LSS_INQUIRE_NODE_ID = 0x5EU
}

| LSS protocol command specifiers. More...
enum | CO_LSS_cfgNodeId_t { CO_LSS_CFG_NODE_ID_OK = 0x00U, CO_LSS_CFG_NODE_ID_OUT_OF_RANGE = 0x01U, CO_LSS_CFG_NODE_ID_MANUFACTURER = 0xFFU }
| Error codes for Configure node ID protocol. More...
enum | CO_LSS_cfgBitTiming_t { CO_LSS_CFG_BIT_TIMING_OK = 0x00U, CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE = 0x01U, CO_LSS_CFG_BIT_TIMING_MANUFACTURER = 0xFFU }
| Error codes for Configure bit timing parameters protocol. More...
enum | CO_LSS_cfgStore_t { CO_LSS_CFG_STORE_OK = 0x00U, CO_LSS_CFG_STORE_NOT_SUPPORTED = 0x01U, CO_LSS_CFG_STORE_FAILED = 0x02U, CO_LSS_CFG_STORE_MANUFACTURER = 0xFFU }
| Error codes for Store configuration protocol. More...
enum | CO_LSS_fastscan_bitcheck { CO_LSS_FASTSCAN_BIT0 = 0x00U, CO_LSS_FASTSCAN_BIT31 = 0x1FU, CO_LSS_FASTSCAN_CONFIRM = 0x80U }
| Fastscan BitCheck. More...
enum | CO_LSS_fastscan_lss_sub_next { CO_LSS_FASTSCAN_VENDOR_ID = 0, CO_LSS_FASTSCAN_PRODUCT = 1, CO_LSS_FASTSCAN_REV = 2, CO_LSS_FASTSCAN_SERIAL = 3 }
| Fastscan LSSsub, LSSnext. More...
enum | CO_LSS_state_t { CO_LSS_STATE_WAITING = 0, CO_LSS_STATE_CONFIGURATION = 1 }
| LSS finite state automaton. More...
enum | CO_LSS_bitTimingTable_t { CO_LSS_BIT_TIMING_1000 = 0, CO_LSS_BIT_TIMING_800 = 1, CO_LSS_BIT_TIMING_500 = 2, CO_LSS_BIT_TIMING_250 = 3, CO_LSS_BIT_TIMING_125 = 4, CO_LSS_BIT_TIMING_50 = 6, CO_LSS_BIT_TIMING_20 = 7, CO_LSS_BIT_TIMING_10 = 8, CO_LSS_BIT_TIMING_AUTO = 9 }
| Definition of table_index for /CiA301/ bit timing table. More...

## Variables

static const uint16_t | CO_LSS_bitTimingTableLookup []
| Lookup table for conversion between bit timing table and numerical bit rate.

## Detailed Description

CANopen Layer Setting Services protocol (common).

LSS protocol is according to CiA DSP 305 V3.0.0.

LSS services and protocols are used to inquire or to change the settings of three parameters of the physical layer, data link layer, and application layer on a CANopen device with LSS slave capability by a CANopen device with LSS master capability via the CAN network.

The following parameters may be inquired or changed:

- Node-ID of the CANopen device
- Bit timing parameters of the physical layer (bit rate)
- LSS address compliant to the identity object (1018h)

The connection is established in one of two ways:

- addressing a node by it's 128 bit LSS address. This requires that the master already knows the node's LSS address.
- scanning the network for unknown nodes (Fastscan). Using this method, unknown devices can be found and configured one by one.

Be aware that changing the bit rate is a critical step for the network. A failure will render the network unusable!

Using this implementation, only master or slave can be included in one node at a time.

For CAN identifiers see CO_Default_CAN_ID_t

## Enumeration Type Documentation

## CO_LSS_cs_t

enum CO_LSS_cs_t

LSS protocol command specifiers.

The LSS protocols are executed between the LSS master device and the LSS slave device(s) to implement the LSS services. Some LSS protocols require a sequence of CAN messages.

As identifying method only "LSS fastscan" is supported.

Enumerator
CO_LSS_SWITCH_STATE_GLOBAL | Switch state global protocol.
CO_LSS_SWITCH_STATE_SEL_VENDOR | Switch state selective protocol - Vendor ID.
CO_LSS_SWITCH_STATE_SEL_PRODUCT | Switch state selective protocol - Product code.
CO_LSS_SWITCH_STATE_SEL_REV | Switch state selective protocol - Revision number.
CO_LSS_SWITCH_STATE_SEL_SERIAL | Switch state selective protocol - Serial number.
CO_LSS_SWITCH_STATE_SEL | Switch state selective protocol - Slave response.
CO_LSS_CFG_NODE_ID | Configure node ID protocol.
CO_LSS_CFG_BIT_TIMING | Configure bit timing parameter protocol.
CO_LSS_CFG_ACTIVATE_BIT_TIMING | Activate bit timing parameter protocol.
CO_LSS_CFG_STORE | Store configuration protocol.
CO_LSS_IDENT_SLAVE | LSS Fastscan response.
CO_LSS_IDENT_FASTSCAN | LSS Fastscan protocol.
CO_LSS_INQUIRE_VENDOR | Inquire identity vendor-ID protocol.
CO_LSS_INQUIRE_PRODUCT | Inquire identity product-code protocol.
CO_LSS_INQUIRE_REV | Inquire identity revision-number protocol.
CO_LSS_INQUIRE_SERIAL | Inquire identity serial-number protocol.
CO_LSS_INQUIRE_NODE_ID | Inquire node-ID protocol.

## CO_LSS_cfgNodeId_t

enum CO_LSS_cfgNodeId_t

Error codes for Configure node ID protocol.

Enumerator
CO_LSS_CFG_NODE_ID_OK | Protocol successfully completed.
CO_LSS_CFG_NODE_ID_OUT_OF_RANGE | NID out of range.
CO_LSS_CFG_NODE_ID_MANUFACTURER | Manufacturer specific error. No further support

## CO_LSS_cfgBitTiming_t

enum CO_LSS_cfgBitTiming_t

Error codes for Configure bit timing parameters protocol.

Enumerator
CO_LSS_CFG_BIT_TIMING_OK | Protocol successfully completed.
CO_LSS_CFG_BIT_TIMING_OUT_OF_RANGE | Bit timing / Bit rate not supported.
CO_LSS_CFG_BIT_TIMING_MANUFACTURER | Manufacturer specific error. No further support

## CO_LSS_cfgStore_t

enum CO_LSS_cfgStore_t

Error codes for Store configuration protocol.

Enumerator
CO_LSS_CFG_STORE_OK | Protocol successfully completed.
CO_LSS_CFG_STORE_NOT_SUPPORTED | Store configuration not supported.
CO_LSS_CFG_STORE_FAILED | Storage media access error.
CO_LSS_CFG_STORE_MANUFACTURER | Manufacturer specific error. No further support

## CO_LSS_fastscan_bitcheck

enum CO_LSS_fastscan_bitcheck

Fastscan BitCheck.

BIT0 means all bits are checked for equality by slave.

Enumerator
CO_LSS_FASTSCAN_BIT0 | Least significant bit of IDnumbners bit area to be checked.
CO_LSS_FASTSCAN_BIT31 | dito
CO_LSS_FASTSCAN_CONFIRM | All LSS slaves waiting for scan respond and previous scan is reset.

## CO_LSS_fastscan_lss_sub_next

enum CO_LSS_fastscan_lss_sub_next

Fastscan LSSsub, LSSnext.

Enumerator
CO_LSS_FASTSCAN_VENDOR_ID | Vendor ID.
CO_LSS_FASTSCAN_PRODUCT | Product code.
CO_LSS_FASTSCAN_REV | Revision number.
CO_LSS_FASTSCAN_SERIAL | Serial number.

## CO_LSS_state_t

enum CO_LSS_state_t

LSS finite state automaton.

The LSS FSA shall provide the following states:

- Initial: Pseudo state, indicating the activation of the FSA.
- LSS waiting: In this state, the LSS slave device waits for requests.
- LSS configuration: In this state variables may be configured in the LSS slave.
- Final: Pseudo state, indicating the deactivation of the FSA.

Enumerator
CO_LSS_STATE_WAITING | LSS FSA waiting for requests.
CO_LSS_STATE_CONFIGURATION | LSS FSA waiting for configuration.

## CO_LSS_bitTimingTable_t

enum CO_LSS_bitTimingTable_t

Definition of table_index for /CiA301/ bit timing table.

Enumerator
CO_LSS_BIT_TIMING_1000 | 1000kbit/s
CO_LSS_BIT_TIMING_800 | 800kbit/s
CO_LSS_BIT_TIMING_500 | 500kbit/s
CO_LSS_BIT_TIMING_250 | 250kbit/s
CO_LSS_BIT_TIMING_125 | 125kbit/s
CO_LSS_BIT_TIMING_50 | 50kbit/s
CO_LSS_BIT_TIMING_20 | 20kbit/s
CO_LSS_BIT_TIMING_10 | 10kbit/s
CO_LSS_BIT_TIMING_AUTO | Automatic bit rate detection.