Intermediate
30 min

Take charge of operations and restore settings with ease using QT1011 and PIC32MZ2048EFH144

Command and Safeguard

Power/Reset Click with Fusion for PIC32 v8

Published Aug 09, 2023

Click board™

Power/Reset Click

Dev Board

Fusion for PIC32 v8

Compiler

NECTO Studio

MCU

PIC32MZ2048EFH144

Effortlessly control device states with the ON/OFF button and, when needed, utilize the RESET button to restore settings to default swiftly, ensuring efficient management and seamless operation

A

A

Hardware Overview

How does it work?

Power/Reset Click is based on the QT1011, a digital burst mode charge-transfer sensor capable of detecting proximity or touch from Microchip. This click board™ has two PCB pads to sense touch or proximity events. Besides the two touch-sensitive pads, Power/Reset click has two LEDs for the touch indication. The two touch pads use two separate QT1011 ICs, providing reliable touch-sensing functionality. The AT42QT1011 is a digital burst mode charge-transfer sensor capable of detecting proximity or touch, making it ideal for implementing touch controls. With the proper electrode and circuit design, the self-contained digital IC will project a touch or proximity field to several centimeters through any dielectric like glass, plastic, stone, ceramic, and even most kinds

of wood. It can also turn small metal-bearing objects into intrinsic sensors responsive to proximity or touch. This capability and its ability to self-calibrate can lead to entirely new product concepts. The QT1011 is designed for human interfaces like control panels, appliances, toys, lighting controls, or anywhere a mechanical switch or button may be found. It includes all hardware and signal processing functions necessary to provide stable sensing under various changing conditions. However, this click board™ is designed to serve as a power and reset capacitive switch panel board. Besides the QT1011, this click board™ contains 74LVC1G74 as well. It is a Single D-type flip-flop with set and reset. Because the output of the QT1011 is active-high upon detection, the

74LVC1G74 is triggered by the positive edge of the ON/OFF touchpad. It is wired in a cascade with the QT1011 in a way that ensures holding one logical state until the ON/OFF pad is pressed. Therefore, the ON/OFF pad acts like a switch, while the RESET pad acts like a button, which is suitable for most common purposes. The ON/OFF and RESET pad output signals are wired to the PWM and INT pins on the mikroBUS™, respectively. Besides that, the STAT and RST LEDs are wired parallel to the outputs to ensure a visible indication of the status of the pins. This Click board™ is designed to be operated only with a 3.3V logic level. A proper logic voltage level conversion should be performed before the Click board™ is used with MCUs with logic levels of 5V.

Power/Reset Click hardware overview image

Features overview

Development board

Fusion for PIC32 v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of Microchip's PIC32 microcontrollers regardless of their number of pins and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. 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, Fusion for PIC32 v8 provides a fluid and immersive working experience, allowing access anywhere and under any circumstances at any time. Each part of the

Fusion for PIC32 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 HOST/DEVICE, CAN (on the MCU card, if

supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for PIC32 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.

Fusion for PIC32 v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

144

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
ON/OFF Status
PB8
PWM
Reset Status
PD0
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/Reset Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for PIC32 v8 as your development board.

Fusion for PIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN 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 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

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 Power/Reset Click driver.

Key functions:

  • powerreset_get_pwr - Power Check function

  • powerreset_get_rst - Reset Check 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 
 * \brief Power Reset Click example
 * 
 * # Description
 * Reads PWR and RST pin states and performs a control of the timer counter depending on the pressed button.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes device and logger module, prints Initialization done message.
 * 
 * ## Application Task  
 * Checks the states of the PWR and RST pins and logs every change.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "powerreset.h"

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

static powerreset_t powerreset;
static log_t logger;

powerreset_state_t pwr_state;
powerreset_state_t rst_state;

powerreset_state_t new_pwr_state;
powerreset_state_t new_rst_state;

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

void application_init ( void )
{
    log_cfg_t log_cfg;
    powerreset_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.

    powerreset_cfg_setup( &cfg );
    POWERRESET_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    powerreset_init( &powerreset, &cfg );

    Delay_ms( 100 );
    
    log_printf( &logger, "** Touch Button initialization done **\r\n");
    log_printf( &logger, "**************************************\r\n");
}

void application_task ( void )
{
    new_pwr_state = powerreset_get_pwr( &powerreset );
    new_rst_state = powerreset_get_rst( &powerreset );
    
    if ( new_pwr_state != pwr_state )
    {
        if ( new_pwr_state == POWERRESET_ACTIVE )
        {
            log_printf( &logger, "POWER ON\r\n" );
            Delay_ms( 100 );
        }
        else if ( new_pwr_state == POWERRESET_INACTIVE )
        {
            log_printf( &logger, "POWER OFF\r\n" );
            Delay_ms( 100 );
        }
        pwr_state = new_pwr_state;
    }

    if ( new_rst_state != rst_state )
    {
        if ( new_rst_state == POWERRESET_ACTIVE )
        {
            log_printf( &logger, "Reset occured!\r\n" );
            Delay_ms( 100 );
        }
        rst_state = new_rst_state;
    }
}

void main ( void )
{
    application_init( );

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

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

Additional Support

Resources