buck24 2.2.0
Loading...
Searching...
No Matches
buck24


Buck 24 Click

Buck 24 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : May 2025.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of the Buck 24 Click board by monitoring the output voltage, current, and power via I2C communication. It also checks the Power-Good (PG) status pin to detect undervoltage conditions.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Buck24

Example Key Functions

  • buck24_cfg_setup This function initializes Click configuration structure to initial values.
    void buck24_cfg_setup(buck24_cfg_t *cfg)
    Buck 24 configuration object setup function.
    Buck 24 Click configuration object.
    Definition buck24.h:228
  • buck24_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t buck24_init ( buck24_t *ctx, buck24_cfg_t *cfg );
    err_t buck24_init(buck24_t *ctx, buck24_cfg_t *cfg)
    Buck 24 initialization function.
    Buck 24 Click context object.
    Definition buck24.h:208
  • buck24_default_cfg This function executes a default configuration of Buck 24 Click board.
    err_t buck24_default_cfg(buck24_t *ctx)
    Buck 24 default configuration function.
  • buck24_get_pg_pin This function reads the logic level of the PG (power-good) pin.
    uint8_t buck24_get_pg_pin ( buck24_t *ctx );
    uint8_t buck24_get_pg_pin(buck24_t *ctx)
    Buck 24 get power-good pin function.
  • buck24_read_data_avg This function reads multiple samples of measurement data and returns their average values.
    err_t buck24_read_data_avg ( buck24_t *ctx, uint16_t num_conv, buck24_data_t *data_out );
    err_t buck24_read_data_avg(buck24_t *ctx, uint16_t num_conv, buck24_data_t *data_out)
    Buck 24 read averaged measurement data function.
    Buck 24 Click data object.
    Definition buck24.h:182

Application Init

Initializes the logger and the Click board driver, and applies the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
buck24_cfg_t buck24_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
buck24_cfg_setup( &buck24_cfg );
BUCK24_MAP_MIKROBUS( buck24_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == buck24_init( &buck24, &buck24_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BUCK24_ERROR == buck24_default_cfg ( &buck24 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ BUCK24_ERROR
Definition buck24.h:247
#define BUCK24_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition buck24.h:194
void application_init(void)
Definition main.c:33

Application Task

Checks if the Power-Good (PG) pin is active and logs an undervoltage warning if triggered. Reads and logs the average voltage, current, and power values from the device every second.

void application_task ( void )
{
if ( !buck24_get_pg_pin ( &buck24 ) )
{
log_printf( &logger, " Undervoltage: below 90%% of nominal voltage\r\n" );
}
{
log_printf( &logger, " Voltage: %.3f V\r\n", buck.bus_v );
log_printf( &logger, " Current: %.3f A\r\n", buck.current );
log_printf( &logger, " Power: %.2f W\r\n\n", buck.power );
}
Delay_ms ( 1000 );
}
@ BUCK24_OK
Definition buck24.h:246
#define BUCK24_DEFAULT_NUM_CONV
Definition buck24.h:155
void application_task(void)
Definition main.c:69
float bus_v
Definition buck24.h:184
float power
Definition buck24.h:186
float current
Definition buck24.h:185

Note

Use an on-board VOUT SEL switch to select the buck output voltage level (1.0V, 1.8V, 2.5V, 3.3V).

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.