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