brushless20 2.1.0.0
Main Page

Brushless 20 click

‍Brushless 20 Click is a compact add-on board that controls brushless DC (BLDC) motors with any MCU. This board features the DRV8313, a fully integrated three-phase BLDC motor driver from Texas Instruments. It provides three individually controllable half-H-bridge drivers intended to drive a three-phase BLDC motor, solenoids, or other loads. Each output driver channel consists of N-channel power MOSFETs configured in a 1/2-H-bridge configuration. Besides, it has a wide operating voltage range from 8V to 60V, alongside several built-in protection circuits such as undervoltage, charge pump faults, overcurrent, and overtemperature.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jul 2022.
  • Type : I2C type

Software Support

We provide a library for the Brushless 20 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 20 Click driver.

Standard key functions :

Example key functions :

  • brushless20_perform_com_sequence This function performs a single commutation sequence for the selected rotation direction at a desired speed.
    err_t brushless20_perform_com_sequence ( brushless20_t *ctx, uint8_t dir, uint8_t speed );
    err_t brushless20_perform_com_sequence(brushless20_t *ctx, uint8_t dir, uint8_t speed)
    Brushless 20 perform com sequence function.
  • brushless20_drive_motor This function drives the motor for a desired time by performing multiple commutation sequences for the selected rotation direction at a desired speed.
    err_t brushless20_drive_motor ( brushless20_t *ctx, uint8_t dir, uint8_t speed, uint32_t time_ms );
    err_t brushless20_drive_motor(brushless20_t *ctx, uint8_t dir, uint8_t speed, uint32_t time_ms)
    Brushless 20 drive motor function.
  • brushless20_get_fault_pin This function returns the fault pin logic state.
    err_t brushless20_get_fault_pin(brushless20_t *ctx)
    Brushless 20 get fault pin function.

Example Description

‍This example demonstrates the use of the Brushless 20 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.

void application_init ( void )
{
log_cfg_t log_cfg;
brushless20_cfg_t brushless20_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
brushless20_cfg_setup( &brushless20_cfg );
BRUSHLESS20_MAP_MIKROBUS( brushless20_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == brushless20_init( &brushless20, &brushless20_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BRUSHLESS20_ERROR == brushless20_default_cfg ( &brushless20 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ BRUSHLESS20_ERROR
Definition brushless20.h:241
#define BRUSHLESS20_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition brushless20.h:185
void application_init(void)
Definition main.c:29

Application Task

‍Drives the motor in both directions and changes the motor speed every 3 seconds approximately. The current driving direction and speed will be displayed on the USB UART.

void application_task ( void )
{
log_printf ( &logger, "\r\n Driving motor clockwise \r\n" );
for ( uint8_t speed = BRUSHLESS20_SPEED_MIN; speed <= BRUSHLESS20_SPEED_MAX; speed += 20 )
{
log_printf ( &logger, " Speed: %u\r\n", ( uint16_t ) speed );
if ( BRUSHLESS20_OK != brushless20_drive_motor ( &brushless20, BRUSHLESS20_DIR_CW, speed, 3000 ) )
{
log_error ( &logger, " Drive motor " );
}
}
Delay_ms ( 1000 );
log_printf ( &logger, "\r\n Driving motor counter-clockwise \r\n" );
for ( uint8_t speed = BRUSHLESS20_SPEED_MIN; speed <= BRUSHLESS20_SPEED_MAX; speed += 20 )
{
log_printf ( &logger, " Speed: %u\r\n", ( uint16_t ) speed );
if ( BRUSHLESS20_OK != brushless20_drive_motor ( &brushless20, BRUSHLESS20_DIR_CCW, speed, 3000 ) )
{
log_error ( &logger, " Drive motor " );
}
}
Delay_ms ( 1000 );
}
@ BRUSHLESS20_OK
Definition brushless20.h:240
#define BRUSHLESS20_DIR_CW
Brushless 20 direction setting.
Definition brushless20.h:115
#define BRUSHLESS20_SPEED_MIN
Brushless 20 driving speed and time settings.
Definition brushless20.h:142
#define BRUSHLESS20_DIR_CCW
Definition brushless20.h:116
#define BRUSHLESS20_SPEED_MAX
Definition brushless20.h:143
void application_task(void)
Definition main.c:65

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

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.