52template <
typename CommType>
72 bool setBank(uint8_t bank)
noexcept;
84 return setBank(
static_cast<uint8_t
>(bank));
107 bool write8(uint8_t v)
noexcept;
118 bool write16(uint16_t v)
noexcept;
129 bool write32(uint32_t v)
noexcept;
189 bool read8(uint8_t* value)
noexcept;
200 bool read16(uint16_t* value)
noexcept;
211 bool read32(uint32_t* value)
noexcept;
222 bool read8Inc(uint8_t* value)
noexcept;
233 bool read16Inc(uint16_t* value)
noexcept;
244 bool read32Inc(uint32_t* value)
noexcept;
255 bool getBank(uint8_t* bank)
noexcept;
279 bool noOp(uint32_t* reply =
nullptr) noexcept;
296 bool readAndVerify8(uint8_t expected, const
char* config_name) noexcept;
309 bool readAndVerify16(uint16_t expected, const
char* config_name) noexcept;
322 bool readAndVerify32(uint32_t expected, const
char* config_name) noexcept;
352 bool otpLoad(uint8_t page, uint8_t* error_count =
nullptr, uint8_t* page_tag =
nullptr) noexcept;
380 bool otpBurn(uint8_t page, uint8_t page_addr = 0) noexcept;
398 uint32_t vdrv_wait_ms = 1000) noexcept;
532 bool bootstrapRS485(uint8_t tx_en_pin, uint8_t pre_delay, uint8_t host_addr,
533 uint8_t device_addr) noexcept;
815 bool startMotorControl(bootcfg::BootMode boot_mode = bootcfg::BootMode::Parameter) noexcept;
818 bool sendCommand(uint8_t cmd, uint32_t value, uint32_t* reply =
nullptr) noexcept;
819 bool sendCommandSPI(uint8_t cmd, uint32_t value, uint32_t* reply) noexcept;
820 bool sendCommandUART(uint8_t cmd, uint32_t value, uint32_t* reply) noexcept;
830#define TMC9660_BOOTLOADER_HEADER_INCLUDED
832#undef TMC9660_BOOTLOADER_HEADER_INCLUDED
TMC9660 bootloader configuration structures and enumerations.
TMC9660 bootloader communication protocol structures and enumerations.
Main TMC9660 bootloader interface class.
Definition tmc9660_bootloader.hpp:53
bool setAddress(uint32_t addr) noexcept
Set the address within the current memory bank.
Definition tmc9660_bootloader.cpp:278
bool getChipFrequency(uint32_t *frequency) noexcept
Get system frequency in MHz.
Definition tmc9660_bootloader.hpp:624
bool flashReadBuffer(uint8_t offset, uint32_t *data) noexcept
Read data from internal 6-byte flash command buffer.
Definition tmc9660_bootloader.cpp:732
bool getInfo(InfoQuery query, uint32_t *value) noexcept
Get bootloader information.
Definition tmc9660_bootloader.cpp:822
bool getAddress(uint32_t *address) noexcept
Get the currently selected memory address.
Definition tmc9660_bootloader.cpp:2343
bool readAndVerify8(uint8_t expected, const char *config_name) noexcept
Read back and verify an 8-bit value matches the expected value.
Definition tmc9660_bootloader.cpp:2283
bool readAndVerify32(uint32_t expected, const char *config_name) noexcept
Read back and verify a 32-bit value matches the expected value.
Definition tmc9660_bootloader.cpp:2323
bool memIsBusy(MemoryBank bank, bool *is_busy) noexcept
Check if external memory is busy.
Definition tmc9660_bootloader.cpp:706
bool sendCommandSPI(uint8_t cmd, uint32_t value, uint32_t *reply) noexcept
Send a bootloader command via SPI interface.
Definition tmc9660_bootloader.cpp:101
bool sendCommand(uint8_t cmd, uint32_t value, uint32_t *reply=nullptr) noexcept
Send a bootloader command and optionally receive a reply.
Definition tmc9660_bootloader.cpp:69
bool flashEraseSector(uint32_t address) noexcept
Erase a sector on external SPI flash.
Definition tmc9660_bootloader.cpp:755
bool read16Inc(uint16_t *value) noexcept
Read a 16-bit word and increment address by 2.
Definition tmc9660_bootloader.cpp:2238
bool bootstrapRS485(uint8_t tx_en_pin, uint8_t pre_delay, uint8_t host_addr, uint8_t device_addr) noexcept
Configure RS485 communication (must be first command for RS485).
Definition tmc9660_bootloader.cpp:788
bool noOp(uint32_t *reply=nullptr) noexcept
No operation - retrieve reply from previous command (SPI only).
Definition tmc9660_bootloader.cpp:364
bool sendCommandUART(uint8_t cmd, uint32_t value, uint32_t *reply) noexcept
Send a bootloader command via UART interface.
Definition tmc9660_bootloader.cpp:191
bool startMotorControl(bootcfg::BootMode boot_mode=bootcfg::BootMode::Parameter) noexcept
Start the motor control system and exit bootloader mode.
Definition tmc9660_bootloader.cpp:2094
bool otpBurnWithWorkaround(uint8_t page, uint8_t page_addr, OtpBurnResult *result, uint32_t vdrv_wait_ms=1000) noexcept
Burn OTP page with Erratum 1 workaround for reliable operation.
Definition tmc9660_bootloader.cpp:498
bool getSpiMemSize(uint32_t *size) noexcept
Get SPI memory size.
Definition tmc9660_bootloader.hpp:689
bool read32Inc(uint32_t *value) noexcept
Read a 32-bit word and increment address by 4.
Definition tmc9660_bootloader.cpp:2255
bool readAndVerify16(uint16_t expected, const char *config_name) noexcept
Read back and verify a 16-bit value matches the expected value.
Definition tmc9660_bootloader.cpp:2303
bool getBank(uint8_t *bank) noexcept
Get the currently selected memory bank.
Definition tmc9660_bootloader.cpp:2266
uint8_t hostAddr_
Host address for UART protocol.
Definition tmc9660_bootloader.hpp:824
bool write8Inc(uint8_t v) noexcept
Write a single byte and increment address by 1.
Definition tmc9660_bootloader.cpp:326
bool applyConfiguration(const BootloaderConfig &cfg, bool fail_on_verify_error=true) noexcept
Apply all fields of a ::BootloaderConfig.
Definition tmc9660_bootloader.cpp:956
bool memIsConfigured(MemoryBank bank, bool *is_configured) noexcept
Check if external memory is configured.
Definition tmc9660_bootloader.cpp:678
bool memIsConnected(MemoryBank bank, bool *is_connected) noexcept
Check if external memory is connected.
Definition tmc9660_bootloader.cpp:692
bool getChipVersion(uint32_t *version) noexcept
Get chip version (silicon revision).
Definition tmc9660_bootloader.hpp:611
bool getGitInfo(GitInfo *git_info) noexcept
Get Git version control information.
Definition tmc9660_bootloader.cpp:871
bool write32(uint32_t v) noexcept
Write a 32-bit word to the previously selected address.
Definition tmc9660_bootloader.cpp:320
bool write16(uint16_t v) noexcept
Write a 16-bit word to the previously selected address.
Definition tmc9660_bootloader.cpp:306
bool getChipVariant(uint32_t *variant) noexcept
Get chip variant (TMC9660 reports value 2).
Definition tmc9660_bootloader.hpp:739
bool checkOtpBurnStatus(bool *result) noexcept
Check OTP burn status using Erratum 1 workaround verification.
Definition tmc9660_bootloader.cpp:580
bool read8(uint8_t *value) noexcept
Read a single byte from the previously selected address.
Definition tmc9660_bootloader.cpp:2160
uint8_t deviceAddr_
Device address for UART protocol.
Definition tmc9660_bootloader.hpp:823
bool getFeatures(BootloaderFeatures *features) noexcept
Get available feature flags.
Definition tmc9660_bootloader.cpp:854
bool read32(uint32_t *value) noexcept
Read a 32-bit word from the previously selected address.
Definition tmc9660_bootloader.cpp:2210
TMC9660Bootloader(CommType &comm) noexcept
Construct a TMC9660Bootloader instance.
Definition tmc9660_bootloader.cpp:51
bool otpLoad(uint8_t page, OtpLoadResult *result) noexcept
Load an OTP (One-Time Programmable) page into the OTP memory bank.
Definition tmc9660_bootloader.cpp:385
bool getConfigMemSize(uint32_t *size) noexcept
Get CONFIG memory bank size.
Definition tmc9660_bootloader.hpp:650
bool flashLoadBuffer(uint8_t offset, uint32_t data) noexcept
Load data into internal 6-byte flash command buffer.
Definition tmc9660_bootloader.cpp:724
bool getI2cMemPartitions(uint32_t *count) noexcept
Get number of I2C memory partitions.
Definition tmc9660_bootloader.hpp:726
bool flashReadJedecId(uint8_t *manufacturer_id) noexcept
Read JEDEC manufacturer ID from SPI flash.
Definition tmc9660_bootloader.cpp:762
bool setBank(uint8_t bank) noexcept
Select the target memory bank for subsequent operations.
Definition tmc9660_bootloader.cpp:264
bool write32Inc(uint32_t v) noexcept
Write a 32-bit word and increment address by 4.
Definition tmc9660_bootloader.cpp:338
bool getChipType(uint32_t *chip_type) noexcept
Get chip type (should return 0x544D0001 for TMC9660).
Definition tmc9660_bootloader.hpp:565
bool getConfigMemStart(uint32_t *address) noexcept
Get CONFIG memory bank start address.
Definition tmc9660_bootloader.hpp:637
bool read16(uint16_t *value) noexcept
Read a 16-bit word from the previously selected address.
Definition tmc9660_bootloader.cpp:2185
bool getOtpMemSize(uint32_t *size) noexcept
Get OTP memory page size.
Definition tmc9660_bootloader.hpp:663
bool setBank(MemoryBank bank) noexcept
Select the target register bank using enum (overloaded).
Definition tmc9660_bootloader.hpp:83
bool write32IncMultiple(const uint32_t *values, size_t count) noexcept
Write multiple 32-bit words starting at the current address.
Definition tmc9660_bootloader.cpp:354
bool write8(uint8_t v) noexcept
Write a single byte to the previously selected address.
Definition tmc9660_bootloader.cpp:292
CommType & comm_
Definition tmc9660_bootloader.hpp:822
bool getSpiMemPartitions(uint32_t *count) noexcept
Get number of SPI memory partitions.
Definition tmc9660_bootloader.hpp:713
bool getI2cMemSize(uint32_t *size) noexcept
Get I2C memory size.
Definition tmc9660_bootloader.hpp:676
bool flashSendDatagram(uint8_t num_bytes) noexcept
Send datagram to SPI flash and receive reply.
Definition tmc9660_bootloader.cpp:747
bool read8Inc(uint8_t *value) noexcept
Read a single byte and increment address by 1.
Definition tmc9660_bootloader.cpp:2221
bool getAllBootloaderInfo() noexcept
Retrieve and log all available bootloader information.
Definition tmc9660_bootloader.cpp:2354
bool write16Inc(uint16_t v) noexcept
Write a 16-bit word and increment address by 2.
Definition tmc9660_bootloader.cpp:332
bool getBootloaderVersion(BootloaderVersion *version) noexcept
Get bootloader version information.
Definition tmc9660_bootloader.cpp:837
bool otpBurn(uint8_t page, uint8_t page_addr, OtpBurnResult *result) noexcept
Permanently burn data to OTP (One-Time Programmable) memory.
Definition tmc9660_bootloader.cpp:431
bool getPartitionVersion(PartitionVersion *version) noexcept
Get partition version information.
Definition tmc9660_bootloader.cpp:888
Definition bootloader_config.hpp:9
MemoryBank
Memory bank identifiers for bootloader operations.
Definition bootloader_protocol.hpp:86
InfoQuery
GET_INFO query types for retrieving system information.
Definition bootloader_protocol.hpp:105
@ CHIP_TYPE
Get the Chip type (returns 0x544D0001)
@ CONFIG_MEM_SIZE
Get size of CONFIG memory.
@ CONFIG_MEM_START
Get starting address of CONFIG memory.
@ SPI_MEM_SIZE
Get memory size of connected SPI memory.
@ OTP_MEM_SIZE
Get size of one OTP memory page.
@ SPI_MEM_PARTITIONS
Get number of SPI memory partitions.
@ CHIP_VARIANT
Get chip variant (TMC9660 reports value 2)
@ I2C_MEM_SIZE
Get memory size of connected I2C memory.
@ I2C_MEM_PARTITIONS
Get number of I2C memory partitions.
@ CHIP_FREQUENCY
Get system frequency in MHz.
@ CHIP_VERSION
Get silicon revision (TMC9660 reports revision 1)
Complete bootloader configuration structure.
Definition bootloader_config.hpp:998
Feature flags indicating available bootloader capabilities.
Definition bootloader_protocol.hpp:151
Bootloader version information structure.
Definition bootloader_protocol.hpp:132
Git version control information from bootloader firmware.
Definition bootloader_protocol.hpp:177
OTP burn operation result information.
Definition bootloader_protocol.hpp:255
OTP load operation result information.
Definition bootloader_protocol.hpp:217
External memory partition version information.
Definition bootloader_protocol.hpp:197
Tmc9660 Bootloader definitions.
Communication interfaces for TMC9660 Parameter Mode devices using TMCL protocol over SPI.