Intermediate
20 min

Turn your automation dreams into reality with TB62261 and TM4C129ENCPDT

Your reliable partner for flawless stepper motor control!

Multi Stepper Click - TB62261 with Fusion for Tiva v8

Published Oct 28, 2023

Click board™

Multi Stepper Click - TB62261

Dev. board

Fusion for Tiva v8

Compiler

NECTO Studio

MCU

TM4C129ENCPDT

Experience silent yet powerful motor control with our solution, designed to excel in office automation, commercial, and industrial equipment

A

A

Hardware Overview

How does it work?

Multi Stepper Click is based on the TB62261FTG, a two-phase bipolar stepping motor driver using a PWM chopper (customized by external resistance R2 and capacitor C1) from Toshiba Semiconductor. The TB62261FTG incorporates a low on-resistance MOSFET output stage, which can deliver a 1.2A current with a motor output voltage rating of 38V, in addition to integrated protection mechanisms such as over-current and over-temperature detection. In addition, it supports full-, half-, and quarter-step resolution, with the help of which motor noise can be significantly reduced with smoother operation and more precise control. As mentioned in the product description, this stepping motor driver is PHASE-in-controlled. These control signals are provided through the PCA9555A port expander, which establishes communication with the MCU via the I2C serial interface. This Click board™ also allows a connection of external control signals on the onboard header J1 on pins labeled as P1 and P2 for the device's PHASE-in control. The PCA9555A also allows choosing the least significant bit (LSB) of its

I2C slave address by positioning SMD jumpers labeled ADDR SEL to an appropriate position marked as 0 and 1. In addition to PHASE signals, four A/B channel logic signals, INA1, INB1, INB2, and INA2, are used to control the motor, adjusting the desired step resolution. AN, CLK, and EN pins of the mikroBUS™ socket control the first three signals. The INA2 signal allows dual control selected by positioning the SMD jumper labeled JP5 to an appropriate position marked as P6 or INT, which chooses control via the expander or INT pin of the mikroBUS™ socket. In the case of the selected INT position of the JP5 jumper, the JP10 jumper needs to be unpopulated. Also, this Click board™ has a Standby function routed to the RST pin of the mikroBUS™ socket used to switch to Standby mode by setting all motor control pins to a low logic state. When the Standby mode is active, the TB62261FTG stops supplying the power to the internal oscillating circuit and motor output part (the motor drive cannot be performed). This Click board™ also has an additional LED for anomaly indication, but since this version of the

stepper driver does not support this feature, this indicator cannot be used. The motor A/B channel current output value can be set manually using an onboard trimmer labeled VR1, which sets the reference voltage from 0V to 3.3V. The default configuration of the JP4 jumper is the VREF position that sets both channels' output current via the VR1 trimmer. In this case, avoid position P4 on a jumper JP4 since the VREFA pin requires an analog signal for setting. Multi Stepper Click supports an external power supply for the TB62261FTG, which can be connected to the input terminal labeled as VM and should be within the range of 10V to 38V, while the stepper motor coils can be connected to the terminals labeled as B+, B-, A-, and A+. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

Multi Stepper Click - TB62261 hardware overview image

Features overview

Development board

Fusion for TIVA v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from Texas Instruments, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. 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, Fusion for TIVA v8 provides a fluid and immersive working experience, allowing access

anywhere and under any circumstances at any time. Each part of the Fusion for TIVA v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it 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 HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for TIVA 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.

Fusion for Tiva v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

Texas Instruments

Pin count

128

RAM (Bytes)

262144

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.

Multi Stepper Click - TB62261 accessories image

Used MCU Pins

mikroBUS™ mapper

A-Channel Control 1
PD0
AN
Standby Control
PK3
RST
B-Channel Control 2
PH0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
B-Channel Control 1
PL4
PWM
Interrupt / A-Channel Control 2
PQ4
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PD2
SCL
I2C Data
PD3
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Multi Stepper Click - TB62261 Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for Tiva v8 as your development board.

Fusion for PIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
v8 SiBRAIN Access MB 1 - 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 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 Multi Stepper TB62261 Click driver.

Key functions:

  • multisteppertb62261_set_step_mode - This function sets the step mode resolution settings in ctx->step_mode.

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

  • multisteppertb62261_set_direction - This function sets the motor direction to clockwise or counter-clockwise in ctx->direction.

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 MultiStepperTB62261 Click example
 *
 * # Description
 * This example demonstrates the use of the Multi Stepper TB62261 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 steps and then counter-clockiwse for 100 steps with
 * 2 seconds delay before changing the direction.
 * Each step will be logged on the USB UART where you can track the program flow.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "multisteppertb62261.h"

static multisteppertb62261_t multisteppertb62261;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    multisteppertb62261_cfg_t multisteppertb62261_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.
    multisteppertb62261_cfg_setup( &multisteppertb62261_cfg );
    MULTISTEPPERTB62261_MAP_MIKROBUS( multisteppertb62261_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == multisteppertb62261_init( &multisteppertb62261, &multisteppertb62261_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( MULTISTEPPERTB62261_ERROR == multisteppertb62261_default_cfg ( &multisteppertb62261 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    multisteppertb62261_set_direction ( &multisteppertb62261, MULTISTEPPERTB62261_DIR_CW );
    if ( MULTISTEPPERTB62261_OK == multisteppertb62261_drive_motor ( &multisteppertb62261, 200, 
                                                                     MULTISTEPPERTB62261_SPEED_FAST ) )
    {
        log_printf ( &logger, " Move 200 steps clockwise \r\n\n" );
        Delay_ms ( 2000 );
    }
    
    multisteppertb62261_set_direction ( &multisteppertb62261, MULTISTEPPERTB62261_DIR_CCW );
    if ( MULTISTEPPERTB62261_OK == multisteppertb62261_drive_motor ( &multisteppertb62261, 100,
                                                                     MULTISTEPPERTB62261_SPEED_FAST ) )
    {
        log_printf ( &logger, " Move 100 steps counter-clockwise \r\n\n" );
        Delay_ms ( 2000 );
    }
}

void main ( void ) 
{
    application_init( );

    for ( ; ; ) 
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ 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.