您好!
我们设计了采用 MSP430FR2476的电路板、该电路板在大多数时间都以低功耗模式运行。 RTC 中断每分钟从 LPM3模式唤醒一次控制器、如果控制器处于 LPM3.5模式、则每30分钟唤醒一次控制器以更新日期和时间。 控制器在无活动两小时后进入 LPM3.5。 通常、固件工作正常、日期/时间正确。 但有时(几天后)控制器不会从 LPM3.5唤醒。 只有复位才能再次启动控制器。 它们不应该是电源问题、因为电池已满、复位后、控制器再次正常工作。 不幸的是,无法以明确的方式追踪问题。 有时、它发生在一天之后、有时发生在几天后。
进入 LPM3.5的代码:
WDT_A_hold(WDT_A_BASE); // Disable Watchdog PMMCTL0_H = PMMPW_H; // Open PMM Registers for write PMMCTL0_L |= PMMREGOFF; // Disable power regulator __bis_SR_register(LPM3_bits + GIE); // Enter LPM3.5, with interrupts enabled __no_operation(); // Do nothing (just for debugging)
我们的初始化函数:
void BL_Init()
{
// Configure FRAM write protection
SYSCFG0 = PFWP | DFWP | FRWPPW | FRWPOA5 | FRWPOA4 | FRWPOA3 | FRWPOA2 | FRWPOA1 | FRWPOA0;
SysCtl_enableFRAMWrite(SYSCTL_FRAMWRITEPROTECTION_DATA | SYSCTL_FRAMWRITEPROTECTION_PROGRAM);
// Wake up routine according to datasheet section 1.4.3.3 (Wake up from LPM3.5)
// 1. Init RTC, but do not enable interrupts
// Get current time from ConfigReg
rtcTime_t currTimeBuf = GetConfigRegister().Timestamp;
__time64_t timeBuf;
ConvertToUTCTimeType(&timeBuf, &currTimeBuf);
// Initialize RTC with Deep Sleep Timings
RTC_init(RTC_BASE, (uint16_t) RTC_INT_DEEP_SLEEP_SECONDS * RTC_FREQUENCY, RTC_CLOCKPREDIVIDER_1024);
// Add current time in rtccnt
uint16_t time = RTCCNT + FRAM_GetRTCDivError();
timeBuf += time / RTC_FREQUENCY;
FRAM_SetRTCDivError(time % RTC_FREQUENCY);
// Start and reset RTC
RTC_start(RTC_BASE, RTC_CLOCKSOURCE_XT1CLK);
ConvertFromUTCTimeType(&currTimeBuf, timeBuf);
SetConfigRegisterTimeStamp(&currTimeBuf);
//2. Initialize Port registers, without enabling interrupts
GPIO_Init();
//3. LF Crystal
Clk_Init();
//4. Clear the LOCKLPM bit
PM5CTL0 &= ~LOCKLPM5;
//5. Enable port interrupts as necessary
GPIO_EnableInterrupts();
//6. Enable module interrupts
ADC_Init();
RTC_enableInterrupt(RTC_BASE, RTC_OVERFLOW_INTERRUPT);
Hardware_Version hwVersion = ReadHardwareVersion();
//7. After enabling the port and module interrupts, the wakeup interrupt is serviced as normal interrupt
__enable_interrupt();
...
}
是否有办法找出为何阻止唤醒?
此致
Christian