HF-TMC9660 Driver 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC9660
Loading...
Searching...
No Matches
stepper_comprehensive_test.cpp File Reference

Comprehensive Stepper motor testing suite for ESP32-C6 DevKit-M-1 (noexcept) More...

#include "../../../inc/tmc9660.hpp"
#include "esp32_tmc9660_bus.hpp"
#include "TestFramework.h"
#include <memory>
#include <vector>
#include <algorithm>
#include <variant>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Include dependency graph for stepper_comprehensive_test.cpp:

Classes

struct  TestDriverHandle
 

Functions

bool test_stepper_bootloader_initialization () noexcept
 
bool test_stepper_motor_type_configuration () noexcept
 
bool test_stepper_foc_position_control () noexcept
 
bool test_stepper_step_dir_control () noexcept
 
bool test_stepper_microstepping_configuration () noexcept
 
bool test_stepper_position_control () noexcept
 
bool test_stepper_velocity_control () noexcept
 
bool test_stepper_current_control () noexcept
 
bool test_stepper_stall_detection () noexcept
 
bool test_stepper_telemetry_monitoring () noexcept
 
bool test_stepper_performance_benchmarks () noexcept
 
bool test_stepper_error_handling () noexcept
 
bool test_stepper_edge_cases () noexcept
 
bool test_stepper_multi_device_operations () noexcept
 
bool test_stepper_startup_shutdown_procedures () noexcept
 
std::unique_ptr< TestDriverHandlecreate_test_driver (bool use_uart=false, bool use_flash=false) noexcept
 
TMC9660< Esp32Tmc9660SpiBus > * get_spi_driver (TestDriverHandle &handle)
 
TMC9660< Esp32Tmc9660UartBus > * get_uart_driver (TestDriverHandle &handle)
 
bool verify_stepper_configuration (const TMC9660< Esp32Tmc9660SpiBus > &driver) noexcept
 
bool verify_position_control (const TMC9660< Esp32Tmc9660SpiBus > &driver) noexcept
 
void log_stepper_telemetry_data (TMC9660< Esp32Tmc9660SpiBus > &driver, const char *context) noexcept
 
void log_stepper_telemetry_data (TMC9660< Esp32Tmc9660UartBus > &driver, const char *context) noexcept
 
void app_main (void)
 

Variables

static const charTAG = "Stepper_Test"
 
static TestResults g_test_results
 
static constexpr bool ENABLE_CORE_TESTS = true
 
static constexpr bool ENABLE_FOC_POSITION_TESTS = true
 
static constexpr bool ENABLE_STEP_DIR_TESTS = true
 
static constexpr bool ENABLE_MICROSTEPPING_TESTS = true
 
static constexpr bool ENABLE_POSITION_CONTROL_TESTS = true
 
static constexpr bool ENABLE_VELOCITY_CONTROL_TESTS = true
 
static constexpr bool ENABLE_CURRENT_CONTROL_TESTS = true
 
static constexpr bool ENABLE_STALL_DETECTION_TESTS = true
 
static constexpr bool ENABLE_TELEMETRY_TESTS = true
 
static constexpr bool ENABLE_PERFORMANCE_TESTS = true
 
static constexpr bool ENABLE_STRESS_TESTS = true
 
static constexpr uint16_t TEST_ENCODER_CPR = 4000
 
static constexpr uint16_t TEST_MAX_CURRENT = 1500
 
static constexpr uint16_t TEST_POSITION_TARGET = 1000
 
static constexpr uint16_t TEST_VELOCITY_TARGET = 500
 
static constexpr uint8_t TEST_MICROSTEPS = 16
 

Detailed Description

Comprehensive Stepper motor testing suite for ESP32-C6 DevKit-M-1 (noexcept)

This file contains comprehensive testing for Stepper motor control including:

  • Bootloader initialization and configuration validation
  • Motor type configuration (Stepper with various step counts)
  • FOC position control with encoder feedback
  • Step/Direction control mode testing
  • Microstepping configuration and testing
  • Position control with different targets and profiles
  • Velocity control for stepper motors
  • Current control and torque limiting
  • Stall detection and protection
  • Motor startup and shutdown procedures
  • Error handling and recovery
  • Telemetry monitoring during operation
  • Performance benchmarking
  • Multi-device scenarios
  • Edge cases and fault injection

All functions are noexcept - no exception handling used.

Author
Nebiyu Tadesse
Date
2025

Function Documentation

◆ app_main()

void app_main ( void )
Here is the call graph for this function:

◆ create_test_driver()

std::unique_ptr< TestDriverHandle > create_test_driver ( bool use_uart = false,
bool use_flash = false )
noexcept
Here is the call graph for this function:

