Beginner
10 min

Deliver smooth, silent motion of the bipolar stepper motors with TMC2660 and PIC18F2455

Universal stepper driver for two-phase bipolar motors with up to 4A motor current per coil

Silent Step 3 Click with EasyPIC v8

Published Mar 25, 2024

Click board™

Silent Step 3 Click

Dev. board

EasyPIC v8

Compiler

NECTO Studio

MCU

PIC18F2455

Leap forward in stepper motor control technology, combining high power and advanced features for smooth and silent operation

A

A

Hardware Overview

How does it work?

Silent Step 3 Click is based on the TMC2660, a highly integrated bipolar step motor power driver from Analog Devices. As mentioned, this device has many different features, allowing the driver to be used almost autonomously. Two control interfaces exist: the SPI serial interface and the STEP/DIR interface. The SPI interface writes control information to the chip and returns status information. This interface must be used to initialize the parameters and modes necessary to enable driving the motor. The motion of the motor can be controlled by using the STEP and DIR signals or through the SPI interface alone. Technologies, such as stallGuard2™, spreadCycle™, coolStep™, spreadCycle™, and microPlayer™, help to achieve high autonomy and smooth motion of the driven motor, even by using the STEP and DIR input pins to set the direction and step propagation. The internal micro step table maps the sine function from 0° to 90°. Symmetries allow mapping of the sine and cosine functions from 0° to 360° with this table. The TMC2660 supports two motor driver control modes: STEP/DIR and SPI modes. STEP/DIR mode is also referred to as the legacy mode. The device is operated similarly to other pin-driven step motor controllers/drivers – the step propagation is controlled by pulses on the STEP

input, and the DIR pin determines the direction. In SPI mode, the user can directly access the motor's current sign and magnitude by setting the parameters in the DRVCTRL Register. All working parameters can be configured and controlled via the SPI interface in both modes. Also, the power and thermal data can be returned to the MCU for further analysis and optimization. In STEP/DIR mode, the microPlyer STEP pulse interpolator brings the smooth motor operation of high-resolution micro-stepping to applications originally designed for coarser stepping and reduces pulse bandwidth. MicroPlyer produces 16 micro steps at 256x resolution for each active edge on the STP pin of the Silent Step 3 Click. The currents through both motor coils are controlled using choppers, which work independently of each other. Two chopper modes are available: a new high-performance chopper algorithm called spreadCycle and a proven constant off-time chopper mode. The constant off-time mode cycles through three phases: on, fast decay, and slow decay. The spreadCycle mode cycles through four phases: on, slow decay, fast decay, and a second slow decay. The current through the motor coils has to be measured to achieve all the previously mentioned features. Because of the high power output of the

TMC2660, external shunt resistors are required. Therefore, the Silent Step 3 Click has onboard carefully selected, low-inductance type 0.1 Ohm shunt resistors. This minimizes measurement imperfections caused by the switching spikes from the MOSFET bridges, for example, and maximizes the efficiency of the TMC2660. The STEP, DIR, and ENN pins of the TMC2660 are directly routed to the mikroBUS™ pins PWM, INT, and AN and marked as STP, DIR, and EN, respectively. The digital I/O pins' logic levels are easily adjustable by setting the desired voltage to the VCC_IO pin. Therefore, the interface logic level on the Silent Step 3 click can be easily configured for 3.3 V or 5 V logic by moving the VSEL jumper to the respective voltage, which allows both 3.3V and 5V MCUs to be interfaced with this Click board™. The power supply for the bipolar stepper motor can be connected to the terminal's VM and GND inputs. The connected voltage should stay within the range between 9V and 29V. The rest of the terminals allow bipolar stepper motor coils to be connected: A1 and A2 terminal inputs connect the first coil, while the B1 and B2 inputs connect the second motor coil.

Silent Step 3 Click hardware overview image

Features overview

Development board

EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyPIC v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

24

Silicon Vendor

Microchip

Pin count

28

RAM (Bytes)

2048

You complete me!

Accessories

