|
HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
|
Comprehensive UART communication testing suite for TMC51x0. More...
#include "tmc51x0.hpp"#include "test_config/esp32_tmc51x0_bus.hpp"#include "test_config/esp32_tmc51x0_test_config.hpp"#include "test_config/TestFramework.h"#include <memory>#include <vector>Classes | |
| struct | UartTestHandle |
Functions | |
| std::unique_ptr< UartTestHandle > | create_uart_drivers () noexcept |
| Create UART interface and driver instances. | |
| bool | test_uart_basic_communication () noexcept |
| Verify basic UART register read/write communication. | |
| bool | test_uart_node_address_configuration () noexcept |
| Test UART node address configuration via NODECONF register. | |
| bool | test_send_delay_configuration () noexcept |
| Test send delay configuration. | |
| bool | test_uart_motor_control () noexcept |
| Test motor control operations over UART. | |
| void | app_main (void) |
Variables | |
| static const char * | TAG = "UART_MultiNode_Test" |
| static TestResults | g_test_results |
| static constexpr bool | ENABLE_BASIC_COMM_TESTS = true |
| static constexpr bool | ENABLE_NODE_ADDRESS_TESTS = true |
| static constexpr bool | ENABLE_SEND_DELAY_TESTS = true |
| static constexpr bool | ENABLE_MOTOR_CONTROL_TESTS = true |
| static constexpr uint8_t | TEST_NODE_COUNT = 1 |
| Number of TMC51x0 nodes on the UART bus. Set to 1 for single-driver setups. | |
| static constexpr uart_port_t | UART_PORT = UART_NUM_1 |
| UART port (avoid UART_NUM_0 which is typically used for the USB console) | |
| static constexpr uint32_t | UART_BAUD = 115200 |
| UART baud rate – TMC5160 auto-detects from sync frame. | |
| static constexpr int | UART_TX_PIN = 17 |
| UART pin configuration. | |
| static constexpr int | UART_RX_PIN = 16 |
| static constexpr int | EN_PIN = 11 |
| static constexpr tmc51x0_test_config::TestRigType | SELECTED_TEST_RIG |
| Test rig selection for motor configuration. | |
Comprehensive UART communication testing suite for TMC51x0.
Tests UART single-wire communication with 1 or more TMC51x0 drivers. Set TEST_NODE_COUNT to match your hardware (default: 1).
Features tested:
Hardware Requirements:
Pin Configuration (modify as needed):
| void app_main | ( | void | ) |
|
noexcept |
Create UART interface and driver instances.
Creates one Esp32UART interface shared by all drivers, and one TMC51x0 instance per node. Each driver is assigned node address 0 initially (sequential programming would assign unique addresses).
|
noexcept |
Test send delay configuration.
SENDDELAY (NODECONF bits 11:8) controls the number of bit-times the TMC5160 waits before replying to a read request. For multi-node systems, this must be >= 2 to avoid bus contention.
|
noexcept |
Verify basic UART register read/write communication.
Reads the IOIN register (0x04) which contains chip version and pin states. A successful read confirms the UART link, baud rate detection, and CRC are all working.
|
noexcept |
Test motor control operations over UART.
Initializes the driver, configures ramp parameters, enables the motor, commands a small move, and polls for completion. This proves the full driver API works over UART, not just register access.
|
noexcept |
Test UART node address configuration via NODECONF register.
Writes a new node address via ConfigureUartNodeAddress(), then verifies the driver tracks it by checking GetUartNodeAddress(). Since NODECONF is write-only, we verify by reading IOIN on the new address to confirm the chip responds.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
Test rig selection for motor configuration.
|
static |
|
staticconstexpr |
Number of TMC51x0 nodes on the UART bus. Set to 1 for single-driver setups.
|
staticconstexpr |
UART baud rate – TMC5160 auto-detects from sync frame.
|
staticconstexpr |
UART port (avoid UART_NUM_0 which is typically used for the USB console)
|
staticconstexpr |
|
staticconstexpr |
UART pin configuration.