MKMxxZxxACxx5 Bare Metal Software Drivers  R4.1.6
Reference Manual
IRTC External LDO Regulator Control

This example shows capabilities of the IRTC module to control an external LDO regulator or PMOS transistor. The following figure shows typical connection of an external LDO regulator with MKM34Z256VLx7 device:

RTC_WAKEUP.bmp

The enable pin of the external LDO regulator is connected via 4.7M pull-up resistor to 3.3V. The WKUP/TAMPER0 pin of the MKM34Z256VLx7 device is configured in HiZ mode by default. When 3.3V is applied, the external 4.7M pull-up resistor drives enable signal of the LDO regulator to logic 1 and LDO regulator operates in normal mode. The MKM34Z256VLx7 device powers up and code starts to execute. After initializing PMC module, IRTC module and 1 second code execution, the code forces the external LDO regulator to standby mode by de-asserting WKUP/TAMPER0 pin. The IRTC module is initialized to transition WKUP/TAMPER0 pin back to HiZ state when TAMPER1 pin changes to logic 0 (TAMPER1 interrupt is generated).

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* irtchibernate_test.c
******************************************************************************/
#include "drivers.h"
void main (void)
{
/* Initialize IRTC module to allow controlling external LDO regulator. The */
/* WKUP/TAMPER0 pin transitions back to HiZ state when TAMPER1 pin changes */
/* to logic 0 (TAMPER1 interrupt is generated). */
arch_delay(2000000); /* do some processing ... */
IRTC_Hibernate (FORCE_PIN_LOG0); /* force WKUP/TAMPER0 pin to logic 0 */
while(1);
}
Toolchain support:
IAR EWARM 7.40.7CodeWarrior 10.6KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0