Intermediate
30 min

Optimize brushless motor control with TC78B011FTG and STM32F207VGT6

Innovative and reliable

Brushless 23 Click with EasyMx PRO v7 for STM32

Published Apr 05, 2023

Click board™

Brushless 23 Click

Dev. board

EasyMx PRO v7 for STM32

Compiler

NECTO Studio

MCU

STM32F207VGT6

Upgrade your design with an advanced brushless motor driver for smoother, quieter, and more precise motor control

A

A

Hardware Overview

How does it work?

Brushless 23 Click is based on the TC78B011FTG, a three-phase sine-wave PWM pre-driver capable of driving Delta- or Wye-configured motors from Toshiba Semiconductor. Motor rotation is controlled without Hall sensors by detecting the rotational position from the induced voltage. The TC78B011FTG has a built-in closed-loop speed control function, which regulates and maintains the motor rotational speed under dynamic power fluctuations and load variations. This function has an internal non-volatile memory (NVM) for speed profile setting. The TC78B011FTG also has protection features such as thermal shutdown, under-voltage, over-current protection, lock detection, and more. The TC78B011FTG has a speed control command that controls the motor's start, stop, and rotation speed. This signal type is determined by the position of an onboard SW2 switch and register setting, allowing the selection among PWM, analog voltage signal, and standard I2C 2-Wire interface to read data and configure settings with a maximum frequency of 400kHz. The TC78B011FTG also allows choosing its I2C slave address by positioning SMD switches labeled SW3 and SW4 to an appropriate position. In the case of a PWM signal or analog voltage signal, the TC78B011FTG is controlled through the mikroBUS™ pin marked

as SPD. This Click board™ has several operational modes: Standby, Idle, Brake, and Error Mode. Standby mode is available to reduce the power consumption, controlled by the SBY pin of the mikroBUS™ socket, together with register settings. After Power-on, with the SBY pin disabled, the TC78B011FTG reads parameters from NVM and stores them in the registers. After that, IC goes to the Brake sequence and moves to Idle mode. The brake function is controllable by a register setting or an onboard SW1 switch. The TC78B011FTG starts the motor by Start-Up sequence with the speed control command set. When an abnormal condition is detected, IC moves to Error mode and automatically restarts after restart time. In Error mode with Stop as a speed control command, the TC78B011FTG will move to Idle mode. Alongside I2C communication, several signals connected to the mikroBUS™ socket pins are also used to forward the information to the MCU. The DIR pin of the mikroBUS™ socket is used to select the direction of motor rotation (clockwise/counterclockwise), while the CMO pin serves as the motor's output current monitoring. Also, the TC78B011FTG provides selectable interrupts chosen via the INT SEL jumper routed on the INT pin of the mikroBUS™ socket by positioning the SMD jumper

to an appropriate position marked as ALR od FG. The default position of this jumper is the FG position which serves as a rotation speed indicator, while the ALR position represents an abnormality detection feature. Both features have visual indicators; a red LED marked as ALR and a blue LED labeled as FG. Brushless 23 Click is realized using six N-channel MOSFETs, the SSM6K513NU also from Toshiba Semiconductor, two for each of the three phases. These FETs, capable of handling 15A, allow low power dissipation when driving 5A BLDC before hitting the output current limit threshold (used to restrain the current flowing to the motor). It also supports an external power supply for the motor, which can be connected to the input terminal labeled as VM and should be within the range of 11V to 27V, while the BLDC motor coils can be connected to the terminals labeled as U, V, and W. 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. However, the 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.

brushless-23-click-hardware-overview

Features overview

Development board

EasyMx PRO v7 for STM32 is the seventh generation of ARM development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 32-bit ARM microcontrollers from STMicroelectronics and a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB-B. 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. With two different connectors for each port, EasyMx PRO v7 for STM32 allows you to connect accessory boards, sensors, and custom electronics

more efficiently than ever. Each part of the EasyMx PRO v7 for STM32 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-23V AC or 9-32V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B) connector. Communication options such

