HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
internal_ramp_sinusoidal.cpp File Reference

Back-and-forth motion example for TMC51x0 stepper motor driver. More...

#include "tmc51x0.hpp"
#include "test_config/esp32_tmc51x0_bus.hpp"
#include "test_config/esp32_tmc51x0_test_config.hpp"
#include "esp_log.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <cmath>
Include dependency graph for internal_ramp_sinusoidal.cpp:

Classes

class  BackAndForthMotion
 Back-and-forth motion controller using positioning mode. More...
 

Functions

void app_main ()
 

Variables

static constexpr tmc51x0_test_config::TestRigType SELECTED_TEST_RIG
 
static const char * TAG = "Sinusoidal"
 

Detailed Description

Back-and-forth motion example for TMC51x0 stepper motor driver.

This example demonstrates simple back-and-forth motion using the TMC51x0's internal ramp generator in positioning mode. The motor moves between two positions repeatedly (configurable travel distance in degrees).

TEST RIG SELECTION: Use SELECTED_TEST_RIG at the top of this file (TEST_RIG_FATIGUE or TEST_RIG_CORE_DRIVER). See esp32_tmc51x0_test_config.hpp for motor, board, and platform specifications.

Hardware Requirements:

  • ESP32 development board
  • TMC51x0 stepper motor driver
  • Stepper motor connected to TMC51x0 (see motor selection above)
  • SPI connection between ESP32 and TMC51x0
  • Chip must be in SPI_INTERNAL_RAMP mode (SPI_MODE=HIGH, SD_MODE=LOW)
  • Power supply: 12-36V DC (ensure adequate current capacity for selected motor)

Pin Configuration (using standard test config):

  • SPI: MOSI=6, MISO=2, SCLK=5, CS=18
  • Control: EN=11
  • Clock: CLK=10
  • Diagnostics: DIAG0=23, DIAG1=15
Author
Nebiyu Tadesse
Date
2025

Function Documentation

◆ app_main()

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

Variable Documentation

◆ SELECTED_TEST_RIG

constexpr tmc51x0_test_config::TestRigType SELECTED_TEST_RIG
staticconstexpr
Initial value:
=
@ TEST_RIG_FATIGUE
Fatigue test rig (Applied Motion 5034-369 motor, TMC51x0 EVAL board, reference switches,...

◆ TAG

const char* TAG = "Sinusoidal"
static