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

Comprehensive DC 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 dc_comprehensive_test.cpp:

Classes

struct  TestDriverHandle
 

Functions

bool test_dc_bootloader_initialization () noexcept
 
bool test_dc_motor_type_configuration () noexcept
 
bool test_dc_current_control () noexcept
 
bool test_dc_velocity_control () noexcept
 
bool test_dc_openloop_current_mode () noexcept
 
bool test_dc_hbridge_control () noexcept
 
bool test_dc_protection_features () noexcept
 
bool test_dc_telemetry_monitoring () noexcept
 
bool test_dc_performance_benchmarks () noexcept
 
bool test_dc_error_handling () noexcept
 
bool test_dc_edge_cases () noexcept
 
bool test_dc_multi_device_operations () noexcept
 
bool test_dc_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_dc_configuration (const TMC9660< Esp32Tmc9660SpiBus > &driver) noexcept
 
bool verify_current_limits (const TMC9660< Esp32Tmc9660SpiBus > &driver) noexcept
 
void log_dc_telemetry_data (TMC9660< Esp32Tmc9660SpiBus > &driver, const char *context) noexcept
 
void log_dc_telemetry_data (TMC9660< Esp32Tmc9660UartBus > &driver, const char *context) noexcept
 
void app_main (void)
 

Variables

static const charTAG = "DC_Test"
 
static TestResults g_test_results
 
static constexpr bool ENABLE_CORE_TESTS = true
 
static constexpr bool ENABLE_CURRENT_CONTROL_TESTS = true
 
static constexpr bool ENABLE_VELOCITY_CONTROL_TESTS = true
 
static constexpr bool ENABLE_OPENLOOP_TESTS = true
 
static constexpr bool ENABLE_HBRIDGE_TESTS = true
 
static constexpr bool ENABLE_PROTECTION_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 = 1024
 
static constexpr uint16_t TEST_MAX_CURRENT = 1500
 
static constexpr uint16_t TEST_VELOCITY_TARGET = 500
 
static constexpr uint16_t TEST_CURRENT_TARGET = 800
 

Detailed Description

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

This file contains comprehensive testing for DC motor control including:

  • Bootloader initialization and configuration validation
  • Motor type configuration (DC motor)
  • Current control and torque limiting
  • Velocity control with encoder feedback
  • Open-loop current mode testing
  • H-bridge control and PWM configuration
  • Motor startup and shutdown procedures
  • Error handling and recovery
  • Telemetry monitoring during operation
  • Performance benchmarking
  • Multi-device scenarios
  • Edge cases and fault injection
  • Protection features (overcurrent, overtemperature, undervoltage)

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_dc_telemetry_data() [1/2]

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

◆ log_dc_telemetry_data() [2/2]

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

◆ test_dc_bootloader_initialization()

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

◆ test_dc_current_control()

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

◆ test_dc_edge_cases()

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

◆ test_dc_error_handling()

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

◆ test_dc_hbridge_control()

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

◆ test_dc_motor_type_configuration()

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

◆ test_dc_multi_device_operations()

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

◆ test_dc_openloop_current_mode()

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

◆ test_dc_performance_benchmarks()

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

◆ test_dc_protection_features()

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

◆ test_dc_startup_shutdown_procedures()

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

◆ test_dc_telemetry_monitoring()

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

◆ test_dc_velocity_control()

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

◆ verify_current_limits()

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

◆ verify_dc_configuration()

bool verify_dc_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_HBRIDGE_TESTS

constexpr bool ENABLE_HBRIDGE_TESTS = true
staticconstexpr

◆ ENABLE_OPENLOOP_TESTS

constexpr bool ENABLE_OPENLOOP_TESTS = true
staticconstexpr

◆ ENABLE_PERFORMANCE_TESTS

constexpr bool ENABLE_PERFORMANCE_TESTS = true
staticconstexpr

◆ ENABLE_PROTECTION_TESTS

constexpr bool ENABLE_PROTECTION_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 = "DC_Test"
static

◆ TEST_CURRENT_TARGET

constexpr uint16_t TEST_CURRENT_TARGET = 800
staticconstexpr

◆ TEST_ENCODER_CPR

constexpr uint16_t TEST_ENCODER_CPR = 1024
staticconstexpr

◆ TEST_MAX_CURRENT

constexpr uint16_t TEST_MAX_CURRENT = 1500
staticconstexpr

◆ TEST_VELOCITY_TARGET

constexpr uint16_t TEST_VELOCITY_TARGET = 500
staticconstexpr