charger27  2.1.0.0
Main Page

Charger 27 click

Charger 27 Click is a compact add-on board that provides a single-cell charging solution. This board features the MP2639B, a Li-Ion or Li-Polymer switching charger from MPS. It is a highly integrated, flexible switch-mode battery charging management device for a single-cell battery for various portable applications. It uses a 4.5V up to 16V external input voltage to provide up to 2A of programmable charging current.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Oct 2023.
  • Type : GPIO type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of the Charger 27 click board by enabling charge or discharge mode and indicating valid input supply and charging completion.

The demo application is composed of two sections :

Application Init

Initialization of GPIO module and log UART. After driver initialization, the app sets charge mode.

void application_init ( void )
{
log_cfg_t log_cfg;
charger27_cfg_t charger27_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
charger27_cfg_setup( &charger27_cfg );
CHARGER27_MAP_MIKROBUS( charger27_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == charger27_init( &charger27, &charger27_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_printf( &logger, " > Charge mode <\r\n" );
Delay_ms ( 100 );
}
}

Application Task

The demo application operates as a switching charger to charge a 1S battery from a wide input power range of 5V to 16V, which can cover a USB PD voltage level. The app also checks if the charging has been completed or is suspended. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
{
log_printf( &logger, " Charging.\r\n" );
Delay_ms ( 1000 );
}
else
{
log_printf( &logger, " Charging has completed or is suspended.\r\n" );
Delay_ms ( 1000 );
}
}

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

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.


charger27_cfg_t
Charger 27 Click configuration object.
Definition: charger27.h:126
charger27_t
Charger 27 Click context object.
Definition: charger27.h:113
charger27_check_chg_completion
uint8_t charger27_check_chg_completion(charger27_t *ctx)
Charger 27 checks charging completion indicator function.
CHARGER27_OK
@ CHARGER27_OK
Definition: charger27.h:139
charger27_set_mode
err_t charger27_set_mode(charger27_t *ctx, uint8_t mode)
Charger 27 sets the operating mode function.
charger27_init
err_t charger27_init(charger27_t *ctx, charger27_cfg_t *cfg)
Charger 27 initialization function.
charger27_cfg_setup
void charger27_cfg_setup(charger27_cfg_t *cfg)
Charger 27 configuration object setup function.
application_task
void application_task(void)
Definition: main.c:67
charger27_check_input_supply
uint8_t charger27_check_input_supply(charger27_t *ctx)
Charger 27 checks valid input supply indicator function.
CHARGER27_MODE_CHARGE
#define CHARGER27_MODE_CHARGE
Charger 27 charge or discharge mode selection.
Definition: charger27.h:67
CHARGER27_CHG_CHARGE
#define CHARGER27_CHG_CHARGE
Charger 27 charging completion indicator.
Definition: charger27.h:81
application_init
void application_init(void)
Definition: main.c:33
CHARGER27_MAP_MIKROBUS
#define CHARGER27_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: charger27.h:100