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.

Starterware/MSP432P401R: RTC sample code do not work

Part Number: MSP432P401R
Other Parts Discussed in Thread: MSP432WARE

Tool/software: Starterware

I and my customer test RTC sample code on MSP432 Launchpad, we found

-    "MSP432Ware_3_50_00_02\examples\devices\MSP432P4xx\MSP432P401x_Code_Examples\C\msp432p401x_rtc_02" work ok, will enter RTC interrupt every 1 second

-    "MSP432Ware_3_50_00_02\driverlib\examples\MSP432P4xx\rtc_c\rtc_c_calendar_alarm_interrupt" do not work, nerver enter RTC interrupt

Because customer want to use API format to write RTC code, we want to double confirm if "rtc_c_calendar_alarm_interrupt" example code could work ok? If yes, what maybe wrong for our testing. If no, do we have correct RTC example code base on API format? 

  • Moving this thread to the MSP430 forum.
  • Terry,
    Can you change/update the rtc_c_calendar_alarm_interrupt example on line 126 to MAP_PCM_gotoLPM0(); and see if you still have the issue?

    Thanks,
    Chris
  • Terry,

    I looked into this a little bit more and found that the rtc_c_calendar_alarm_interrupt.c file is missing the DayOfWeek variable from its RTC_C_Calendar currentTime structure constant.  That would be the first thing to correct.

    In addition to that, the function MAP_RTC_C_initCalendar() is not correctly pointing where it should and as a result won't reliably and correctly write in values from the currentTime constant defined at the top of that main.  This is easily fixed by removing the "MAP_" from the name of the function and calling RTC_C_initCalendar instead.  If the actual hour/minute/seconds/months is important to you (in RTC it usually is), then you will need to do this as well (we will be working to patch this in the future of course, but for now that is the answer to make it work reliably).

    Me and Chris have been discussing this issue for you (and maybe you and Chris have already spoken more in detail about this) but can you tell me more about what you are trying to do with the code example given?  Because, I ran it and it appears to work and show me a blinking red LED.

    Oh, wait... There it is.  When I ran it in debug mode, the red LED blinks as expected, but as soon as I exit debug mode on CCS the red LED just stays on and does not blink anymore.  Is this the same issue you are having?

  • Terry,

                    You are correct that this API example has some issues.  We will be working to correct them. 

     

                    I do have 2 solutions to offer you though:

     

    1. The RTC_C_CLOCK_READ_READY_INTERRUPT does not work to wake up the device from LPM3. You can simply use LPM0 instead.
      Change line 126 from       MAP_PCM_gotoLPM3();      to        MAP_PCM_gotoLPM0(); Only change here is the 3 to a 0.

    2. The rtc_02 code you reference with register level C uses the pre-scaler interrupt instead since it can wake from LPM3. You can do this with API calls by changing rtc_calendar_alarm example as follows:
      Change lines 110 & 113 so that the Prescaler interrupt is cleared/enabled instead of the read ready interrupt. Simply change RTC_C_CLOCK_READ_READY_INTERRUPT to RTC_C_PRESCALE_TIMER1_INTERRUPT on both of those lines.
      Also, insert the following code directly above line 109: RTC_C_definePrescaleEvent(RTC_C_PRESCALE_1, RTC_C_PSEVENTDIVIDER_128); //Do not use the MAP_RTC_C_definePrescaleEvent version here, it does not work properly.
      Finally, change the ISR on line 139 so that it checks for the PSIFG instead of the RTCRDYIFG by changing RTC_C_CLOCK_READ_READY_INTERRUPT to RTC_C_PRESCALE_TIMER1_INTERRUPT

     

    Please let me know if you encounter any other unexpected results from this example or if you have any follow up questions. Thank you.

**Attention** This is a public forum