Update repo
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="lpm_ex1_idlewake_gpio"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../lpm_ex1_idlewake_gpio.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="lpm_ex2_idlewake_watchdog"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../lpm_ex2_idlewake_watchdog.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="lpm_ex3_standbywake_gpio"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../lpm_ex3_standbywake_gpio.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="lpm_ex4_standbywake_watchdog"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../lpm_ex4_standbywake_watchdog.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,231 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: lpm_ex1_idlewake_gpio.c
|
||||
//
|
||||
// TITLE: Idle entry and Exit example.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>Low Power Modes: Device Idle Mode and Wakeup using GPIO</h1>
|
||||
//!
|
||||
//! This example puts the device into IDLE mode and then wakes up the device
|
||||
//! from IDLE using XINT1 which triggers on a falling edge of GPIO0.
|
||||
//!
|
||||
//! The GPIO0 pin must be pulled from high to low by an external agent for
|
||||
//! wakeup. GPIO0 is configured as an XINT1 pin to trigger an XINT1 interrupt
|
||||
//! upon detection of a falling edge.
|
||||
//!
|
||||
//! Initially, pull GPIO0 high externally. To wake device from IDLE mode by
|
||||
//! triggering an XINT1 interrupt, pull GPIO0 low (falling edge). The wakeup
|
||||
//! process begins as soon as GPIO0 is held low for the time indicated in the
|
||||
//! device datasheet.
|
||||
//!
|
||||
//! GPIO1 is pulled high before entering the IDLE mode and is pulled low when
|
||||
//! in the external interrupt ISR.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - GPIO0 needs to be pulled low to wake up the device.
|
||||
//! - On device wakeup, the GPIO1 will be low and LED1 will start blinking
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void enterLPM();
|
||||
__interrupt void xint1ISR(void);
|
||||
|
||||
//
|
||||
// To avoid flash accesses, the function enterLPM and the ISR xint1ISR should
|
||||
// be run from RAM.
|
||||
// Note that the function SysCtl_enterIdleMode is defined inline. But this
|
||||
// example is built with opt_level=off which does not inline functions. To avoid
|
||||
// flash accesses, include SysCtl_enterIdleMode in .TI.ramfunc section (This is
|
||||
// not required if optimization level 0 or higher is used)
|
||||
//
|
||||
#pragma CODE_SECTION(enterLPM, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(xint1ISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_enterIdleMode, ".TI.ramfunc");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Configure PLL, disable WD, enable peripheral clocks.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// GPIO0 is the external wake-up source
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_IN);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setQualificationMode(0, GPIO_QUAL_ASYNC);
|
||||
|
||||
//
|
||||
// GPIO1 is an output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_GPIO1);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// LED pin configuration
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Configure GPIO0 as external wake source. The input XBAR is configured
|
||||
// to map the GPIO0 to the XINT1 using XBAR input 4
|
||||
//
|
||||
XBAR_setInputPin(INPUTXBAR_BASE, XBAR_INPUT4, 0);
|
||||
GPIO_setInterruptType(GPIO_INT_XINT1, GPIO_INT_TYPE_FALLING_EDGE);
|
||||
GPIO_enableInterrupt(GPIO_INT_XINT1);
|
||||
|
||||
//
|
||||
// Disable global interrupts.
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Initialize interrupt controller and vector table.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
IER = 0x0000;
|
||||
IFR = 0x0000;
|
||||
|
||||
//
|
||||
// Map the ISR to the XINT1 interrupt.
|
||||
//
|
||||
Interrupt_register(INT_XINT1, xint1ISR);
|
||||
|
||||
//
|
||||
// Enable the wake interrupt in the PIE: Group 1 interrupt 4.
|
||||
//
|
||||
Interrupt_enable(INT_XINT1);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
//
|
||||
// Enable global interrupts.
|
||||
//
|
||||
EINT;
|
||||
|
||||
//
|
||||
// Set GPIO1 high.
|
||||
//
|
||||
GPIO_writePin(1, 1);
|
||||
|
||||
//
|
||||
// Power down the flash and enter LPM
|
||||
//
|
||||
enterLPM();
|
||||
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Toggle LED1
|
||||
//
|
||||
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
|
||||
|
||||
//
|
||||
// 500ms delay
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// enterLPM() - This will power down the flash and enter LPM.
|
||||
//
|
||||
void enterLPM()
|
||||
{
|
||||
//
|
||||
// Power down the flash bank and pump. Ensure there are no subsequent
|
||||
// flash accesses.
|
||||
//
|
||||
Flash_powerDown(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Enter idle mode.
|
||||
//
|
||||
SysCtl_enterIdleMode();
|
||||
}
|
||||
|
||||
//
|
||||
// xint1ISR - External interrupt when GPIO0 is pulled from high to low.
|
||||
//
|
||||
__interrupt void
|
||||
xint1ISR(void)
|
||||
{
|
||||
//
|
||||
// Wake the flash from low power mode.
|
||||
//
|
||||
Flash_wakeFromLPM(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Set GPIO1 low.
|
||||
//
|
||||
GPIO_writePin(1, 0);
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,234 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: lpm_ex2_idlewake_watchdog.c
|
||||
//
|
||||
// TITLE: Idle entry and Exit example.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>Low Power Modes: Device Idle Mode and Wakeup using Watchdog</h1>
|
||||
//!
|
||||
//! This example puts the device into IDLE mode and then wakes up the device
|
||||
//! from IDLE using watchdog timer.
|
||||
//!
|
||||
//! The device wakes up from the IDLE mode when the watchdog timer overflows,
|
||||
//! triggering an interrupt.
|
||||
//! A pre scalar is set for the watchdog timer to change the counter overflow
|
||||
//! time.
|
||||
//!
|
||||
//! GPIO1 is pulled high before entering the IDLE mode and is pulled low when
|
||||
//! in the wakeup ISR.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - On device wakeup, the GPIO1 will be low and LED1 will start blinking
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void enterLPM();
|
||||
__interrupt void wakeupISR(void);
|
||||
|
||||
//
|
||||
// To avoid flash accesses, the function enterLPM and the ISR wakeupISR should
|
||||
// be run from RAM.
|
||||
// Note that the function SysCtl_enterIdleMode is defined inline. But this
|
||||
// example is built with opt_level=off which does not inline functions. To avoid
|
||||
// flash accesses, include SysCtl_enterIdleMode in .TI.ramfunc section (This is
|
||||
// not required if optimization level 0 or higher is used)
|
||||
//
|
||||
#pragma CODE_SECTION(enterLPM, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(wakeupISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_enterIdleMode, ".TI.ramfunc");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Configure PLL, disable WD, enable peripheral clocks.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// GPIO1 is an output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_GPIO1);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// LED pin configuration
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Disable global interrupts.
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Initialize interrupt controller and vector table.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
IER = 0x0000;
|
||||
IFR = 0x0000;
|
||||
|
||||
//
|
||||
// Re-map watchdog wake interrupt signal to call the ISR function in this
|
||||
// example
|
||||
//
|
||||
Interrupt_register(INT_WAKE, &wakeupISR);
|
||||
|
||||
//
|
||||
// Set the watchdog to generate an interrupt signal instead of a
|
||||
// reset signal
|
||||
//
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_INTERRUPT);
|
||||
SysCtl_setWatchdogPrescaler(SYSCTL_WD_PRESCALE_64);
|
||||
|
||||
//
|
||||
// Enable the wake interrupt in the PIE: Group 1 interrupt 8.
|
||||
//
|
||||
Interrupt_enable(INT_WAKE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
//
|
||||
// Enable global interrupts.
|
||||
//
|
||||
EINT;
|
||||
|
||||
//
|
||||
// Reset the watchdog counter
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
|
||||
//
|
||||
// Enable the watchdog
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Set GPIO1 high.
|
||||
//
|
||||
GPIO_writePin(1, 1);
|
||||
|
||||
//
|
||||
// Power down the flash and enter LPM
|
||||
//
|
||||
enterLPM();
|
||||
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Toggle LED1
|
||||
//
|
||||
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
|
||||
|
||||
//
|
||||
// 500ms delay
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
|
||||
//
|
||||
// Service watchdog
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// enterLPM() - This will power down the flash and enter LPM.
|
||||
//
|
||||
void enterLPM()
|
||||
{
|
||||
//
|
||||
// Power down the flash bank and pump. Ensure there are no subsequent
|
||||
// flash accesses.
|
||||
//
|
||||
Flash_powerDown(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Enter idle mode.
|
||||
//
|
||||
SysCtl_enterIdleMode();
|
||||
}
|
||||
|
||||
//
|
||||
// Wakeup ISR - The interrupt service routine called when the watchdog
|
||||
// triggers the wake interrupt signal
|
||||
//
|
||||
__interrupt void
|
||||
wakeupISR(void)
|
||||
{
|
||||
//
|
||||
// Wake the flash from low power mode.
|
||||
//
|
||||
Flash_wakeFromLPM(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Set GPIO1 low.
|
||||
//
|
||||
GPIO_writePin(1, 0);
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,239 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: lpm_ex3_standbywake_gpio.c
|
||||
//
|
||||
// TITLE: Standby entry and Exit example.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>Low Power Modes: Device Standby Mode and Wakeup using GPIO</h1>
|
||||
//!
|
||||
//! This example puts the device into STANDBY mode. If the lowest possible
|
||||
//! current consumption in STANDBY mode is desired, the JTAG connector must
|
||||
//! be removed from the device board while the device is in STANDBY mode.
|
||||
//!
|
||||
//! This example puts the device into STANDBY mode and then wakes up the device
|
||||
//! from STANDBY using an LPM wakeup pin.
|
||||
//!
|
||||
//! The pin GPIO0 is configured as the LPM wakeup pin to trigger a WAKEINT
|
||||
//! interrupt upon detection of a low pulse. Initially, pull GPIO0 high
|
||||
//! externally. To wake device from STANDBY mode, pull GPIO0 low for at least
|
||||
//! (2+QUALSTDBY), OSCLKS, then pull it high again.
|
||||
//!
|
||||
//! The example then wakes up the device from STANDBY using GPIO0.
|
||||
//! GPIO0 wakes the device from STANDBY mode when a low pulse
|
||||
//! (signal goes high->low->high)is detected on the pin.
|
||||
//! This pin must be pulsed by an external agent for wakeup.
|
||||
//!
|
||||
//! GPIO1 is pulled high before entering the STANDBY mode and is pulled low
|
||||
//! when in the wakeup ISR.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - GPIO0 needs to be pulled low to wake up the device.
|
||||
//! - On device wakeup, the GPIO1 will be low and LED1 will start blinking
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void enterLPM();
|
||||
__interrupt void wakeupISR(void);
|
||||
|
||||
//
|
||||
// To avoid flash accesses, the function enterLPM and the ISR wakeupISR should
|
||||
// be run from RAM.
|
||||
// Note that the function SysCtl_enterStandbyMode is defined inline. But this
|
||||
// example is built with opt_level=off which does not inline functions. To avoid
|
||||
// flash accesses, include SysCtl_enterStandbyMode in .TI.ramfunc section (This is
|
||||
// not required if optimization level 0 or higher is used)
|
||||
//
|
||||
#pragma CODE_SECTION(enterLPM, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(wakeupISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_enterStandbyMode, ".TI.ramfunc");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Configure PLL, disable WD, enable peripheral clocks.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// GPIO0 is the external wake-up source
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_IN);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_setQualificationMode(0, GPIO_QUAL_ASYNC);
|
||||
|
||||
//
|
||||
// GPIO1 is an output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_GPIO1);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// LED pin configuration
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Use GPIO0 to wake the CPU from standby.
|
||||
//
|
||||
SysCtl_enableLPMWakeupPin(0);
|
||||
|
||||
//
|
||||
// The wakeup signal should be (2+QUALSTBY) OSCCLKs wide
|
||||
//
|
||||
SysCtl_setStandbyQualificationPeriod(2);
|
||||
|
||||
//
|
||||
// Disable global interrupts.
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Initialize interrupt controller and vector table.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
IER = 0x0000;
|
||||
IFR = 0x0000;
|
||||
|
||||
//
|
||||
// Map the ISR to the wake interrupt. This would be triggered
|
||||
// when the LPM wake pin, mapped to the GPIO0 is pulled low.
|
||||
//
|
||||
Interrupt_register(INT_WAKE, wakeupISR);
|
||||
|
||||
//
|
||||
// Enable the wake interrupt in the PIE: Group 1 interrupt 8.
|
||||
//
|
||||
Interrupt_enable(INT_WAKE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
//
|
||||
// Enable global interrupts.
|
||||
//
|
||||
EINT;
|
||||
|
||||
//
|
||||
// Set GPIO1 high.
|
||||
//
|
||||
GPIO_writePin(1, 1);
|
||||
|
||||
//
|
||||
// Power down the flash and enter LPM
|
||||
//
|
||||
enterLPM();
|
||||
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Toggle LED1
|
||||
//
|
||||
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
|
||||
|
||||
//
|
||||
// 500ms delay
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// enterLPM() - This will power down the flash and enter LPM.
|
||||
//
|
||||
void enterLPM()
|
||||
{
|
||||
//
|
||||
// Power down the flash bank and pump. Ensure there are no subsequent
|
||||
// flash accesses.
|
||||
//
|
||||
Flash_powerDown(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Enter standby mode.
|
||||
//
|
||||
SysCtl_enterStandbyMode();
|
||||
}
|
||||
|
||||
//
|
||||
// wakeupISR - The interrupt service routine called when device wakes up
|
||||
//
|
||||
__interrupt void
|
||||
wakeupISR(void)
|
||||
{
|
||||
//
|
||||
// Wake the flash from low power mode.
|
||||
//
|
||||
Flash_wakeFromLPM(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Set GPIO1 low.
|
||||
//
|
||||
GPIO_writePin(1, 0);
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,246 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: lpm_ex4_standbywake_watchdog.c
|
||||
//
|
||||
// TITLE: Standby entry and Exit example.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>Low Power Modes: Device Standby Mode and Wakeup using Watchdog</h1>
|
||||
//!
|
||||
//! This example puts the device into STANDBY mode. If the lowest
|
||||
//! possible current consumption in STANDBY mode is desired, the
|
||||
//! JTAG connector must be removed from the device board while
|
||||
//! the device is in STANDBY mode.
|
||||
//!
|
||||
//! This example puts the device into STANDBY mode then wakes up
|
||||
//! the device from STANDBY using watchdog timer.
|
||||
//!
|
||||
//! The device wakes up from the STANDBY mode when the watchdog timer overflows
|
||||
//! triggering an interrupt. In the ISR, the GPIO1 is pulled low.
|
||||
//! the GPIO1 is toggled to indicate the device is out of STANDBY mode.
|
||||
//! A pre scalar is set for the watchdog timer to change the counter overflow
|
||||
//! time.
|
||||
//!
|
||||
//! GPIO1 is pulled high before entering the STANDBY mode and is pulled low
|
||||
//! when in the wakeup ISR.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - On device wakeup, the GPIO1 will be low and LED1 will start blinking
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void enterLPM();
|
||||
__interrupt void wakeupISR(void);
|
||||
|
||||
//
|
||||
// To avoid flash accesses, the function enterLPM and the ISR wakeupISR should
|
||||
// be run from RAM.
|
||||
// Note that the function SysCtl_enterStandbyMode is defined inline. But this
|
||||
// example is built with opt_level=off which does not inline functions. To avoid
|
||||
// flash accesses, include SysCtl_enterStandbyMode in .TI.ramfunc section (This is
|
||||
// not required if optimization level 0 or higher is used)
|
||||
//
|
||||
#pragma CODE_SECTION(enterLPM, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(wakeupISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_enterStandbyMode, ".TI.ramfunc");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Configure PLL, disable WD, enable peripheral clocks.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
|
||||
//
|
||||
// GPIO1 is an output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_GPIO1);
|
||||
GPIO_setDirectionMode(1,GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// LED pin configuration
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_LED1);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Watchdog is used to wake up from STANDBY mode
|
||||
//
|
||||
SysCtl_enableWatchdogStandbyWakeup();
|
||||
|
||||
//
|
||||
// Disable global interrupts.
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Initialize interrupt controller and vector table.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
IER = 0x0000;
|
||||
IFR = 0x0000;
|
||||
|
||||
//
|
||||
// Re-map watchdog wake interrupt signal to call the ISR function in this
|
||||
// example
|
||||
//
|
||||
Interrupt_register(INT_WAKE, &wakeupISR);
|
||||
|
||||
//
|
||||
// Set the watchdog to generate an interrupt signal instead of a
|
||||
// reset signal
|
||||
//
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_INTERRUPT);
|
||||
SysCtl_setWatchdogPrescaler(SYSCTL_WD_PRESCALE_64);
|
||||
|
||||
//
|
||||
// Enable the wake interrupt in the PIE: Group 1 interrupt 8.
|
||||
//
|
||||
Interrupt_enable(INT_WAKE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
//
|
||||
// Enable global interrupts.
|
||||
//
|
||||
EINT;
|
||||
|
||||
//
|
||||
// Reset the watchdog counter
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
|
||||
//
|
||||
// Enable the watchdog
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Set GPIO1 high.
|
||||
//
|
||||
GPIO_writePin(1, 1);
|
||||
|
||||
//
|
||||
// Power down the flash and enter LPM
|
||||
//
|
||||
enterLPM();
|
||||
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Toggle LED1
|
||||
//
|
||||
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
|
||||
|
||||
//
|
||||
// 500ms delay
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
|
||||
//
|
||||
// Service watchdog
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// enterLPM() - This will power down the flash and enter LPM.
|
||||
//
|
||||
void enterLPM()
|
||||
{
|
||||
//
|
||||
// Power down the flash bank and pump. Ensure there are no subsequent
|
||||
// flash accesses.
|
||||
//
|
||||
Flash_powerDown(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Enter standby mode.
|
||||
//
|
||||
SysCtl_enterStandbyMode();
|
||||
}
|
||||
|
||||
//
|
||||
// Wakeup ISR - The interrupt service routine called when the watchdog
|
||||
// triggers the wake interrupt signal
|
||||
//
|
||||
__interrupt void
|
||||
wakeupISR(void)
|
||||
{
|
||||
//
|
||||
// Wake the flash from low power mode.
|
||||
//
|
||||
Flash_wakeFromLPM(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Set GPIO1 low.
|
||||
//
|
||||
GPIO_writePin(1, 0);
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
Reference in New Issue
Block a user