Intermediate
30 min

Maintain power continuity and ensure optimal performance with TPS2115A and PIC32MZ2048EFM100

Continuous power, Zero hassle: Experience seamless transition with us

Power MUX Click with Curiosity PIC32 MZ EF

Published Oct 10, 2023

Click board™

Power MUX Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

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 PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Control Signal 0
RA9
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
RPE8
PWM
Power Switch Status
RF13
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 PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity PIC32 MZ EF MB 1 Access - 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
Curiosity PIC32 MZ EF MCU Step 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 via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

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
 * Changes power inputs every 3 seconds and displays the currently set mode on the USB UART.
 *
 * @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 powermux_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 " );
}

void application_task ( void ) 
{
    log_printf( &logger, " OUTPUT : IN1\r\n\n" );
    powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_1_ON );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    log_printf( &logger, " OUTPUT : IN2\r\n\n" );
    powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_2_ON );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    log_printf( &logger, " OUTPUT : OFF\r\n\n" );
    powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_OFF );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    log_printf( &logger, " OUTPUT : AUTO\r\n\n" );
    powermux_set_mode( &powermux, POWERMUX_INPUT_CHANNEL_AUTO );
    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.