TI中文支持网
TI专业的中文技术问题搜集分享网站

MSP432P401R的RTC问题

你们好:

我正在学习使用MSP432P401R的RTC模块,使用例程:rtc_c_calendar_alarm_interrupt_MSP_EXP432P401R_nortos_ccs
例程里介绍说会有每分钟改变一次LED状态,但我实际运行的时候并没有实现这个功能,请问要使用RTC功能是还要做出其他的设置呢还是我做的有什么不对的地方?
代码如下:

/*******************************************************************************
* MSP432 RTC_C – Calendar Mode
*
* Description: This program demonstrates the RTC mode by triggering an
* interrupt every minute. The date is set at the start of execution and an
* additional alarm for a specific time is also set to demonstrate the various
* modes of alarms/events for the RTC_C module.
*
* MSP432P401
* ——————
* /|\| |
* | | |
* –|RST P1.0 |—> P1.0 LED
* | PJ.0 LFXIN |———
* | | |
* | | < 32khz xTal >
* | | |
* | PJ.1 LFXOUT |———
*
******************************************************************************/
/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Statics */
static volatile RTC_C_Calendar newTime;

//![Simple RTC Config]
/* Time is Saturday, November 12th 1955 10:03:00 PM */
const RTC_C_Calendar currentTime =
{
0x00,
0x03,
0x22,
0x06,
0x12,
0x11,
0x1955
};
//![Simple RTC Config]

int main(void)
{
/* Halting WDT */
MAP_WDT_A_holdTimer();

/* Configuring pins for peripheral/crystal usage and LED for output */
MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ,
GPIO_PIN0 | GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION);
MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);

/* Setting the external clock frequency. This API is optional, but will
* come in handy if the user ever wants to use the getMCLK/getACLK/etc
* functions
*/
CS_setExternalClockSourceFrequency(32000,48000000);

/* Starting LFXT in non-bypass mode without a timeout. */
CS_startLFXT(CS_LFXT_DRIVE3);

//![Simple RTC Example]
/* Initializing RTC with current time as described in time in
* definitions section */
MAP_RTC_C_initCalendar(&currentTime, RTC_C_FORMAT_BCD);

/* Setup Calendar Alarm for 10:04pm (for the flux capacitor) */
MAP_RTC_C_setCalendarAlarm(0x04, 0x22, RTC_C_ALARMCONDITION_OFF,
RTC_C_ALARMCONDITION_OFF);

/* Specify an interrupt to assert every minute */
MAP_RTC_C_setCalendarEvent(RTC_C_CALENDAREVENT_MINUTECHANGE);

/* Enable interrupt for RTC Ready Status, which asserts when the RTC
* Calendar registers are ready to read.
* Also, enable interrupts for the Calendar alarm and Calendar event. */
MAP_RTC_C_clearInterruptFlag(
RTC_C_CLOCK_READ_READY_INTERRUPT | RTC_C_TIME_EVENT_INTERRUPT
| RTC_C_CLOCK_ALARM_INTERRUPT);
MAP_RTC_C_enableInterrupt(
RTC_C_CLOCK_READ_READY_INTERRUPT | RTC_C_TIME_EVENT_INTERRUPT
| RTC_C_CLOCK_ALARM_INTERRUPT);

/* Start RTC Clock */
MAP_RTC_C_startClock();
//![Simple RTC Example]

/* Enable interrupts and go to sleep. */
MAP_Interrupt_enableInterrupt(INT_RTC_C);
MAP_Interrupt_enableSleepOnIsrExit();
MAP_Interrupt_enableMaster();

while(1)
{
MAP_PCM_gotoLPM0();
}

}

/* RTC ISR */
void RTC_C_IRQHandler(void)
{
uint32_t status;

status = MAP_RTC_C_getEnabledInterruptStatus();
MAP_RTC_C_clearInterruptFlag(status);

if (status & RTC_C_CLOCK_READ_READY_INTERRUPT)
{
MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
}

if (status & RTC_C_TIME_EVENT_INTERRUPT)
{
/* Interrupts every minute – Set breakpoint here */
__no_operation();
newTime = MAP_RTC_C_getCalendarTime();

}

if (status & RTC_C_CLOCK_ALARM_INTERRUPT)
{
/* Interrupts at 10:04pm */
__no_operation();
}

}

Susan Yang:

请问您现在使用的是哪个颜色的板子Rev 1.0 (Black) and Rev 2.0 (Red)?

dev.ti.com/…/

的例程是 红板子的

gaoyang9992006:

你看看你的板子上的IO口跟这个例子是一致的吗?例子是用的P10

赞(0)
未经允许不得转载:TI中文支持网 » MSP432P401R的RTC问题
分享到: 更多 (0)