Motion Master 6.0.0-alpha.111
Next-generation motion control software
Loading...
Searching...
No Matches
mm::comm::spoe Namespace Reference

Classes

struct  ConnectionError
 
struct  Frame
 
struct  FrameHeader
 
struct  ParameterEntry
 One entry of the parameter list. More...
 
class  SpoeConnection
 
class  SpoeFieldbusDriver
 
struct  SpoeFieldbusDriverConfig
 
class  SpoeFrameAssembler
 
class  SpoeInputQueue
 
class  SpoeOutputSlot
 

Enumerations

enum class  PdoMode : uint8_t { kNone = 0x00 , kMonitor = 0x01 , kControl = 0x02 }
 ETHERNET_PDO_MODE_* in the firmware. More...
 
enum class  SpoeMode : uint8_t { kMonitor , kControl }
 
enum class  MessageType : uint8_t {
  kSdoRead = 0x01 , kSdoWrite = 0x02 , kPdoFrame = 0x03 , kPdoControl = 0x04 ,
  kSdoBatchRead = 0x06 , kFirmwareUpdate = 0x0B , kFileRead = 0x0C , kFileWrite = 0x0D ,
  kStateControl = 0x0E , kStateRead = 0x0F , kParamList = 0x10 , kParamDesc = 0x11 ,
  kParamSubDesc = 0x12 , kParamFullDesc = 0x13 , kServerInfo = 0x20 , kDeviceLocate = 0x21 ,
  kWatchdogTimeout = 0x22
}
 The message types the firmware handles. A reply carries the type of its request. More...
 

Functions

std::vector< ParameterEntry > decodeParameterEntries (std::span< const uint8_t > bytes)
 
std::string sdoStatusName (uint16_t status)
 Names an SPoE SDO status, which is one of the firmware's SDO_REQUEST_ERROR_* codes.
 
std::expected< std::vector< uint8_t >, std::string > encodeFrame (const Frame &frame)
 Encodes frame. Fails when the data part is larger than kMaxDataSize.
 
std::optional< FrameHeader > decodeHeader (std::span< const uint8_t > bytes)
 

Variables

constexpr std::size_t kInputQueueLimit = 30
 
constexpr uint16_t kProtocolVersion100 = 0x0100
 
constexpr uint16_t kProtocolVersion102 = 0x0102
 
constexpr std::size_t kParameterEntrySize = 68
 
constexpr std::size_t kHeaderSize = 7
 Message type u8, sequence id u16, status u16, data length u16.
 
constexpr std::size_t kMaxDataSize = 512
 MAX_FRAME_SIZE in the firmware: the size of its buffer for the data part.
 
constexpr std::size_t kInputPopLimit = 500
 pop_from_pdo_fifo_buffer in the firmware returns at most this many bytes of inputs at once.
 

Enumeration Type Documentation

◆ MessageType

enum class mm::comm::spoe::MessageType : uint8_t
strong

The message types the firmware handles. A reply carries the type of its request.

Enumerator
kSdoRead 
kSdoWrite 
kPdoFrame 
kPdoControl 
kSdoBatchRead 
kFirmwareUpdate 
kFileRead 
kFileWrite 
kStateControl 
kStateRead 
kParamList 
kParamDesc 
kParamSubDesc 
kParamFullDesc 
kServerInfo 
kDeviceLocate 
kWatchdogTimeout 

◆ PdoMode

enum class mm::comm::spoe::PdoMode : uint8_t
strong

ETHERNET_PDO_MODE_* in the firmware.

Enumerator
kNone 
kMonitor 
kControl 

◆ SpoeMode

enum class mm::comm::spoe::SpoeMode : uint8_t
strong

Who owns the drive's state. In Monitor mode a PLC or another master owns it, and Motion Master only parametrises and observes. In Control mode Motion Master owns it.

Enumerator
kMonitor 
kControl 

Function Documentation

◆ decodeHeader()

std::optional< FrameHeader > mm::comm::spoe::decodeHeader ( std::span< const uint8_t >  bytes)

Decodes the header at the start of bytes, or nullopt when fewer than kHeaderSize bytes are there.

◆ decodeParameterEntries()

std::vector< ParameterEntry > mm::comm::spoe::decodeParameterEntries ( std::span< const uint8_t >  bytes)

Decodes whole parameter-list entries and ignores a short tail. An entry whose index is zero is skipped, because the firmware clears a description before it fills it, and sends it whether the entry exists or not.

◆ encodeFrame()

std::expected< std::vector< uint8_t >, std::string > mm::comm::spoe::encodeFrame ( const Frame &  frame)

Encodes frame. Fails when the data part is larger than kMaxDataSize.

◆ sdoStatusName()

std::string mm::comm::spoe::sdoStatusName ( uint16_t  status)

Names an SPoE SDO status, which is one of the firmware's SDO_REQUEST_ERROR_* codes.

Variable Documentation

◆ kHeaderSize

constexpr std::size_t mm::comm::spoe::kHeaderSize = 7
constexpr

Message type u8, sequence id u16, status u16, data length u16.

◆ kInputPopLimit

constexpr std::size_t mm::comm::spoe::kInputPopLimit = 500
constexpr

pop_from_pdo_fifo_buffer in the firmware returns at most this many bytes of inputs at once.

◆ kInputQueueLimit

constexpr std::size_t mm::comm::spoe::kInputQueueLimit = 30
constexpr

The most input frames one drive's queue holds for the RT thread. Older frames are dropped, so the inputs never lag the drive by more than this many RT cycles.

◆ kMaxDataSize

constexpr std::size_t mm::comm::spoe::kMaxDataSize = 512
constexpr

MAX_FRAME_SIZE in the firmware: the size of its buffer for the data part.

◆ kParameterEntrySize

constexpr std::size_t mm::comm::spoe::kParameterEntrySize = 68
constexpr

The size of one parameter-list entry, the firmware's struct _sdoinfo_entry_description as it lies in memory. The layout follows the natural alignment of its members, which is not confirmed on hardware.

◆ kProtocolVersion100

constexpr uint16_t mm::comm::spoe::kProtocolVersion100 = 0x0100
constexpr

The SPoE protocol versions this driver speaks. Version 1.0 reports no PDO mode in its server information and has no WATCHDOG_TIMEOUT message, so its Control-mode watchdog is fixed in the firmware.

◆ kProtocolVersion102

constexpr uint16_t mm::comm::spoe::kProtocolVersion102 = 0x0102
constexpr