silentstep2  2.1.0.0
Main Page

Silent Step 2 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Nenad Filipovic
  • Date : Oct 2023.
  • Type : I2C/SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Silent Step 2 Click boardâ„¢ by driving the motor in both directions for a desired rotation angle.

The demo application is composed of two sections :

Application Init

The initialization of I2C and SPI module and log UART. After driver initialization, the app sets the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
silentstep2_cfg_t silentstep2_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
silentstep2_cfg_setup( &silentstep2_cfg );
SILENTSTEP2_MAP_MIKROBUS( silentstep2_cfg, MIKROBUS_1 );
err_t init_flag = silentstep2_init( &silentstep2, &silentstep2_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( SILENTSTEP2_ERROR == silentstep2_default_cfg ( &silentstep2 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 100 );
}

Application Task

The application task represents an example that demonstrates the use of the Silent Step 2 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 50%, all the way to the last sequence of the same movement routine of 360 degree angle with a step speed of 90%. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 90 degrees\r\n" );
log_printf( &logger, " Step speed : 50 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 2000 );
}
log_printf( &logger, " Counterclockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 180 deg\r\n" );
log_printf( &logger, " Step speed : 50 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 2000 );
}
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 270 deg\r\n" );
log_printf( &logger, " Step speed : 50 %% \r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 2000 );
}
log_printf( &logger, " Counterclockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 360 deg\r\n" );
log_printf( &logger, " Step speed : 90 %%\r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 2000 );
}
log_printf( &logger, " Clockwise motion\r\n" );
log_printf( &logger, " Angle of rotation : 360 deg\r\n" );
log_printf( &logger, " Step speed : 90 %% \r\n" );
{
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 2000 );
}
}

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

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.


SILENTSTEP2_ERROR
@ SILENTSTEP2_ERROR
Definition: silentstep2.h:482
silentstep2_rotate_by_angle
err_t silentstep2_rotate_by_angle(silentstep2_t *ctx, uint8_t step_speed, float angle, uint16_t res_360)
Silent Step 2 rotates the shaft through a desired angle function.
silentstep2_set_direction
void silentstep2_set_direction(silentstep2_t *ctx, uint8_t dir)
Silent Step 2 sets the clockwise or counterclockwise direction movement function.
SILENTSTEP2_MAP_MIKROBUS
#define SILENTSTEP2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: silentstep2.h:325
silentstep2_cfg_t
Silent Step 2 Click configuration object.
Definition: silentstep2.h:376
silentstep2_init
err_t silentstep2_init(silentstep2_t *ctx, silentstep2_cfg_t *cfg)
Silent Step 2 initialization function.
silentstep2_t
Silent Step 2 Click context object.
Definition: silentstep2.h:355
SILENTSTEP2_DIRECTION_COUNTERCLOCKWISE
#define SILENTSTEP2_DIRECTION_COUNTERCLOCKWISE
Silent Step 2 step/direction driver mode.
Definition: silentstep2.h:279
application_task
void application_task(void)
Definition: main.c:77
silentstep2_default_cfg
err_t silentstep2_default_cfg(silentstep2_t *ctx)
Silent Step 2 default configuration function.
SILENTSTEP2_OK
@ SILENTSTEP2_OK
Definition: silentstep2.h:481
silentstep2_cfg_setup
void silentstep2_cfg_setup(silentstep2_cfg_t *cfg)
Silent Step 2 configuration object setup function.
SILENTSTEP2_STEP_RES_200
#define SILENTSTEP2_STEP_RES_200
Definition: main.c:36
application_init
void application_init(void)
Definition: main.c:38
SILENTSTEP2_DIRECTION_CLOCKWISE
#define SILENTSTEP2_DIRECTION_CLOCKWISE
Definition: silentstep2.h:280