stepper15 2.0.0.0
Main Page

Stepper 15 click

Stepper 15 Click is a compact add-on board that contains a bipolar stepper motor driver. This board features the DRV8889A, an automotive stepper driver with integrated current sense and stall detection from Texas Instruments.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Mar 2021.
  • Type : I2C/SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

‍This library contains API for the Stepper 15 Click driver. The library contains drivers for work control of the Stepper Motor.

The demo application is composed of two sections :

Application Init

‍Initializes I2C and SPI driver and set default configuration, enable the device and enable outputs mode.

void application_init ( void ) {
log_cfg_t log_cfg;
stepper15_cfg_t stepper15_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
stepper15_cfg_setup( &stepper15_cfg );
STEPPER15_MAP_MIKROBUS( stepper15_cfg, MIKROBUS_1 );
err_t init_flag = stepper15_init( &stepper15, &stepper15_cfg );
if ( ( init_flag == I2C_MASTER_ERROR ) || ( init_flag == SPI_MASTER_ERROR ) ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
stepper15_default_cfg ( &stepper15 );
log_info( &logger, " Application Task " );
log_printf( &logger, "---------------------------------\r\n" );
Delay_ms ( 100 );
Delay_ms ( 100 );
log_printf( &logger, " Fault condition \r\n" );
} else {
log_printf( &logger, " Correct condition \r\n" );
}
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Stop the stepper motor \r\n" );
stepper15_motor_stop( &stepper15 );
Delay_ms ( 1000 );
}
#define STEPPER15_FAULT_CONDITION
Stepper 15 fault condition state description setting.
Definition stepper15.h:347
#define STEPPER15_OUTPUT_MODE_OUTPUTS_ENABLE
Definition stepper15.h:334
#define STEPPER15_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition stepper15.h:366
void stepper15_motor_stop(stepper15_t *ctx)
Stepper 15 motor stop function.
err_t stepper15_set_output_mode(stepper15_t *ctx, uint8_t output_mode)
Stepper 15 set output mode function.
err_t stepper15_set_work_mode(stepper15_t *ctx, uint8_t work_mode)
Stepper 15 set work mode function.
uint8_t stepper15_get_fault_condition(stepper15_t *ctx)
Stepper 15 get fault condition function.
#define STEPPER15_WORK_MODE_ENABLE_DEVICE
Definition stepper15.h:320
void application_init(void)
Definition main.c:38

Application Task

‍The application task represents an example that demonstrates the use of the Stepper 15 Click boardâ„¢ with which the user can sequentially move the motor. The first part of the sequence executes the clockwise/counterclockwise motor movement for an angle of 90-degrees with a step speed of 85/100%, all the way to the last sequence of the same movement routine of 360-degree angle with a step speed of 85/100%. Results are sent to the USART Terminal, where you can track their changes.

void application_task ( void ) {
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Clockwise motion \r\n" );
log_printf( &logger, " Angle of rotation : 90 degrees \r\n" );
log_printf( &logger, " Step speed : 85 %% \r\n" );
stepper15_step_by_angle( &stepper15, step_speed - 15, 90, step_360 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Counterclockwise motion \r\n" );
log_printf( &logger, " Angle of rotation : 180 degrees \r\n" );
log_printf( &logger, " Step speed : 85 %% \r\n" );
stepper15_step_by_angle( &stepper15, step_speed - 15, 180, step_360 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Clockwise motion \r\n" );
log_printf( &logger, " Angle of rotation : 270 degrees \r\n" );
log_printf( &logger, " Step speed : 90 %% \r\n" );
stepper15_step_by_angle( &stepper15, step_speed - 10, 270, step_360 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Counterclockwise motion \r\n" );
log_printf( &logger, " Angle of rotation : 360 degrees \r\n" );
log_printf( &logger, " Step speed : 100 %% \r\n" );
stepper15_step_by_angle( &stepper15, step_speed, 360, step_360 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------------\r\n" );
log_printf( &logger, " Clockwise motion \r\n" );
log_printf( &logger, " Angle of rotation : 360 degrees \r\n" );
log_printf( &logger, " Step speed : 100 %% \r\n" );
stepper15_step_by_angle( &stepper15, step_speed, 360, step_360 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define STEPPER15_DIRECTION_COUNTERCLOCKWISE
Stepper 15 direction description setting.
Definition stepper15.h:305
#define STEPPER15_DIRECTION_CLOCKWISE
Definition stepper15.h:306
void application_task(void)
Definition main.c:88

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

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.