This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430FR5969:使用 TIMERA &amp 时出现问题;LPM3.5

Guru**** 2535750 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/861585/msp430fr5969-problems-when-using-timera-lpm3-5

器件型号:MSP430FR5969

你好。  

1) 1)我想使用 TIMERA 比较中断从 lpm3.5唤醒。   有可能吗?

2) 2)下面是我的代码。 它有问题。 LED 不闪烁。 我想它不会进入 LPM3.5。

当我调试它时、它会跳转到一个名为"boot.c"的文件。 我将其放在代码下方。  我不知道该怎么做。

我希望你能帮助我。

此致

zzx

#include "driverlib.h"

#define COMPARE_VALUE 50000

void main (void)
{
//停止 WDT
WDT_A_HOLD (WDT_A_base);

init_gpio();

//以 SMCLK 为源的连续模式中的启动定时器
Timer_A_initContinuousModeParam initContParam ={0};
initContParam.clockSource = TIMER_A_CLOCKSOURCE_ACLK;
initContParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_divider;
initContParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;
initContParam.timerClear = timer_a_do _clear;
initContParam.startTimer = false;//是否立即启动计时器。
Timer_A_initContinuousMode (timer_A1_base、&initContParam);//"timer_A1_base"定时器_A 模块的基址

//Initialaze 比较模式(清除捕获-比较中断标志)
Timer_A_clearCaptureCompareInterrupt (timer_A1_base、
timer_A_CAPTUREACMPARE 寄存器0
);

Timer_A_initCompareModeParam initCompParam ={0};
initCompParam.compareRegister = TIMER_A_CAPTURECMPARE 寄存器_0;
initCompParam.compareInterruptEnable = TIMER_A_CAPTURECMPARE INTERRUPT_ENABLE;
initCompParam.compareOutputMode = TIMER_A_OUTPUTMODE_OUTBITVALUE;
initCompParam.compareValue = COMPARE_VALUE;
Timer_A_initCompareMode (timer_A1_base、&initCompParam);

Timer_A_startCounter (timer_A1_base、
Timer_A_Continuous_mode
);

//在器件进入时请求禁用内核电压稳压器
// LPM3 (或 LPM4)以便我们可以有效地进入 LPM3.5 (或 LPM4.5)。
PMM_TurnOffRegulator ();

//Enter LPM0、启用中断
_bis_SR_register (LPM4_bits + GIE);

//用于调试器
__NO_OPERAT();
}//*********


//
//这是 Timer1_A3中断矢量服务例程。
////
*********
#if defined (__TI_Compiler_version__)|| defined (__IAR_systems_ICC__)
#pragma vector=Timer1_A0_vector
__interrupt
#elif defined (__GNU__)
__attribute__(INTERRUPT (Timer1_A0_vector)))#endif Timer1_A0

ISR (void)

uint16_t compVal = Timer_A_getCaptureCompareCount (timer_A1_base、
Timer_A_CAPTURECOMPARE 寄存器0)
+ COMPARE_VALUE;


//切换 P1.0
GPIO_toggleOutputOnPin (GPIO_PORT_P1、GPIO_PIN0);
// GPIO_toggleOutputOnPin (GPIO_PORT_P4、GPIO_PIN6);

//将偏移添加到 CCR0
Timer_A_setCompareValue (timer_A1_base、
Timer_A_CAPTURECMPARE 寄存器0、
COMPVal
);
}

/*
GPIO 初始化
*/
void Init_GPIO()
{
//将所有 GPIO 引脚设置为输出低电平以实现低功耗
GPIO_setOutputLowOnPin (GPIO_PORT_P1、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN4|GPIO_PIN5|GPIO_PIN6|GPIO_PIN7);
GPIO_setOutputLowOnPin (GPIO_PORT_P2、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN4|GPIO_PIN5|GPIO_PIN6|GPIO_PIN7);
GPIO_setOutputLowOnPin (GPIO_PORT_P3、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN4|GPIO_PIN5|GPIO_PIN6|GPIO_PIN7);
GPIO_setOutputLowOnPin (GPIO_PORT_P4、GPIO_PIN0|GPIO_PIN1|GPIO_PIN2|GPIO_PI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IO_PIN_PIN12


//将 P1.0设置为输出方向
GPIO_setAsOutputPin (GPIO_PORT_P1、GPIO_PIN0);
// GPIO_setAsOutputPin (GPIO_PORT_P4、GPIO_PIN6);


//禁用 GPIO 上电默认高阻抗模式
//激活先前配置的端口设置
PMM_unlockLPM5 ();
}