|
| enum class | tmc9660::Error : uint8_t {
tmc9660::Error::Ok = 0
, tmc9660::Error::NotInitialized = 1
, tmc9660::Error::InvalidArgument = 2
, tmc9660::Error::Bus = 3
,
tmc9660::Error::Timeout = 4
, tmc9660::Error::DeviceIdMismatch
, tmc9660::Error::Crc = 6
, tmc9660::Error::Busy = 7
,
tmc9660::Error::DeviceFault = 8
, tmc9660::Error::Unsupported = 9
, tmc9660::Error::UnexpectedReset
, tmc9660::Error::Nack = 17
,
tmc9660::Error::WrongMode = 18
, tmc9660::Error::Refused = 19
, tmc9660::Error::VerifyFailed = 20
, tmc9660::Error::BadReply = 21
} |
| | Why a call failed. Every call of the driver returns one of these in its Result. More...
|
| |
| enum class | tmc9660::LogLevel : uint8_t { tmc9660::LogLevel::Error = 0
, tmc9660::LogLevel::Warning
, tmc9660::LogLevel::Info
, tmc9660::LogLevel::Debug
} |
| | Severity passed to the optional Log() hook. More...
|
| |
| enum class | tmc9660::BusStatus : uint8_t { tmc9660::BusStatus::Ok = 0
, tmc9660::BusStatus::Fault
, tmc9660::BusStatus::Timeout
} |
| | What a UART port reports for one exchange. More...
|
| |
| enum class | tmc9660::CtrlPin : uint8_t { tmc9660::CtrlPin::Reset = 0
, tmc9660::CtrlPin::DrvEn
, tmc9660::CtrlPin::Wake
, tmc9660::CtrlPin::Faultn
} |
| | The control pins of the chip that the optional GpioSet() and GpioGet() hooks may drive. More...
|
| |
| enum class | tmc9660::GpioSignal : uint8_t { tmc9660::GpioSignal::INACTIVE = 0
, tmc9660::GpioSignal::ACTIVE = 1
} |
| | Logical level of a control pin; the port maps it to the physical polarity. More...
|
| |
| enum class | tmc9660::Mode : uint8_t { tmc9660::Mode::Bootloader = 0
, tmc9660::Mode::Parameter = 1
, tmc9660::Mode::Register = 2
} |
| | The protocol the chip speaks on its host interface. More...
|
| |
| enum class | tmc9660::BootMode : uint8_t { tmc9660::BootMode::Reserved
, tmc9660::BootMode::Register = 1
, tmc9660::BootMode::Parameter = 2
, tmc9660::BootMode::Reserved3 = 3
} |
| | BOOT_MODE of the boot configuration (offset 8, bits 0-1). More...
|
| |
| enum class | tmc9660::Bank : uint8_t { tmc9660::Bank::SpiFlash = 1
, tmc9660::Bank::I2cEeprom = 2
, tmc9660::Bank::Otp = 3
, tmc9660::Bank::Config = 5
} |
| | External memory banks of the bootloader (SET_BANK). More...
|
| |
| enum class | tmc9660::BlInfo : uint8_t {
tmc9660::BlInfo::ChipType = 0
, tmc9660::BlInfo::BlVersion = 1
, tmc9660::BlInfo::Features = 2
, tmc9660::BlInfo::GitInfo = 12
,
tmc9660::BlInfo::ChipVersion = 13
, tmc9660::BlInfo::ChipFrequency = 14
, tmc9660::BlInfo::ConfigMemStart = 17
, tmc9660::BlInfo::ConfigMemSize = 18
,
tmc9660::BlInfo::OtpMemSize = 19
, tmc9660::BlInfo::I2cMemSize = 20
, tmc9660::BlInfo::SpiMemSize = 21
, tmc9660::BlInfo::PartitionVersion = 22
,
tmc9660::BlInfo::SpiMemPartitions = 25
, tmc9660::BlInfo::I2cMemPartitions = 26
, tmc9660::BlInfo::ChipVariant = 28
} |
| | GET_INFO selectors of the bootloader. More...
|
| |
| enum class | tmc9660::BlStatus : uint8_t {
tmc9660::BlStatus::Ok = 0
, tmc9660::BlStatus::CmdNotFound = 1
, tmc9660::BlStatus::InvalidAddr = 3
, tmc9660::BlStatus::InvalidValue = 4
,
tmc9660::BlStatus::InvalidBank = 14
, tmc9660::BlStatus::Busy = 15
, tmc9660::BlStatus::MemUnconfigured = 17
, tmc9660::BlStatus::OtpError = 18
,
tmc9660::BlStatus::SessionStart = 19
, tmc9660::BlStatus::CmdNotAvailable = 20
, tmc9660::BlStatus::BootloaderResumed = 21
} |
| | Bootloader reply status codes (datasheet bootloader chapter). More...
|
| |
| enum class | tmc9660::BlCmd : uint8_t {
tmc9660::BlCmd::GetInfo = 0
, tmc9660::BlCmd::GetBank = 8
, tmc9660::BlCmd::SetBank = 9
, tmc9660::BlCmd::GetAddress = 10
,
tmc9660::BlCmd::SetAddress = 11
, tmc9660::BlCmd::Read32 = 12
, tmc9660::BlCmd::Read32Inc = 13
, tmc9660::BlCmd::Read16 = 14
,
tmc9660::BlCmd::Read16Inc = 15
, tmc9660::BlCmd::Read8 = 16
, tmc9660::BlCmd::Read8Inc = 17
, tmc9660::BlCmd::Write32 = 18
,
tmc9660::BlCmd::Write32Inc = 19
, tmc9660::BlCmd::Write16 = 20
, tmc9660::BlCmd::Write16Inc = 21
, tmc9660::BlCmd::Write8 = 22
,
tmc9660::BlCmd::Write8Inc = 23
, tmc9660::BlCmd::NoOp = 29
, tmc9660::BlCmd::OtpLoad = 30
, tmc9660::BlCmd::OtpBurn = 31
,
tmc9660::BlCmd::MemIsConfigured = 32
, tmc9660::BlCmd::MemIsConnected = 33
, tmc9660::BlCmd::FlashSendCmd = 36
, tmc9660::BlCmd::FlashEraseSector = 37
,
tmc9660::BlCmd::MemIsBusy = 40
, tmc9660::BlCmd::BootstrapRs485 = 255
} |
| | Bootloader command codes. More...
|
| |
| enum class | tmc9660::Tmcl : uint8_t {
tmc9660::Tmcl::Mst = 3
, tmc9660::Tmcl::Sap = 5
, tmc9660::Tmcl::Gap = 6
, tmc9660::Tmcl::Stap = 7
,
tmc9660::Tmcl::Sgp = 9
, tmc9660::Tmcl::Ggp = 10
, tmc9660::Tmcl::Rfs = 13
, tmc9660::Tmcl::Sio = 14
,
tmc9660::Tmcl::Gio = 15
, tmc9660::Tmcl::Calc = 19
, tmc9660::Tmcl::Comp = 20
, tmc9660::Tmcl::Jc = 21
,
tmc9660::Tmcl::Ja = 22
, tmc9660::Tmcl::Csub = 23
, tmc9660::Tmcl::Rsub = 24
, tmc9660::Tmcl::Ei = 25
,
tmc9660::Tmcl::Di = 26
, tmc9660::Tmcl::Wait = 27
, tmc9660::Tmcl::Stop = 28
, tmc9660::Tmcl::Calcx = 33
,
tmc9660::Tmcl::Aap = 34
, tmc9660::Tmcl::Agp = 35
, tmc9660::Tmcl::Cle = 36
, tmc9660::Tmcl::Vect = 37
,
tmc9660::Tmcl::Reti = 38
, tmc9660::Tmcl::Calcvv = 40
, tmc9660::Tmcl::Calcva = 41
, tmc9660::Tmcl::Calcav = 42
,
tmc9660::Tmcl::Calcvx = 43
, tmc9660::Tmcl::Calcxv = 44
, tmc9660::Tmcl::Calcv = 45
, tmc9660::Tmcl::Rst = 48
,
tmc9660::Tmcl::Djnz = 49
, tmc9660::Tmcl::Siv = 55
, tmc9660::Tmcl::Giv = 56
, tmc9660::Tmcl::Aiv = 57
,
tmc9660::Tmcl::ApplStop = 128
, tmc9660::Tmcl::ApplRun = 129
, tmc9660::Tmcl::ApplStep = 130
, tmc9660::Tmcl::ApplReset = 131
,
tmc9660::Tmcl::DownloadStart = 132
, tmc9660::Tmcl::DownloadEnd = 133
, tmc9660::Tmcl::ReadMem = 134
, tmc9660::Tmcl::GetStatus = 135
,
tmc9660::Tmcl::GetVersion = 136
, tmc9660::Tmcl::FactoryDefault = 137
, tmc9660::Tmcl::Breakpoint = 141
, tmc9660::Tmcl::RamDebug = 142
,
tmc9660::Tmcl::GetInfo = 157
, tmc9660::Tmcl::Boot = 242
} |
| | TMCL operation codes (Table 18 of the parameter mode manual). More...
|
| |
| enum class | tmc9660::TmclStatus : uint8_t {
tmc9660::TmclStatus::Ok = 100
, tmc9660::TmclStatus::CmdLoaded = 101
, tmc9660::TmclStatus::ChecksumError = 1
, tmc9660::TmclStatus::InvalidCommand = 2
,
tmc9660::TmclStatus::WrongType = 3
, tmc9660::TmclStatus::InvalidValue = 4
, tmc9660::TmclStatus::CmdNotAvailable = 6
, tmc9660::TmclStatus::CmdLoadError = 7
,
tmc9660::TmclStatus::MaxExceeded = 9
, tmc9660::TmclStatus::DownloadNotPossible = 10
} |
| | TMCL reply status codes (Table 19). More...
|
| |
| enum class | tmc9660::TmclSpiStatus : uint8_t { tmc9660::TmclSpiStatus::Ok = 0xFF
, tmc9660::TmclSpiStatus::ChecksumError = 0x00
, tmc9660::TmclSpiStatus::FirstCommand = 0x0C
, tmc9660::TmclSpiStatus::NotReady = 0xF0
} |
| | SPI status byte of a TMCL reply. More...
|
| |
| enum class | tmc9660::RamDebugType : uint8_t {
tmc9660::RamDebugType::Init = 0
, tmc9660::RamDebugType::SampleCount = 1
, tmc9660::RamDebugType::Prescaler = 3
, tmc9660::RamDebugType::SetChannel = 4
,
tmc9660::RamDebugType::SetTriggerChannel = 5
, tmc9660::RamDebugType::TriggerMaskShift = 6
, tmc9660::RamDebugType::EnableTrigger = 7
, tmc9660::RamDebugType::GetState = 8
,
tmc9660::RamDebugType::ReadSample = 9
, tmc9660::RamDebugType::GetInfo = 10
, tmc9660::RamDebugType::GetChannelType = 11
, tmc9660::RamDebugType::GetChannelAddress = 12
,
tmc9660::RamDebugType::SetPretrigger = 13
, tmc9660::RamDebugType::GetPretrigger = 14
} |
| | RAMDebug types (Table 16). More...
|
| |
| enum class | tmc9660::ReferenceSearch : uint8_t { tmc9660::ReferenceSearch::Start = 0
, tmc9660::ReferenceSearch::Stop = 1
, tmc9660::ReferenceSearch::Status = 2
} |
| | RFS sub-commands. More...
|
| |
| enum class | tmc9660::TmclLayout : uint8_t { tmc9660::TmclLayout::Auto = 0
, tmc9660::TmclLayout::MotorHigh
, tmc9660::TmclLayout::TypeHigh
} |
| | Where the type and the motor or bank bytes of a TMCL frame put their bits (ambiguity A2). More...
|
| |
|
|
constexpr int32_t | tmc9660::kSystemOff = 0 |
| | Value of COMMUTATION_MODE (parameter 4) that leaves the gate driver off.
|
| |
|
constexpr int32_t | tmc9660::kCommutationModeMax = 8 |
| | The largest valid COMMUTATION_MODE value.
|
| |
|
constexpr uint32_t | tmc9660::kChipId = 0x544D0001U |
| | The chip ID every TMC9660 reports (bootloader CHIP_TYPE, register MCC_INFO_CHIP).
|
| |
|
constexpr uint32_t | tmc9660::kMotorControlClockHz = 40'000'000U |
| | The system clock motor control needs, in Hz.
|
| |
|
constexpr uint32_t | tmc9660::kBootMagic = 0xA3B4C5D6U |
| | The magic value of the Boot command.
|
| |
Errors, results, protocol enumerations and configuration.
Where the type and the motor or bank bytes of a TMCL frame put their bits (ambiguity A2).
The parameter manual numbers the UART bits least significant bit first (the sync bit is bit 0): type bits 16 to 27, motor or bank bits 28 to 31, so the fourth byte reads motor << 4 | type[11:8] (MotorHigh). A vendor example is reported to pack it the other way (TypeHigh). The SPI table (Table 3) numbers its bits most significant bit first, which read literally gives a third layout (type[11:4] in byte 1). It is not offered: a chip that uses it decodes the probe frames as types that do not exist (299 reads as 0x2B0), answers an error to both probes, and the driver refuses to start (fail closed, nothing written); supporting it needs a code change (bench item A2). The documents are not settled and nothing has run on a chip, so the driver never trusts a layout: at the start of parameter mode it probes the layouts with two read-only commands and starts only when exactly the configured one (or, for Auto, exactly one of the two) is answered. A wrong layout would put a protection parameter (256 to 288) on the wire as another parameter, for example 260 as COMMUTATION_MODE.
| Enumerator |
|---|
| Auto | Probe both layouts; start only when exactly one answers.
|
| MotorHigh | Byte 3 (SPI byte 2): motor << 4 | type[11:8]; the byte before holds type[7:0].
|
| TypeHigh | Byte 3 (SPI byte 2): type[11:8] << 4 | motor; the byte before holds type[7:0].
|