PINMUX and PAD

PAD Demo Code Support List

This chapter introduces the details of the PAD demo code.

PAD Demo for Wake Up Function

The description of PAD demo code 1 is shown in the following table.

PAD Demo Code 1 Description

Demo 1

dlps_gpio_wk_demo.c

Sample Purpose

Demonstrates how PAD wakes up the system from DLPS mode.

Brief Introduction

This sample code demonstrates how PAD wakes up the system. TEST_Pin is set to low-level wake-up. The system will enter DLPS mode automatically while it’s in idle state. When TEST_Pin is pulled down to low level, the system is woken up.

File Path

sdk\src\sample\io_demo\dlps\dlps_gpio_wk_demo.c

Function Entry

dlps_gpio_wk_demo()

Pin Definition

#define TEST_Pin P0_0

Hardware Connection

When the system needs to be woken up, connect M0_0 to GND on EVB.

Expected Result

  1. Press the Reset button on the EVB, the string dlps_store: enter dlps will be printed in Debug Analyzer, and the system will enter DLPS mode.

  2. Then connect M0_0 to GND, the system will be woken up and print the string dlps_restore: exit dlps in Debug Analyzer.

PAD Demo for Interrupt Mode

The description of PAD demo code 2 is shown in the following table.

PAD Demo Code 2 Description

Demo 2

pad_int_demo.c

Sample Purpose

Demonstrates PAD interrupt mode to realize key detection.

Brief Introduction

This sample code demonstrates key detection by PAD interrupt mode. When the button is pressed (such as P1_0 changing from high level to low level), the low level of the pin is detected, and the system handler is triggered. Then switch the level trigger, after the button is released (P1_0 changes from low level to high level), the system handler is triggered again.

File Path

sdk\src\sample\io_demo\gpio\interrupt\pad_int_demo.c

Function Entry

pad_int_demo()

GPIO Direction

Input Mode

Hardware Connection

On EVB, connect P1_0, P1_1, P2_1, P2_2 to KEY1 ~ KEY4 respectively.

Pin Definition

#define GPIO_DEMO_INPUT_PIN0     P1_0

#define GPIO_DEMO_INPUT_PIN1     P1_1

#define GPIO_DEMO_INPUT_PIN2     P2_1

#define GPIO_DEMO_INPUT_PIN3     P2_2

Expected Result

Press the Reset button on the EVB. Press KEY1: system_handler: pin0 interrupt triggered, pin_0_state 0 will be printed in Debug Analyzer. Release KEY1: system_handler: pin0 interrupt triggered, pin_0_state 1 will be printed in Debug Analyzer.

Functional Overview

PINMUX is an abbreviation for pin multiplexing. Because the SoC has a limited number of pins, pin multiplexing allows the SoC to use the limited pins for various functions, such as SPI, I2C, and GPIO.

PAD is used to control the behavior of a pin, such as pull-up or pull-down, output high or low level, and wake-up functions.

As shown in the figure below. The PINMUX circuit and IO modules are in the core domain and will be powered down during low power mode, so they cannot work during low power mode. The PAD circuit is in the AON domain and will not be powered down during low power mode, so the PAD can work normally during low power mode. The PAD is mainly used to maintain the pin output state or wake up the system in low power mode.

The PAD can be configured as PINMUX mode and software mode. Only when the PAD is set to PINMUX mode, can this pin be connected to the core domain to achieve pin multiplexing.

../../../_images/Schematic_Diagram_of_PINMUX_and_PAD_Circuit.png

Schematic Diagram of PINMUX and PAD Circuit

Feature List

  • Two operating modes: PINMUX mode and software mode.

  • Configurable pin pull-up or pull-down resistors.

  • Configurable pin independently output high or low level in software mode.

  • Keep power during DLPS/power down mode, powered off in ship mode.

  • Wake up the system from DLPS and power down mode from high or low triggers on all the pins.

Hybrid PAD Usage

The hybrid PAD can be configured in digital mode or analog mode. Configure the mode of the hybrid PAD by calling Pad_AnalogMode() function.

/* Configure MIC1_P as analog mode */
Pad_AnalogMode(MIC1_P, PAD_ANALOG_MODE);

When the hybrid PAD is configured in digital mode (GPIO, I2C, etc), the AVCCDRV always on option needs to be configured as Always active on the MCUConfig Tool.

../../../_images/Set_AVCCDRV_always_on_option.png

Set AVCCDRV Always On Option

Note

  1. RTL87x3D hybrid PAD: LOUT_N, P_UART, ROUT_N, ROUT_P, MIC1_N, MIC1_P, MIC2_N, MIC2_P, MIC3_N, MIC3_P, MIC4_N, MIC4_P, MIC5_N, MIC5_P, MIC6_N, MIC6_P, AUX_R, AUX_L, MICBIAS.

  2. RTL87x3E hybrid PAD: AUX_R, AUX_L, MIC1_P, MIC1_N, MIC2_P, MIC2_N, MICBIAS, LOUT_P, LOUT_N, ROUT_P, ROUT_N, MIC3_P, MIC3_N.

  3. RTL87x3EP hybrid PAD: DAOUT_P, DAOUT_N, MIC1_P, MIC1_N, MIC2_P, MIC2_N, MICBIAS.