Beginner
10 min

Convert a higher input voltage to a lower output voltage with TPS62902 and PIC18F27K42

Synchronous DC-DC step-down voltage converter

Step Down 12 Click with EasyPIC v8

Published Nov 20, 2024

Click board™

Step Down 12 Click

Dev. board

EasyPIC v8

Compiler

NECTO Studio

MCU

PIC18F27K42

Achieve stable DC-DC conversion with precise voltage control perfect for factory automation, data centers, and motor drives

A

A

Hardware Overview

How does it work?

Step Down 12 Click is based on the TPS62902, a synchronous step-down DC-DC converter from Texas Instruments. This converter uses the DCS-Control topology, an advanced control architecture that merges the strengths of hysteretic, voltage mode, and current mode control. DCS-Control enables rapid response to output voltage changes by sending feedback to a fast comparator stage, ensuring constant switching frequency under stable conditions and fast adaptability during dynamic load changes. This Click board™ accommodates a wide input voltage range from 3V to 17V through its VIN terminal, making it suitable for various standard power sources, including 12V supply lines, single or multiple Li-Ion cells, and 5V or 3.3V rails. It is suitable for numerous use cases, including factory automation, building automation, data center systems, enterprise computing, motor

drive applications, and beyond. It is designed with precision and delivers an output voltage accuracy of ±1% due to its DCS-Control-based regulation. Additionally, the TPS62902 enters power save mode during light loads to maximize efficiency, backed by a low quiescent current of just 4µA, ideal for energy-conscious applications. This Click board™ integrates the MCP4661, enabling the host MCU to configure 16 fixed output voltages on the VOUT terminal, adjustable from 0.7V to 5.5V. The MCP4661 communicates through a 2-wire I2C interface that supports clock speeds up to 3.4MHz, with I2C addresses adjustable via the onboard ADDR SEL jumpers. The MD pin allows users to select the TPS62902’s operational mode, enabling flexible configuration. This pin offers options for fixed PWM or automatic PFM/PWM mode with AEE functionality and settings for switching frequency,

internal/external feedback, output discharge, and PFM/PWM selection. The EN pin functions as the converter’s enable control, while the PG (Power Good) pin is an open-drain signal to confirm if the output voltage has reached its target. It also indicates when the device is turned off due to undervoltage lockout (UVLO) or thermal shutdown, enhancing system protection and operational feedback. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

Step Down 12 Click hardware overview image

Features overview

Development board

EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 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 v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

28

RAM (Bytes)

8192

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Mode Selection
RA0
RST
ID COMM
RA5
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Device Enable
RC1
PWM
Power-Good Indicator
RB1
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RC3
SCL
I2C Data
RC4
SDA
Power Supply
5V
5V
Ground
GND
GND
2

Take a closer look

Click board™ Schematic

Step Down 12 Click Schematic schematic

Step by step

Project assembly

EasyPIC v8 front image hardware assembly

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

EasyPIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyPIC v8 Access DIPMB 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
Necto image step 8 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

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for Step Down 12 Click driver.

Key functions:

  • stepdown12_get_pg_pin - This function returns the power good (PG) pin logic state.

  • stepdown12_set_vout - This function sets the voltage output by setting the digipot wiper resistance.

  • stepdown12_enable_device - This function enables the device by setting the EN pin to high logic state.

Open Source

Code example

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.

/*!
 * @file main.c
 * @brief Step Down 12 Click example
 *
 * # Description
 * This example demonstrates the use of Step Down 12 Click board by
 * changing the output voltage every 3 seconds.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the Click default configuration.
 *
 * ## Application Task
 * Changes the output voltage every 3 seconds from MAX (5.5V) to MIN (1.05V) in steps of 0.5V
 * and displays the currently set voltage output value on the USB UART. It also monitors
 * the power good fault indication.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "stepdown12.h"

static stepdown12_t stepdown12;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    stepdown12_cfg_t stepdown12_cfg;  /**< Click config object. */

    /** 
     * 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.
    stepdown12_cfg_setup( &stepdown12_cfg );
    STEPDOWN12_MAP_MIKROBUS( stepdown12_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == stepdown12_init( &stepdown12, &stepdown12_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    stepdown12_default_cfg ( &stepdown12 );
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    static float vout = STEPDOWN12_VOUT_MAX;

    if ( !stepdown12_get_pg_pin ( &stepdown12 ) )
    {
        log_error( &logger, " Power Good Fault - Vout is below nominal regulation\r\n" );
    }

    if ( STEPDOWN12_OK == stepdown12_set_vout ( &stepdown12, vout ) )
    {
        log_printf( &logger, " Vout: %.3f V\r\n\n", vout );
        vout -= 0.5;
        if ( vout < STEPDOWN12_VOUT_MIN )
        {
            vout = STEPDOWN12_VOUT_MAX;
        }
    }
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

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

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.