Intermediate
30 min

Handle demanding power requirements easily with MIC45404 and PIC18LF46K22

Bucktastic performance!

Buck 2 Click with EasyPIC v7

Published Jul 30, 2023

Click board™

Buck 2 Click

Dev Board

EasyPIC v7

Compiler

NECTO Studio

MCU

PIC18LF46K22

Embrace the future of power efficiency with our high-efficiency buck regulator that streamlines voltage conversion and sets new standards for sustainable electronics

A

A

Hardware Overview

How does it work?

Buck 2 Click is based on the MIC45404, a 19V 5A ultra-low profile DC-to-DC power module by Microchip. This IC is a valley current mode controlled power module, meaning it has a faster response than the traditional peak current mode control, thus a better response to transients. This IC requires minimal external components, making the whole device robust and easy to work with. Unlike traditional switching regulators, this one does not require external feedback components - it is enough to connect the OUTSNS pin to the output voltage directly. This allows for more accurate control over the voltage regulation. Buck 2 click allows configuring certain working parameters, such as the output voltage, current limit threshold, and PWM switching frequency, by changing the states of the dedicated pins. Those pins are routed to the mikroBUS™ socket or equipped with the SMD jumpers so the end user can set them. These pins can be set to the GND, VCC, or left afloat - high impedance mode (HIGH-Z). They are sampled when the internal voltage is stabilized, and their state is latched - further changes will not affect the selected configuration. The output voltage level is selected by the VOSET0 and VOSET1 pins of the MIC45404 IC, routed to the

mikroBUS™ AN and RST pins, respectively. This gives a total of nine possible voltage level combinations. The FREQ pin can change the PWM switching frequency, routed to the PWM pin of the mikroBUS™ socket. The switching frequency is related to the selected output voltage. For this reason, it is routed to the mikroBUS™ socket so that the voltage output and the corresponding frequency for the selected voltage can be set. There are three possible frequency values: 400kHz, 565kHz, and 790kHz. The onboard SMD jumper selects the current limiting, labeled as ILIM SEL. Limiting the current to 3A, 4A, and 5A is possible. The current limiting is instantaneous, and the MIC45404 IC offers current limit and current sensing on both high-side and low-side internal MOSFET switches. It also features a special Hiccup mode, which reduces power dissipation in prolonged overload or short circuit situations. The internal counter is incremented when a low-end MOSFET current limiting event occurs. A PWM cycle with no low-end MOSFET limiting events will decrease the internal counter. If the internal counter reaches 0Fh, both MOSFETs will be tri-stated, and the power to the output will be cut off. After a predetermined wait time has expired,

the MIC45404 IC will be restarted and attempt a new soft-startup sequence. This mechanism ensures that no false overload events are generated. The EN/DLY pin is used to enable the device. A HIGH logic level on this pin will start up the internal sections of the MIC45404 IC. This pin is routed to the mikroBUS™ CS pin, and since it is in an open drain configuration, it is pulled by the resistor to the GND. The PG pin indicates the power good condition of the output. When the voltage on the output (OUTSNS) drops under 90% of the regulated voltage, this pin is set to a LOW logic level, indicating irregular output voltage. An onboard pull-up resistor pulls This pin to a HIGH logic level since it is configured as the open drain output. It is routed to the mikroBUS™ INT pin. Buck 2 click is equipped with two screw terminals to connect the input voltage source and the output load. The input voltage source is selectable between the +5V rail from the mikroBUS™ and the voltage at the input terminal. It also has an onboard LOGIC SEL SMD jumper, used to set up the logic voltage level so that both 3.3V and 5V capable MCUs can be used. 

Buck 2 Click hardware overview image

Features overview

Development board

EasyPIC v7 is the seventh generation of PIC development boards specially designed to develop embedded applications rapidly. It supports a wide range of 8-bit PIC microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB-B. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyPIC v7 allows you to connect accessory boards, sensors, and custom electronics more efficiently than ever. Each part of

the EasyPIC v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use various external power sources, including an external 12V power supply, 7-23V AC or 9-32V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B) connector. Communication options such as

USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from PIC10F, PIC12F, PIC16F, PIC16Enh, PIC18F, PIC18FJ, and PIC18FK families. EasyPIC v7 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyPIC v7 horizontal image

Microcontroller Overview

MCU Card / MCU

PIC18LF46K22

Architecture

PIC

MCU Memory (KB)

64

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

3896

Used MCU Pins

mikroBUS™ mapper

VOSET0 input
RA2
AN
VOSET1 input
RE1
RST
Enable
RE0
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
FREQ input
RC0
PWM
Power Good Indicator
RB0
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

Buck 2 Click Schematic schematic

Step by step

Project assembly

EasyPIC v7 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v7 as your development board.

EasyPIC v7 front image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyPIC v7 Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
EasyPIC PRO v7a Display Selection Necto Step hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for Buck 2 Click driver.

Key functions:

  • buck2_set_output_voltage - Function settings output voltage

  • buck2_get_power_good - Function reads state PG pin

  • buck2_set_power_mode - Function settings chip mode

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief Buck 2 Click example
 * 
 * # Description
 * This application demonstrates the use of Buck 2 Click board.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes the driver and configures the click board.
 * 
 * ## Application Task  
 * Sets a different output voltage every 5 seconds then checks if the voltage on 
 * the output (OUTSNS) drops under 90% of the regulated voltage 
 * and displays an appropriate message on USB UART.
 * 
 * \author Katarina Perendic
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "buck2.h"

// ------------------------------------------------------------------ VARIABLES

static buck2_t buck2;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    buck2_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    buck2_cfg_setup( &cfg );
    BUCK2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    buck2_init( &buck2, &cfg );

    buck2_default_cfg( &buck2 );
}

void application_task ( void )
{
    uint8_t pg_state;

    buck2_set_output_voltage( &buck2, BUCK2_SET_VOLTAGE_3300mV );
    log_printf( &logger, "---- Output voltage is 3300 mV ----\r\n" );
    Delay_ms( 5000 );
    pg_state = buck2_get_power_good( &buck2 );
    if ( pg_state == 0 )
    {
        log_info( &logger, "---- Voltage of the output dropped under 90%% of the regulated voltage ----" );
    }
    buck2_set_output_voltage( &buck2, BUCK2_SET_VOLTAGE_2500mV );
    log_printf( &logger, "---- Output voltage is 2500 mV ----\r\n" );
    Delay_ms( 5000 );
    pg_state = buck2_get_power_good( &buck2 );
    if ( pg_state == 0 )
    {
        log_info( &logger, "---- Voltage of the output dropped under 90%% of the regulated voltage ----" );
    }
    buck2_set_output_voltage( &buck2, BUCK2_SET_VOLTAGE_1800mV );
    log_printf( &logger, "---- Output voltage is 1800 mV ----\r\n" );
    Delay_ms( 5000 );
    pg_state = buck2_get_power_good( &buck2 );
    if ( pg_state == 0 )
    {
        log_info( &logger, "---- Voltage of the output dropped under 90%% of the regulated voltage ----" );
    }
    buck2_set_output_voltage( &buck2, BUCK2_SET_VOLTAGE_1500mV );
    log_printf( &logger, "---- Output voltage is 1500 mV ----\r\n" );
    log_printf( &logger, "-----------------------------------\r\n" );
    Delay_ms( 5000 );
    pg_state = buck2_get_power_good( &buck2 );
    if ( pg_state == 0 )
    {
        log_info( &logger, "---- Voltage of the output dropped under 90%% of the regulated voltage ----" );
    }
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources