TMC9660 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
tmc9660_bootconfig.hpp File Reference

The bootloader's configuration memory (64 bytes, datasheet "Bootloader Configuration") as a typed BootConfig, and the external-memory partition table builder. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include "tmc9660_detail.hpp"
#include "tmc9660_frames.hpp"
#include "tmc9660_types.hpp"

Go to the source code of this file.

Classes

class  tmc9660::BootConfig
 The 64-byte configuration memory of the bootloader, as 16 little-endian 32-bit words. More...
 
struct  tmc9660::PartitionEntry
 One entry of an external-memory partition table. More...
 

Namespaces

namespace  tmc9660
 The TMC9660 driver: everything it declares lives here; internals in detail.
 

Enumerations

enum class  tmc9660::BootField : uint8_t {
  tmc9660::LdoVext1 = 0 , tmc9660::LdoVext2 , tmc9660::LdoSsVext1 , tmc9660::LdoSsVext2 ,
  tmc9660::LdoShortFault , tmc9660::DeviceAddress , tmc9660::HostAddress , tmc9660::UartTxenPostDelay ,
  tmc9660::UartTxenPreDelay , tmc9660::BlDisableUart , tmc9660::BlDisableSpi , tmc9660::BlSpiSelect ,
  tmc9660::BlUartRx , tmc9660::BlUartTx , tmc9660::BlUartTxen , tmc9660::BlUartBaudrate ,
  tmc9660::BlSpi0Sck , tmc9660::BootMode , tmc9660::BlReadyFault , tmc9660::BlExitFault ,
  tmc9660::DisableSelftest , tmc9660::BlConfigFault , tmc9660::StartMotorCtrl , tmc9660::SpiFlashEn ,
  tmc9660::SpiFlashCs , tmc9660::SpiFlashFreq , tmc9660::I2cEepromEn , tmc9660::I2cEepromSda ,
  tmc9660::I2cEepromScl , tmc9660::I2cEepromAddr , tmc9660::I2cEepromFreq , tmc9660::GpioOut ,
  tmc9660::GpioOutEn , tmc9660::GpioPullUp , tmc9660::GpioPullDown , tmc9660::Gpio16To18Out ,
  tmc9660::Gpio16To18OutEn , tmc9660::Gpio16To18PullDown , tmc9660::Gpio16To18PullUp , tmc9660::GpioAnalog2To5 ,
  tmc9660::ClockReserved1 , tmc9660::ClockExtNotInt , tmc9660::ClockXtalCfg , tmc9660::ClockXtalBoost ,
  tmc9660::ClockExtNotXtal , tmc9660::ClockPllOutSel , tmc9660::ClockRdiv , tmc9660::ClockSysClkDiv ,
  tmc9660::HallEnable , tmc9660::HallU , tmc9660::HallV , tmc9660::HallW ,
  tmc9660::Abn1Enable , tmc9660::Abn1A , tmc9660::Abn1B , tmc9660::Abn1N ,
  tmc9660::RefL , tmc9660::RefR , tmc9660::RefH , tmc9660::StepDirEnable ,
  tmc9660::StepPin , tmc9660::DirPin , tmc9660::Abn2Enable , tmc9660::Abn2A ,
  tmc9660::Abn2B , tmc9660::BrakeChopperEnable , tmc9660::BrakeChopperOutput , tmc9660::MechBrakeEnable ,
  tmc9660::MechBrakeOutput , tmc9660::SpiEncEnable , tmc9660::SpiEncBlock , tmc9660::SpiEncMode ,
  tmc9660::SpiEncFreq , tmc9660::SpiEncCsPin , tmc9660::MemTmclScript , tmc9660::MemParameters
}
 Named fields of the configuration memory. More...
 

Functions

constexpr Result< std::size_t > tmc9660::BuildPartitionTable (std::span< const PartitionEntry > entries, uint8_t size_index, uint8_t sector_index, std::span< uint8_t > out) noexcept
 Build a partition table (datasheet Tables 21 and 22): header, entries, CRC-32 over the bytes from the magic number on.
 

Variables

constexpr uint32_t tmc9660::kConfigMemAddress = 0x0002'0000U
 Address of the configuration memory in the bootloader's address space.
 
constexpr std::size_t tmc9660::kClockWordIndex = 6
 Word index of the clock configuration (byte offset 24).
 
constexpr std::size_t tmc9660::kBootModeWordIndex = 2
 Word index of the BOOT_MODE word (byte offset 8): written last.
 
constexpr std::size_t tmc9660::kLdoWordIndex = 0
 Word index of the LDO configuration (byte offset 0).
 
constexpr std::size_t tmc9660::kPartitionHeaderBytes = 16
 Header size of a partition table.
 
constexpr std::size_t tmc9660::kPartitionEntryBytes = 24
 Size of one partition entry.
 

Detailed Description

The bootloader's configuration memory (64 bytes, datasheet "Bootloader Configuration") as a typed BootConfig, and the external-memory partition table builder.

The configuration memory is 16 little-endian 32-bit words. Every documented field is a row of kBootFields (byte offset, shift and width as the datasheet prints them), so a field is reached by name, range checked, and the table is the single source of the layout. A field the documents leave unclear (the SPI-encoder chip-select polarity, ambiguity A16) is reachable through the raw SetWord().