|
TMC5160 Driver 0.1.0
API reference
|
TMC5160 register map: addresses, access rules, reserved bits and reset values. More...
Go to the source code of this file.
Classes | |
| struct | tmc5160::reg::RegInfo |
| What the driver knows about one register. More... | |
Namespaces | |
| namespace | tmc5160 |
The TMC5160 driver: everything it declares lives here; internals in detail. | |
| namespace | tmc5160::reg |
| The TMC5160 register map. | |
Enumerations | |
| enum class | tmc5160::reg::Access : uint8_t { tmc5160::reg::Access::ReadOnly = 0 , tmc5160::reg::Access::WriteOnly = 1 , tmc5160::reg::Access::ReadWrite = 2 , tmc5160::reg::Access::Clear = 3 , tmc5160::reg::Access::Forbidden = 4 } |
| How the driver may touch an address. More... | |
Functions | |
| constexpr const RegInfo * | tmc5160::reg::FindReadable (uint8_t address) noexcept |
The row that lets the driver read address. | |
| constexpr const RegInfo * | tmc5160::reg::FindWritable (uint8_t address) noexcept |
The row that lets the driver write address. | |
| constexpr uint32_t | tmc5160::reg::ResetValue (uint8_t address) noexcept |
| The reset value of a register. | |
Variables | |
| constexpr uint8_t | tmc5160::reg::kGconf = 0x00 |
| GCONF (RW, 18 bits), page 32. | |
| constexpr uint8_t | tmc5160::reg::kGstat = 0x01 |
| GSTAT (R, write 1 to clear, 3 bits), page 33. | |
| constexpr uint8_t | tmc5160::reg::kIfcnt = 0x02 |
| IFCNT (R, 8 bits): UART write counter, page 33. | |
| constexpr uint8_t | tmc5160::reg::kNodeconf = 0x03 |
| NODECONF (W, 12 bits): UART node, page 34. | |
| constexpr uint8_t | tmc5160::reg::kIoin = 0x04 |
| IOIN (R): input pins and VERSION, page 34. | |
| constexpr uint8_t | tmc5160::reg::kOutput = 0x04 |
| OUTPUT (W, 1 bit): NAO level in UART mode, page 34. | |
| constexpr uint8_t | tmc5160::reg::kXCompare = 0x05 |
| X_COMPARE (W, 32 bits), page 34. | |
| constexpr uint8_t | tmc5160::reg::kOtpProg = 0x06 |
| OTP_PROG (W): never written by the driver. | |
| constexpr uint8_t | tmc5160::reg::kOtpRead = 0x07 |
| OTP_READ (R, 8 bits), page 35. | |
| constexpr uint8_t | tmc5160::reg::kFactoryConf = 0x08 |
| FACTORY_CONF (RW): never written by the driver. | |
| constexpr uint8_t | tmc5160::reg::kShortConf = 0x09 |
| SHORT_CONF (W, 19 bits), page 35. | |
| constexpr uint8_t | tmc5160::reg::kDrvConf = 0x0A |
| DRV_CONF (W, 22 bits), page 35. | |
| constexpr uint8_t | tmc5160::reg::kGlobalScaler = 0x0B |
| GLOBALSCALER (W, 8 bits), page 36. | |
| constexpr uint8_t | tmc5160::reg::kOffsetRead = 0x0C |
| OFFSET_READ (R, 16 bits), page 36. | |
| constexpr uint8_t | tmc5160::reg::kIholdIrun = 0x10 |
| IHOLD_IRUN (W, 20 bits), page 38. | |
| constexpr uint8_t | tmc5160::reg::kTpowerdown = 0x11 |
| TPOWERDOWN (W, 8 bits), page 38. | |
| constexpr uint8_t | tmc5160::reg::kTstep = 0x12 |
| TSTEP (R, 20 bits), page 38. | |
| constexpr uint8_t | tmc5160::reg::kTpwmthrs = 0x13 |
| TPWMTHRS (W, 20 bits), page 39. | |
| constexpr uint8_t | tmc5160::reg::kTcoolthrs = 0x14 |
| TCOOLTHRS (W, 20 bits), page 39. | |
| constexpr uint8_t | tmc5160::reg::kThigh = 0x15 |
| THIGH (W, 20 bits), page 39. | |
| constexpr uint8_t | tmc5160::reg::kRampmode = 0x20 |
| RAMPMODE (RW, 2 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kXactual = 0x21 |
| XACTUAL (RW, 32 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kVactual = 0x22 |
| VACTUAL (R, 24 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kVstart = 0x23 |
| VSTART (W, 18 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kA1 = 0x24 |
| A1 (W, 16 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kV1 = 0x25 |
| V1 (W, 20 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kAmax = 0x26 |
| AMAX (W, 16 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kVmax = 0x27 |
| VMAX (W, 23 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kDmax = 0x28 |
| DMAX (W, 16 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kD1 = 0x2A |
| D1 (W, 16 bits), page 40. | |
| constexpr uint8_t | tmc5160::reg::kVstop = 0x2B |
| VSTOP (W, 18 bits), page 41. | |
| constexpr uint8_t | tmc5160::reg::kTzerowait = 0x2C |
| TZEROWAIT (W, 16 bits), page 41. | |
| constexpr uint8_t | tmc5160::reg::kXtarget = 0x2D |
| XTARGET (RW, 32 bits), page 41. | |
| constexpr uint8_t | tmc5160::reg::kVdcmin = 0x33 |
| VDCMIN (W, 23 bits), page 42. | |
| constexpr uint8_t | tmc5160::reg::kSwMode = 0x34 |
| SW_MODE (RW, 12 bits), page 42. | |
| constexpr uint8_t | tmc5160::reg::kRampStat = 0x35 |
| RAMP_STAT (R, write 1 to clear some, 14 bits). | |
| constexpr uint8_t | tmc5160::reg::kXlatch = 0x36 |
| XLATCH (R, 32 bits), page 42. | |
| constexpr uint8_t | tmc5160::reg::kEncmode = 0x38 |
| ENCMODE (RW, 11 bits), page 45. | |
| constexpr uint8_t | tmc5160::reg::kXEnc = 0x39 |
| X_ENC (RW, 32 bits), page 45. | |
| constexpr uint8_t | tmc5160::reg::kEncConst = 0x3A |
| ENC_CONST (W, 32 bits), page 45. | |
| constexpr uint8_t | tmc5160::reg::kEncStatus = 0x3B |
| ENC_STATUS (R, write 1 to clear, 2 bits). | |
| constexpr uint8_t | tmc5160::reg::kEncLatch = 0x3C |
| ENC_LATCH (R, 32 bits), page 45. | |
| constexpr uint8_t | tmc5160::reg::kEncDeviation = 0x3D |
| ENC_DEVIATION (W, 20 bits), page 45. | |
| constexpr uint8_t | tmc5160::reg::kMslut0 = 0x60 |
| MSLUT[0] (W); MSLUT[n] is at kMslut0 + n, n < 8. | |
| constexpr uint8_t | tmc5160::reg::kMslutsel = 0x68 |
| MSLUTSEL (W, 32 bits), page 47. | |
| constexpr uint8_t | tmc5160::reg::kMslutstart = 0x69 |
| MSLUTSTART (W, 24 bits), page 47. | |
| constexpr uint8_t | tmc5160::reg::kMscnt = 0x6A |
| MSCNT (R, 10 bits), page 47. | |
| constexpr uint8_t | tmc5160::reg::kMscuract = 0x6B |
| MSCURACT (R, 25 bits), page 47. | |
| constexpr uint8_t | tmc5160::reg::kChopconf = 0x6C |
| CHOPCONF (RW, 32 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kCoolconf = 0x6D |
| COOLCONF (W, 25 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kDcctrl = 0x6E |
| DCCTRL (W, 24 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kDrvStatus = 0x6F |
| DRV_STATUS (R, 32 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kPwmconf = 0x70 |
| PWMCONF (W, 32 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kPwmScale = 0x71 |
| PWM_SCALE (R, 17 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kPwmAuto = 0x72 |
| PWM_AUTO (R, 16 bits), page 48. | |
| constexpr uint8_t | tmc5160::reg::kLostSteps = 0x73 |
| LOST_STEPS (R, 20 bits), page 49. | |
| constexpr uint8_t | tmc5160::reg::kLastRegister = 0x73 |
| Highest implemented address. | |
| constexpr uint8_t | tmc5160::reg::kWriteFlag = 0x80 |
| Write flag of the first byte of an SPI datagram (section 4.1, page 23). | |
| constexpr std::array< uint32_t, 8 > | tmc5160::reg::kDefaultMslut |
| Default sine table words, MSLUT[0] to MSLUT[7] (page 106). | |
| constexpr uint32_t | tmc5160::reg::kDefaultMslutsel = 0xFFFF8056U |
| Reset value of MSLUTSEL (page 47). | |
| constexpr uint32_t | tmc5160::reg::kDefaultMslutstart = 0x00F70000U |
| Reset value of MSLUTSTART: START_SIN 0, START_SIN90 247 (page 47). | |
| constexpr uint32_t | tmc5160::reg::kChopconfReset = 0x10410150U |
| Reset value of CHOPCONF (page 48). | |
| constexpr uint32_t | tmc5160::reg::kPwmconfReset = 0xC40C001EU |
| Reset value of PWMCONF (page 48). | |
| constexpr uint32_t | tmc5160::reg::kEncConstReset = 0x00010000U |
| Reset value of ENC_CONST, 1.0 in 16.16 (page 45). | |
| constexpr uint32_t | tmc5160::reg::kVersion = 0x30U |
| The chip version IOIN reports in bits 31 to 24 (page 34). | |
| constexpr std::array< RegInfo, 63 > | tmc5160::reg::kTable |
| The table: one row per address and direction, in address order. | |
GCONF bits (page 32) | |
| constexpr uint32_t | tmc5160::reg::kGconfRecalibrate = 1U << 0 |
| Recalibrate zero crossing. | |
| constexpr uint32_t | tmc5160::reg::kGconfFastStandstill = 1U << 1 |
| Standstill after 2^18 clocks. | |
| constexpr uint32_t | tmc5160::reg::kGconfEnPwmMode = 1U << 2 |
| StealthChop enable. | |
| constexpr uint32_t | tmc5160::reg::kGconfMultistepFilt = 1U << 3 |
| Step pulse filtering. | |
| constexpr uint32_t | tmc5160::reg::kGconfShaft = 1U << 4 |
| Invert direction. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag0Error = 1U << 5 |
| DIAG0 on driver error. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag0Otpw = 1U << 6 |
| DIAG0 on pre-warning. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag0Stall = 1U << 7 |
| DIAG0 on stall (or STEP output). | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag1Stall = 1U << 8 |
| DIAG1 on stall (or DIR output). | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag1Index = 1U << 9 |
| DIAG1 on microstep index 0. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag1OnState = 1U << 10 |
| DIAG1 on chopper on-state. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag1StepsSkipped = 1U << 11 |
| DIAG1 toggles on skipped steps. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag0PushPull = 1U << 12 |
| DIAG0 push-pull. | |
| constexpr uint32_t | tmc5160::reg::kGconfDiag1PushPull = 1U << 13 |
| DIAG1 push-pull. | |
| constexpr uint32_t | tmc5160::reg::kGconfSmallHysteresis = 1U << 14 |
| 1/32 hysteresis. | |
| constexpr uint32_t | tmc5160::reg::kGconfStopEnable = 1U << 15 |
| ENCA_DCIN stops the sequencer. | |
| constexpr uint32_t | tmc5160::reg::kGconfDirectMode = 1U << 16 |
| Coil currents from XTARGET. | |
| constexpr uint32_t | tmc5160::reg::kGconfTestMode = 1U << 17 |
| Test mode: never set. | |
GSTAT bits (page 33) | |
| constexpr uint32_t | tmc5160::reg::kGstatReset = 1U << 0 |
| The chip was reset. | |
| constexpr uint32_t | tmc5160::reg::kGstatDrvErr = 1U << 1 |
| The driver shut down. | |
| constexpr uint32_t | tmc5160::reg::kGstatUvCp = 1U << 2 |
| Charge pump undervoltage. | |
IOIN bits (page 34) | |
| constexpr uint32_t | tmc5160::reg::kIoinSdMode = 1U << 6 |
| Level of the SD_MODE strap. | |
SW_MODE bits (page 43) | |
| constexpr uint32_t | tmc5160::reg::kSwStopLeft = 1U << 0 |
| Stop at the left switch. | |
| constexpr uint32_t | tmc5160::reg::kSwStopRight = 1U << 1 |
| Stop at the right switch. | |
| constexpr uint32_t | tmc5160::reg::kSwPolLeft = 1U << 2 |
| Left switch active low. | |
| constexpr uint32_t | tmc5160::reg::kSwPolRight = 1U << 3 |
| Right switch active low. | |
| constexpr uint32_t | tmc5160::reg::kSwSwap = 1U << 4 |
| Swap left and right. | |
| constexpr uint32_t | tmc5160::reg::kSwLatchLeftActive = 1U << 5 |
| Latch on active left edge. | |
| constexpr uint32_t | tmc5160::reg::kSwLatchLeftInactive = 1U << 6 |
| Latch on inactive left edge. | |
| constexpr uint32_t | tmc5160::reg::kSwLatchRightActive = 1U << 7 |
| Latch on active right edge. | |
| constexpr uint32_t | tmc5160::reg::kSwLatchRightInactive = 1U << 8 |
| Latch on inactive right edge. | |
| constexpr uint32_t | tmc5160::reg::kSwLatchEncoder = 1U << 9 |
| Latch X_ENC too. | |
| constexpr uint32_t | tmc5160::reg::kSwStopStall = 1U << 10 |
| Stop on stall (sg_stop). | |
| constexpr uint32_t | tmc5160::reg::kSwSoftStop = 1U << 11 |
| Soft stop (en_softstop). | |
RAMP_STAT bits (page 44) | |
| constexpr uint32_t | tmc5160::reg::kRampStopLeftActive = 1U << 0 |
| Left switch active. | |
| constexpr uint32_t | tmc5160::reg::kRampStopRightActive = 1U << 1 |
| Right switch active. | |
| constexpr uint32_t | tmc5160::reg::kRampLatchLeft = 1U << 2 |
| Left latch ready (write 1 clears). | |
| constexpr uint32_t | tmc5160::reg::kRampLatchRight = 1U << 3 |
| Right latch ready (write 1 clears). | |
| constexpr uint32_t | tmc5160::reg::kRampEventStopLeft = 1U << 4 |
| Left stop event. | |
| constexpr uint32_t | tmc5160::reg::kRampEventStopRight = 1U << 5 |
| Right stop event. | |
| constexpr uint32_t | tmc5160::reg::kRampEventStopStall = 1U << 6 |
| Stall stop event (write 1 clears). | |
| constexpr uint32_t | tmc5160::reg::kRampEventPosReached |
| Target reached event (write 1 clears). | |
| constexpr uint32_t | tmc5160::reg::kRampVelocityReached = 1U << 8 |
| VACTUAL equals VMAX. | |
| constexpr uint32_t | tmc5160::reg::kRampPositionReached = 1U << 9 |
| XACTUAL equals XTARGET. | |
| constexpr uint32_t | tmc5160::reg::kRampVzero = 1U << 10 |
| VACTUAL is 0. | |
| constexpr uint32_t | tmc5160::reg::kRampZeroWaitActive = 1U << 11 |
| TZEROWAIT is running. | |
| constexpr uint32_t | tmc5160::reg::kRampSecondMove = 1U << 12 |
| Ramp reversed (write 1 clears). | |
| constexpr uint32_t | tmc5160::reg::kRampStatusSg = 1U << 13 |
| Stall input active. | |
DRV_STATUS bits (page 56) | |
| constexpr uint32_t | tmc5160::reg::kDrvS2vsA = 1U << 12 |
| Short to supply, phase A. | |
| constexpr uint32_t | tmc5160::reg::kDrvS2vsB = 1U << 13 |
| Short to supply, phase B. | |
| constexpr uint32_t | tmc5160::reg::kDrvStealth = 1U << 14 |
| StealthChop active. | |
| constexpr uint32_t | tmc5160::reg::kDrvFsActive = 1U << 15 |
| Full-step active. | |
| constexpr uint32_t | tmc5160::reg::kDrvStallGuard = 1U << 24 |
| Stall detected. | |
| constexpr uint32_t | tmc5160::reg::kDrvOt = 1U << 25 |
| Overtemperature shutdown. | |
| constexpr uint32_t | tmc5160::reg::kDrvOtpw = 1U << 26 |
| Overtemperature pre-warning. | |
| constexpr uint32_t | tmc5160::reg::kDrvS2gA = 1U << 27 |
| Short to ground, phase A. | |
| constexpr uint32_t | tmc5160::reg::kDrvS2gB = 1U << 28 |
| Short to ground, phase B. | |
| constexpr uint32_t | tmc5160::reg::kDrvOlA = 1U << 29 |
| Open load, phase A. | |
| constexpr uint32_t | tmc5160::reg::kDrvOlB = 1U << 30 |
| Open load, phase B. | |
| constexpr uint32_t | tmc5160::reg::kDrvStst = 1U << 31 |
| Standstill. | |
TMC5160 register map: addresses, access rules, reserved bits and reset values.
Datasheet chapter 6 (Rev. 1.18), pages 31 to 56. Addresses are seven bits. Most registers are write-only (the datasheet marks them W, section 1.3 page 7 asks the master to keep a shadow), so the table below records, for every address, whether the chip lets the driver read it, whether the driver may write it, the bits that exist (every other bit is written as 0) and the bits that clear on a write of 1. The driver refuses a read of a write-only address and a write of a read-only one.