Brushless 25 click
Brushless 25 Click is a compact add-on board that controls brushless DC (three-phase BLDC) motors with any MCU. This board features the MCT8316A, a high-speed sensorless trapezoidal control integrated FET BLDC driver from Texas Instruments. It provides three individually controllable drivers intended to drive a three-phase BLDC motor, solenoids, or other loads.
click Product page
Click library
- Author : Stefan Ilic
- Date : Jan 2023.
- Type : I2C/SPI type
Software Support
We provide a library for the Brushless 25 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Brushless 25 Click driver.
Standard key functions :
brushless25_cfg_setup
Config Object Initialization function.
void brushless25_cfg_setup(brushless25_cfg_t *cfg)
Brushless 25 configuration object setup function.
Brushless 25 Click configuration object.
Definition brushless25.h:1783
brushless25_init
Initialization function.
err_t brushless25_init(brushless25_t *ctx, brushless25_cfg_t *cfg)
Brushless 25 initialization function.
Brushless 25 Click context object.
Definition brushless25.h:1756
brushless25_default_cfg
Click Default Configuration function.
err_t brushless25_default_cfg(brushless25_t *ctx)
Brushless 25 default configuration function.
Example key functions :
brushless25_register_write
Brushless 25 data writing function.
err_t brushless25_register_write(brushless25_t *ctx, uint16_t reg, uint32_t data_in)
Brushless 25 data writing function.
brushless25_register_read
Brushless 25 data reading function.
err_t brushless25_register_read(brushless25_t *ctx, uint16_t reg, uint32_t *data_out)
Brushless 25 data reading function.
brushless25_set_speed_value
Brushless 25 set speed function.
err_t brushless25_set_speed_value(brushless25_t *ctx, float spd_val)
Brushless 25 set speed function.
Example Description
Application example shows the device's capability of controlling the brushless motor speed and state of the driver.
The demo application is composed of two sections :
Application Init
Initializes the driver, sets the device into slow start mode and sets the speed of the motor to 30%.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ BRUSHLESS25_ERROR
Definition brushless25.h:1813
#define BRUSHLESS25_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition brushless25.h:1735
void application_init(void)
Definition main.c:33
uint8_t speed_val
Definition main.c:31
Application Task
This example is taking track of the state of the driver and motor, as well as its voltage and speed which is changing from 30% to 100%, and logging it onto the USB UART terminal
{
uint32_t tmp_data = 0;
uint16_t spd_data = 0;
uint16_t voltage_data = 0;
switch ( tmp_data )
{
{
log_info( &logger, " System is idle " );
break;
}
{
log_info( &logger, " Motor is starting " );
break;
}
{
log_info( &logger, " Motor is running" );
{
{
}
}
{
{
}
}
break;
}
{
log_info( &logger, " Motor is aligning " );
break;
}
{
log_info( &logger, " Motor is in idle mode " );
break;
}
{
log_info( &logger, " Motor is stoped " );
break;
}
{
log_error( &logger, " Fault accured " );
for ( ; ; );
}
{
log_info( &logger, " Motor brake is on " );
break;
}
default:
{
break;
}
}
Delay_ms ( 1000 );
spd_data = ( uint16_t ) tmp_data / 10;
voltage_data = ( ( uint16_t ) ( tmp_data >> 16 ) / 10 );
log_printf( &logger, " Motor speed: %d Hz \r\n", spd_data );
log_printf( &logger, " Motor voltage: %d V \r\n", voltage_data );
log_printf( &logger, " --------------------- \r\n" );
Delay_ms ( 1000 );
}
#define BRUSHLESS25_STATE_MOTOR_RUN
Definition brushless25.h:1532
#define BRUSHLESS25_STATE_SYSTEM_IDLE
Brushless 25 SYS_STATUS2 register setting.
Definition brushless25.h:1530
#define BRUSHLESS25_BRAKE_OFF
Definition brushless25.h:1612
#define BRUSHLESS25_STATE_MOTOR_START
Definition brushless25.h:1531
#define BRUSHLESS25_STATE_MASK
Definition brushless25.h:1544
#define BRUSHLESS25_STATE_MOTOR_BRAKE
Definition brushless25.h:1543
#define BRUSHLESS25_STATE_MOTOR_STOP
Definition brushless25.h:1537
#define BRUSHLESS25_STATE_FAULT
Definition brushless25.h:1538
#define BRUSHLESS25_STATE_MOTOR_ALIGN
Definition brushless25.h:1535
#define BRUSHLESS25_BRAKE_ON
Definition brushless25.h:1611
#define BRUSHLESS25_STATE_MOTOR_IDLE
Definition brushless25.h:1536
err_t brushless25_set_brake_state(brushless25_t *ctx, uint8_t brake_state)
Brushless 25 set brake state function.
void application_task(void)
Definition main.c:71
uint8_t sw_data
Definition main.c:30
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Brushless25
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.