The 28BYJ-48 is an adaptable 5VDC stepper motor with a compact design, ideal for various applications. It features four phases, a speed variation ratio of 1/64, and a stride angle of 5.625°/64 steps, allowing precise control. The motor operates at a frequency of 100Hz and has a DC resistance of 50Ω ±7% at 25°C. It boasts an idle in-traction frequency greater than 600Hz and an idle out-traction frequency exceeding 1000Hz, ensuring reliability in different scenarios. With a self-positioning torque and in-traction torque both exceeding 34.3mN.m at 120Hz, the 28BYJ-48 offers robust performance. Its friction torque ranges from 600 to 1200 gf.cm, while the pull-in torque is 300 gf.cm. This motor makes a reliable and efficient choice for your stepper motor needs.

Silent Step 3 Click accessories 1 image

Used MCU Pins

mikroBUS™ mapper

Internal Power MOSFET Control
RA3
AN
Motor Stall Detection
RA0
RST
SPI Chip Select
RA5
CS
SPI Clock
RC3
SCK
SPI Data OUT
RC4
MISO
SPI Data IN
RC5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Step Trigger
RC1
PWM
Direction Control
RB1
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power supply
5V
5V
Ground
GND
GND
2

Take a closer look

Click board™ Schematic

Silent Step 3 Click Schematic schematic

Step by step

Project assembly

EasyPIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v8 as your development board.

EasyPIC v8 front image hardware assembly
LTE IoT 5 Click front image hardware assembly
MCU DIP 28 hardware assembly
LTE IoT 5 Click complete accessories setup image hardware assembly
EasyPIC v8 28pin-DIP Access - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for Silent Step 3 Click driver.

Key functions:

  • silentstep3_set_step_mode - This function sets the microstep resolution bits in DRVCTRL register

  • silentstep3_set_direction - This function sets the motor direction by setting the DIR pin logic state

  • silentstep3_drive_motor - This function drives the motor for the specific number of steps at the selected speed

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief Silent Step 3 Click example
 *
 * # Description
 * This example demonstrates the use of the Silent Step 3 click board by driving the 
 * motor in both directions for a desired number of steps.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * Drives the motor clockwise for 200 full steps and then counter-clockiwse for 200 half
 * steps and 400 quarter steps with 2 seconds delay on driving mode change. All data is
 * being logged on the USB UART where you can track the program flow.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "silentstep3.h"

static silentstep3_t silentstep3;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    silentstep3_cfg_t silentstep3_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    silentstep3_cfg_setup( &silentstep3_cfg );
    SILENTSTEP3_MAP_MIKROBUS( silentstep3_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == silentstep3_init( &silentstep3, &silentstep3_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( SILENTSTEP3_ERROR == silentstep3_default_cfg ( &silentstep3 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    log_printf ( &logger, " Move 200 full steps clockwise, speed: slow\r\n\n" );
    silentstep3_set_direction ( &silentstep3, SILENTSTEP3_DIR_CW );
    silentstep3_set_step_mode ( &silentstep3, SILENTSTEP3_MODE_FULL_STEP );
    silentstep3_drive_motor ( &silentstep3, 200, SILENTSTEP3_SPEED_SLOW );
    Delay_ms ( 2000 );

    log_printf ( &logger, " Move 200 half steps counter-clockwise, speed: medium\r\n\n" );
    silentstep3_set_direction ( &silentstep3, SILENTSTEP3_DIR_CCW );
    silentstep3_set_step_mode ( &silentstep3, SILENTSTEP3_MODE_HALF_STEP );
    silentstep3_drive_motor ( &silentstep3, 200, SILENTSTEP3_SPEED_MEDIUM );
    Delay_ms ( 2000 );

    log_printf ( &logger, " Move 400 quarter steps counter-clockwise, speed: fast\r\n\n" );
    silentstep3_set_direction ( &silentstep3, SILENTSTEP3_DIR_CCW );
    silentstep3_set_step_mode ( &silentstep3, SILENTSTEP3_MODE_QUARTER_STEP );
    silentstep3_drive_motor ( &silentstep3, 400, SILENTSTEP3_SPEED_FAST );
    Delay_ms ( 2000 );
}

int main ( void ) 
{
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.