Intermediate
30 min

Maintain power continuity and ensure optimal performance with TPS2115A and PIC18F47K42

Continuous power, Zero hassle: Experience seamless transition with us

Power MUX Click with Curiosity HPC

Published Nov 01, 2023

Click board™

Power MUX Click

Dev Board

Curiosity HPC

Compiler

NECTO Studio

MCU

PIC18F47K42

Our power multiplexer is engineered to revolutionize the way your systems manage power, seamlessly transitioning between dual power sources for uninterrupted operation, even in the face of unexpected failures

A

A

Hardware Overview

How does it work?

Power MUX Click is based on the TPS2115A, an auto-switching power multiplexer that enables transition between two power supplies, each operating at 2.8V to 5.5V voltage that comes from Texas Instruments. This Click board™ has two power switch inputs: primary and secondary. The IN1 switch can be enabled only if the IN1 supply is above the UVLO (under-voltage lockout) threshold, at least one supply exceeds the internal VDD UVLO, while the IN2 switch is enabled when the IN2 supply is above the UVLO threshold, and at least one supply exceeds the internal VDD UVLO. In auto-switching mode, pin D0 equals logic 1, and D1 pin equals logic 0, which means that this circuit will connect IN1 to OUT until the voltage at IN1 falls below a user-specified value. Once the voltage on IN1 falls below this value, the TPS2115A will select the higher of the two supplies. This usually means that the TPS2115A will swap to IN2. In manual

switching mode, pin D0 equals logic 0, and the multiplexer selects between two power supplies based on the D1 logic signal. OUT connects to IN1 if D1 is logic 1; otherwise, OUT connects to IN2. The logic thresholds for the D1 terminal are compatible with both TTL and CMOS logic. There is also interrupt pin STAT that is Hi-Z if the IN2 switch is ON, while STAT goes low if the IN1 switch is ON or OUT is Hi-Z. The under-voltage lockout circuit causes the output OUT to go Hi-Z if the selected power supply does not exceed the IN1/IN2 UVLO or if neither of the supplies exceeds the internal VDD UVLO. The switching circuitry ensures that both power switches will never conduct simultaneously. A comparator monitors the gate-to-source voltage of each power FET and allows an FET to turn ON only if the gate-to-source voltage of the other FET is below the turn-on threshold voltage. When the TPS2115A switches from a higher voltage supply

to a lower voltage supply, current can flow back from the load capacitor into the lower voltage supply. To minimize such reverse conduction, the TPS2115A will only connect a supply to the output once the output voltage has fallen to within 100 mV of the supply voltage. Once the supply has been connected to the output, it will remain connected regardless of the output voltage. This ensures the reliable operation of the IC and the Click board™ itself. Power MUX Click does not use the power from the mikroBUS™ power rails, except 3.3V for the LED indicator and interrupt‘s pull-up resistor. More information about the TPS2115A can be found in the attached datasheet. 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.

Power MUX Click hardware overview image

Features overview

Development board

Curiosity HPC, standing for Curiosity High Pin Count (HPC) development board, supports 28- and 40-pin 8-bit PIC MCUs specially designed by Microchip for the needs of rapid development of embedded applications. This board has two unique PDIP sockets, surrounded by dual-row expansion headers, allowing connectivity to all pins on the populated PIC MCUs. It also contains a powerful onboard PICkit™ (PKOB), eliminating the need for an external programming/debugging tool, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, a set of indicator LEDs, push button switches and a variable potentiometer. All

these features allow you to combine the strength of Microchip and Mikroe and create custom electronic solutions more efficiently than ever. Each part of the Curiosity HPC development board contains the components necessary for the most efficient operation of the same board. An integrated onboard PICkit™ (PKOB) allows low-voltage programming and in-circuit debugging for all supported devices. When used with the MPLAB® X Integrated Development Environment (IDE, version 3.0 or higher) or MPLAB® Xpress IDE, in-circuit debugging allows users to run, modify, and troubleshoot their custom software and hardware

