gmrangle  2.0.0.0
Main Page

GMR Angle click

The GMR Angle Click is a Click board™ that features the TLI5012B E1000, which is a pre-calibrated 360° angle sensor that detects the orientation of a magnetic field, made by Infineon. The GMR Angle click is ideal for angular position sensing in industrial and consumer applications such as electrical commutated motor (e.g. BLDC), fans or pumps.

click Product page


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : SPI type

Software Support

We provide a library for the GmrAngle 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for GmrAngle Click driver.

Standard key functions :

Example key functions :

Examples Description

This is an example which demonstrates the use of GMR Angle Click board.

The demo application is composed of two sections :

Application Init

Initializes GPIO pins, SPI and LOG modules.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
GMRANGLE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
gmrangle_init( &gmrangle, &cfg );
log_printf( &logger, "---------------------\r\n" );
log_printf( &logger, " GMR Angle Click\r\n" );
log_printf( &logger, "---------------------\r\n" );
log_printf( &logger, " Start\r\n" );
log_printf( &logger, "---------------------\r\n" );
Delay_ms( 100 );
}

Application Task

Display angle value in degrees. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 300 msec.

void application_task ( void )
{
angle = gmrangle_calculate_angle( &gmrangle );
log_printf( &logger, " Angle is %.1f\r\n", angle );
Delay_ms( 300 );
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.GmrAngle

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


GMRANGLE_SET_DATA_SAMPLE_EDGE
#define GMRANGLE_SET_DATA_SAMPLE_EDGE
Data sample selection.
Definition: gmrangle.h:159
gmrangle_write_data
void gmrangle_write_data(gmrangle_t *ctx, uint8_t reg, uint16_t tx_data)
Generic write 16-bit data function.
application_task
void application_task(void)
Definition: main.c:68
gmrangle_read_data
uint16_t gmrangle_read_data(gmrangle_t *ctx, uint8_t reg)
Generic read 16-bit data function.
application_init
void application_init(void)
Definition: main.c:35
gmrangle_init
err_t gmrangle_init(gmrangle_t *ctx, gmrangle_cfg_t *cfg)
Initialization function.
gmrangle_cfg_setup
void gmrangle_cfg_setup(gmrangle_cfg_t *cfg)
Config Object Initialization function.
gmrangle_cfg_t
Click configuration structure definition.
Definition: gmrangle.h:193
gmrangle_t
Click ctx object definition.
Definition: gmrangle.h:173
GMRANGLE_MAP_MIKROBUS
#define GMRANGLE_MAP_MIKROBUS(cfg, mikrobus)
Definition: gmrangle.h:64
gmrangle_calculate_angle
float gmrangle_calculate_angle(gmrangle_t *ctx)
Calculate angle function.