◆ get_spi_driver()

TMC9660< Esp32Tmc9660SpiBus > * get_spi_driver ( TestDriverHandle & handle)
inline
Here is the caller graph for this function:

◆ get_uart_driver()

TMC9660< Esp32Tmc9660UartBus > * get_uart_driver ( TestDriverHandle & handle)
inline
Here is the caller graph for this function:

◆ log_stepper_telemetry_data() [1/2]

void log_stepper_telemetry_data ( TMC9660< Esp32Tmc9660SpiBus > & driver,
const char * context )
noexcept
Here is the caller graph for this function:

◆ log_stepper_telemetry_data() [2/2]

void log_stepper_telemetry_data ( TMC9660< Esp32Tmc9660UartBus > & driver,
const char * context )
noexcept

◆ test_stepper_bootloader_initialization()

bool test_stepper_bootloader_initialization ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_current_control()

bool test_stepper_current_control ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_edge_cases()

bool test_stepper_edge_cases ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_error_handling()

bool test_stepper_error_handling ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_foc_position_control()

bool test_stepper_foc_position_control ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_microstepping_configuration()

bool test_stepper_microstepping_configuration ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_motor_type_configuration()

bool test_stepper_motor_type_configuration ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_multi_device_operations()

bool test_stepper_multi_device_operations ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_performance_benchmarks()

bool test_stepper_performance_benchmarks ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_position_control()

bool test_stepper_position_control ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_stall_detection()

bool test_stepper_stall_detection ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_startup_shutdown_procedures()

bool test_stepper_startup_shutdown_procedures ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_step_dir_control()

bool test_stepper_step_dir_control ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_telemetry_monitoring()

bool test_stepper_telemetry_monitoring ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_stepper_velocity_control()

bool test_stepper_velocity_control ( )
noexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verify_position_control()

bool verify_position_control ( const TMC9660< Esp32Tmc9660SpiBus > & driver)
noexcept
Here is the caller graph for this function:

◆ verify_stepper_configuration()

bool verify_stepper_configuration ( const TMC9660< Esp32Tmc9660SpiBus > & driver)
noexcept
Here is the caller graph for this function:

Variable Documentation

◆ ENABLE_CORE_TESTS

constexpr bool ENABLE_CORE_TESTS = true
staticconstexpr

◆ ENABLE_CURRENT_CONTROL_TESTS

constexpr bool ENABLE_CURRENT_CONTROL_TESTS = true
staticconstexpr

◆ ENABLE_FOC_POSITION_TESTS

constexpr bool ENABLE_FOC_POSITION_TESTS = true
staticconstexpr

◆ ENABLE_MICROSTEPPING_TESTS

constexpr bool ENABLE_MICROSTEPPING_TESTS = true
staticconstexpr

◆ ENABLE_PERFORMANCE_TESTS

constexpr bool ENABLE_PERFORMANCE_TESTS = true
staticconstexpr

◆ ENABLE_POSITION_CONTROL_TESTS

constexpr bool ENABLE_POSITION_CONTROL_TESTS = true
staticconstexpr

◆ ENABLE_STALL_DETECTION_TESTS

constexpr bool ENABLE_STALL_DETECTION_TESTS = true
staticconstexpr

◆ ENABLE_STEP_DIR_TESTS

constexpr bool ENABLE_STEP_DIR_TESTS = true
staticconstexpr

◆ ENABLE_STRESS_TESTS

constexpr bool ENABLE_STRESS_TESTS = true
staticconstexpr

◆ ENABLE_TELEMETRY_TESTS

constexpr bool ENABLE_TELEMETRY_TESTS = true
staticconstexpr

◆ ENABLE_VELOCITY_CONTROL_TESTS

constexpr bool ENABLE_VELOCITY_CONTROL_TESTS = true
staticconstexpr

◆ g_test_results

TestResults g_test_results
static

◆ TAG

const char* TAG = "Stepper_Test"
static

◆ TEST_ENCODER_CPR

constexpr uint16_t TEST_ENCODER_CPR = 4000
staticconstexpr

◆ TEST_MAX_CURRENT

constexpr uint16_t TEST_MAX_CURRENT = 1500
staticconstexpr

◆ TEST_MICROSTEPS

constexpr uint8_t TEST_MICROSTEPS = 16
staticconstexpr

◆ TEST_POSITION_TARGET

constexpr uint16_t TEST_POSITION_TARGET = 1000
staticconstexpr

◆ TEST_VELOCITY_TARGET

constexpr uint16_t TEST_VELOCITY_TARGET = 500
staticconstexpr