quickly without the need for additional debugging tools. Besides, it includes a clean and regulated power supply block for the development board via the USB Micro-B connector, alongside all communication methods that mikroBUS™ itself supports. Curiosity HPC development board allows you to create a new application in just a few steps. Natively supported by Microchip software tools, it covers many aspects of prototyping thanks to many number of different Click boards™ (over a thousand boards), the number of which is growing daily.

Curiosity HPC double image

Microcontroller Overview

MCU Card / MCU

PIC18F47K42

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

8192

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Control Signal 0
RD0
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Control Signal 1
RC2
PWM
Power Switch Status
RB5
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Power MUX Click Schematic schematic

Step by step

Project assembly

Curiosity HPC front no-mcu image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity HPC as your development board.

Curiosity HPC front no-mcu image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 40 hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity HPC 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 image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for Power MUX Click driver.

Key functions:

  • powermux_int_pin_read - Power MUX pin reading function

  • powermux_set_mode - Power MUX mode set function

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 main.c
 * @brief Power MUX Click Example.
 *
 * # Description
 * This Click features power multiplexer that enables transition between two power supplies, 
 * each operating at 2.8V to 5.5V and delivering up to 2A current depending on the package.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Enables GPIO and starts write log.
 *
 * ## Application Task
 * Waits for user input in order to change input mode of the Power MUX Click. 
 *
 * @author Mikroe Team
 *
 */

#include "board.h"
#include "log.h"
#include "powermux.h"

static powermux_t powermux;   /**< Power MUX Click driver object. */
static log_t logger;    /**< Logger object. */

void application_init ( void ) 
{
    log_cfg_t log_cfg;
    powermux_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.
    powermux_cfg_setup( &powermux_cfg );
    POWERMUX_MAP_MIKROBUS( powermux_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == powermux_init( &powermux, &powermux_cfg ) ) {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    powermux_default_cfg ( &powermux );
    
    log_info( &logger, " Application Task " );
    log_printf( &logger, "-----------------------------\r\n " );
    log_printf( &logger, "      Select mode:           \r\n " );
    log_printf( &logger, "-----------------------------\r\n " );
    log_printf( &logger, " 1. Input from channel 1.    \r\n " );
    log_printf( &logger, " 2. Input from channel 2.    \r\n " );
    log_printf( &logger, " 3. Input OFF.               \r\n " );
    log_printf( &logger, " 3. Auto mode.               \r\n " );
    log_printf( &logger, "-----------------------------\r\n " );
}

void application_task ( void ) 
{
    char uart_char;
    if ( log_read( &logger, &uart_char, 1 ) ) {
        switch ( uart_char ) {
            case '1' : {
                log_printf( &logger, " Output mode : Input channel 1 \r\n " );
                powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_1_ON );
                log_printf( &logger, "-----------------------------\r\n " );
                break;
            }
            case '2' : {
                log_printf( &logger, " Output mode : Input channel 2 \r\n " );
                powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_2_ON );
                log_printf( &logger, "-----------------------------\r\n " );
                break;
            }
            case '3' : {
                log_printf( &logger, " Output mode : Input channels OFF \r\n " );
                powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_OFF );
                log_printf( &logger, "-----------------------------\r\n " );
                break;
            }
            case '4' : {
                log_printf( &logger, " Output mode : AUTO \r\n " );
                powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_AUTO );
                log_printf( &logger, "-----------------------------\r\n " );
                break;
            }
            default : {
                log_printf( &logger, "      Select mode: \r\n " );
                log_printf( &logger, "-----------------------------\r\n " );
                log_printf( &logger, " 1. Input from channel 1. \r\n " );
                log_printf( &logger, " 2. Input from channel 2. \r\n " );
                log_printf( &logger, " 3. Input OFF. \r\n " );
                log_printf( &logger, " 3. Auto mode. \r\n " );
                log_printf( &logger, "-----------------------------\r\n " );
                break;
            }
        }
    }
}

void main ( void ) 
{
    application_init( );

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

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

Additional Support

Resources