M4 appears blocked while RTC registers are updating.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

M4 appears blocked while RTC registers are updating.

500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by philippschrader on Fri May 29 10:43:28 MST 2015
Hi all,

I'm looking for some insight into some behaviour I'm observing on the LPC4357.

Steps to reproduce:
1) The M4 sending a message to the M0APP via shared memory to change the time.
2) M0APP receives message and updates the time by writing the corresponding RTC registers
3) Everything continues fine
4) About a second or two after updating the time, the M4 appears to stop whatever it's doing and just sits there for ~1 second

As far as I can tell, the M4 is just blocked.

I've tried:
- Adding assert statements to all the interrupt routines to see if any of them trigger.
- Interrupting the processor in the debugger, but it also appears to just wait until the M4 is unblocked and then interrupts whatever code it was running before the M4 got blocked.

Does anyone have any insight or thoughts on what this could be?

Thanks,
Philipp
Labels (1)
0 Kudos
3 Replies

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Mon Jun 01 22:47:17 MST 2015
Hi,

have you checked where LPC_RTC points to on M0 and if this is equal to user manual?
Can you reduce the code (e.g. only use accesses to LPC_RTC->CCR) to narrow the problem?
Does same code work on M4, or do you see also there this delay?

Best regards,

Martin
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by philippschrader on Mon Jun 01 17:54:55 MST 2015
I agree that those issues sound very similar.

However, Alaric in that post talks about doing two back-to-back RTC updates.

I'm doing only a single one and it still seems like the core is blocked.

This is the function I'm using:
void WriteTimeToRegisters(const DateTime& time) {
  // Temporarily disable the RTC.
  LPC_RTC->CCR &= ~RTC_CCR_CLKEN;

  // Set the new time.
  LPC_RTC->TIME[RTC_TIMETYPE_SECOND] = time.second;
  LPC_RTC->TIME[RTC_TIMETYPE_MINUTE] = time.minute;
  LPC_RTC->TIME[RTC_TIMETYPE_HOUR] = time.hour;
  LPC_RTC->TIME[RTC_TIMETYPE_DAYOFMONTH] = time.day_of_month;
  LPC_RTC->TIME[RTC_TIMETYPE_DAYOFWEEK] = 1;  // TODO: Does this matter?
  LPC_RTC->TIME[RTC_TIMETYPE_DAYOFYEAR] = 1;  // TODO: Does this matter?
  LPC_RTC->TIME[RTC_TIMETYPE_MONTH] = time.month;
  LPC_RTC->TIME[RTC_TIMETYPE_YEAR] = time.year;

  // Re-enable the RTC.
  LPC_RTC->CCR |= RTC_CCR_CLKEN;
}


This is a slightly modified version of what LPCOpen's function looks like.
0 Kudos

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Mon Jun 01 01:48:42 MST 2015
http://www.lpcware.com/content/forum/writing-rtc-time-registers-causes-delay-code-execution
0 Kudos