HF-TMC9660 Driver
Hardware Agnostic C++ Driver for the TMC9660
|
Communication interfaces for TMC9660 Parameter Mode devices using TMCL protocol over SPI and UART. More...
#include <array>
#include <cstdint>
#include <cstdlib>
#include <span>
Go to the source code of this file.
Classes | |
struct | TMCLReply |
Reply structure returned by sendCommand() More... | |
struct | TMCLFrame |
Frame structure for TMCL commands and replies. More... | |
class | TMC9660CommInterface |
SPI status codes as per TMC9660 Parameter Mode. More... | |
class | SPITMC9660CommInterface |
SPI implementation of TMC9660CommInterface. More... | |
class | UARTTMC9660CommInterface |
UART implementation of TMC9660CommInterface. More... | |
Enumerations | |
enum class | CommMode { SPI , UART } |
Supported physical communication modes. More... | |
enum class | SPIStatus : uint8_t { OK = 0xFF , CHECKSUM_ERROR = 0x00 , FIRST_CMD = 0x0C , NOT_READY = 0xF0 } |
SPI status codes as per TMC9660 Parameter Mode. More... | |
Functions | |
static constexpr uint8_t | tmclChecksum (const uint8_t *bytes, size_t n) noexcept |
Calculate 8-bit checksum (sum of bytes) | |
Communication interfaces for TMC9660 Parameter Mode devices using TMCL protocol over SPI and UART.
For parameter read/write access, either UART or SPI may be used. Both interfaces share the same TMCL command structure and follow a strict command/reply order.
Table 3: Command format for parameter read/write access through SPI
BYTE | 0 | 1-2 | 3 | 4-6 | 7 |
---|---|---|---|---|---|
Bits | 0-7 | 8-19 | 20-23 | 24-55 | 56-63 |
Desc | Operation | Type | Motor/Bank | Data | Checksum |
Table 4: Reply format for parameter read/write access through SPI
BYTE | 0 | 1 | 2 | 3-6 | 7 |
---|---|---|---|---|---|
Bits | 0-7 | 8-15 | 16-23 | 24-55 | 56-63 |
Desc | SPI Status | TMCL Status | Operation | Data | Checksum |
BYTE | 0 | 1 | 2-3 | 4 | 5-8 | 9 |
---|---|---|---|---|---|---|
Desc | Sync+Address | Command | Type | Motor/Bank | Data | Checksum |
BYTE | 0 | 1 | 2 | 3 | 4-7 | 8 |
---|---|---|---|---|---|---|
Desc | Host Address | Sync+Address | TMCL Status | Operation | Data | Checksum |
|
strong |
|
strong |
SPI status codes as per TMC9660 Parameter Mode.
Enumerator | |
---|---|
OK | |
CHECKSUM_ERROR | |
FIRST_CMD | |
NOT_READY |
|
staticconstexprnoexcept |
Calculate 8-bit checksum (sum of bytes)