as USB-UART, USB-HOST/DEVICE, CAN, and Ethernet are also included, including the well-established mikroBUS™ standard, one display option for the TFT board line of products, and a standard TQFP socket for the seventh-generation MCU cards. This socket covers a wide range of 32-bit ARM MCUs, like STM32 Cortex-M3 and -M4 MCUs. EasyMx PRO v7 for STM32 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.

EasyMx PRO v7 for STM32 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

7th Generation

Architecture

ARM Cortex-M3

MCU Memory (KB)

10

Silicon Vendor

STMicroelectronics

Pin count

100

RAM (Bytes)

100

You complete me!

Accessories

Brushless DC (BLDC) Motor with a Hall sensor represents a high-performance motor from the 42BLF motor series. This motor, wired in a star configuration, boasts a Hall Effect angle of 120°, ensuring precise and reliable performance. With a compact motor length of 47mm and a lightweight design tipping the scales at just 0.29kg, this BLDC motor is engineered to meet your needs. Operating flawlessly at a voltage rating of 24VDC and a speed range of 4000 ± 10% RPM, this motor offers consistent and dependable power. It excels in a normal operational temperature range from -20 to +50°C, maintaining efficiency with a rated current of 1.9A. Also, this product seamlessly integrates with all Brushless Click boards™ and those that require BLDC motors with Hall sensors.

Brushless 23 Click accessories image

Used MCU Pins

mikroBUS™ mapper

Current Monitor
PA4
AN
Rotation Direction
PC2
RST
Standby
PD13
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Speed Control
PA0
PWM
Interrupt
PD10
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB6
SCL
I2C Data
PB7
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Brushless 23 Click Schematic schematic

Step by step

Project assembly

EasyPIC Fusion v7 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyMx PRO v7 for STM32 as your development board.

EasyPIC Fusion v7 front image hardware assembly
GNSS2 Click front image hardware assembly
EasyPIC FUSION v7 ETH MCUcard with PIC32MZ2048EFH144 front image hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EMxPRO-STM32-TIVA/EPIC Fusion v7 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
EasyPIC PRO v7a MCU Selection Necto Step hardware assembly
EasyPIC PRO v7a Display Selection Necto Step 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 Brushless 23 Click driver.

Key functions:

  • brushless23_pwm_set_duty_cycle This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).

  • brushless23_switch_direction This function switches the direction by toggling the DIR pin state.

  • brushless23_get_motor_speed This function reads the motor speed in Hz.

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 Brushless23 Click example
 *
 * # Description
 * This example demonstrates the use of the Brushless 23 click board by driving the 
 * motor in both directions at different speeds.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * Controls the motor speed by changing the PWM duty cycle every 2 seconds.
 * The duty cycle ranges from 20% to 80%. At the minimal speed, the motor switches 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 "brushless23.h"

static brushless23_t brushless23;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    brushless23_cfg_t brushless23_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.
    brushless23_cfg_setup( &brushless23_cfg );
    BRUSHLESS23_MAP_MIKROBUS( brushless23_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == brushless23_init( &brushless23, &brushless23_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( BRUSHLESS23_ERROR == brushless23_default_cfg ( &brushless23 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    static int8_t duty_cnt = 2;
    static int8_t duty_inc = 1;
    float duty = duty_cnt / 10.0;
    brushless23_pwm_set_duty_cycle ( &brushless23, duty );
    log_printf( &logger, "\r\n Duty cycle: %u%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
    Delay_ms ( 1500 );
    float motor_speed_hz = 0;
    if ( BRUSHLESS23_OK == brushless23_get_motor_speed ( &brushless23, &motor_speed_hz ) )
    {
        log_printf( &logger, " Speed: %.1f Hz\r\n", motor_speed_hz );
    }
    duty_cnt += duty_inc;
    if ( duty_cnt > 8 ) 
    {
        duty_cnt = 7;
        duty_inc = -1;
    }
    else if ( duty_cnt < 2 ) 
    {
        duty_cnt = 2;
        duty_inc = 1;
        log_printf( &logger, "\r\n Switch direction\r\n" );
        brushless23_pwm_set_duty_cycle ( &brushless23, BRUSHLESS23_DUTY_CYCLE_MIN_PCT );
        Delay_ms ( 500 );
        brushless23_switch_direction ( &brushless23 );
    }
    Delay_ms ( 500 );
}

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.