Reply
Posts: 3,092
Registered: ‎02-07-2002
Accepted Solution

Is LFXO ready a wakeup source or not?

Hi,

 

On and EFR32FG is the LFXO ready interrupt a wakeup source or not? The reference manual 12.2 seems to say so:

Wakeup interrupt based on LFRCO or LFXO ready, allowing to wait for low frequency oscillator startup while being in EM2 Deep-Sleep avoiding the need for polling.

 

But Table 11.3 makes no mention of the LFXO ready interrupt or the CMU.

Posts: 466
Registered: ‎02-21-2014

Re: Is LFXO ready a wakeup source or not?

Well, there's definitely an interrupt enable flag for LFXORDY, so it might have just been an omission from that table. I'll experiment with it and let you know my results.

Posts: 466
Registered: ‎02-21-2014

Re: Is LFXO ready a wakeup source or not?

It does seem like this works. Here's the code I ran:

 

#include "em_device.h"
#include "em_chip.h"
#include "em_cmu.h"
#include "em_emu.h"

void CMU_IRQHandler(void)
{
  CMU_IntClear(CMU_IFC_LFXORDY);
  CMU_IntDisable(CMU_IEN_LFXORDY);
}

int main(void) {

  /* Chip errata */
  CHIP_Init();

  CMU_OscillatorEnable(cmuOsc_LFXO, false, false);

  // Enable LFXO ready interrupt
  CMU_IntClear(CMU_IFC_LFXORDY);
  CMU_IntEnable(CMU_IEN_LFXORDY);
  NVIC_EnableIRQ(CMU_IRQn);

  // Enable LFXO, don't wait for it to be ready
  CMU_OscillatorEnable(cmuOsc_LFXO, true, false);

  // Enter EM2 until LFXO is ready
  EMU_EnterEM2(true);

  /* Infinite loop */
  while (1) {
  }
}

I had to disable the LFXO, since it appears to be enabled by default (?). After that, I turn the LFXO back on and enter EM2 until an LFXO ready interrupt, which wakes the device. You can see the result here from AEM:

 

PG1_EM2_LFXORDY_wakeup.PNG

 

I'll put in a ticket to be added to the table you mentioned.

Posts: 466
Registered: ‎02-21-2014

Re: Is LFXO ready a wakeup source or not?

MCUAPPS-8201

Posts: 549
Registered: ‎09-18-2015

Re: Is LFXO ready a wakeup source or not?

Hey @BrianL,

 

Might you need to enable cmuClock_HFLE (I think that's the non-deprecated name or is it cmuClock_CORELE) since the LFXORDY signal might need to be synchronized between the HF and what is effectively an LF clock domains?

 

Just a thought...

 

John

Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

Thanks.


BrianL wrote:

I had to disable the LFXO, since it appears to be enabled by default (?).


I think I also saw something like that. I haven't checked LFXOENS out of reset yet, but the reference manual says it should be 0.

 

And if the LFXO really is already enabled, can I trust it?

Highlighted
Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

After a reset the CMU_STATUS has the following bits set to 1:

HFRCOENS (expected)

HFRCORDY (expected)

LFRCOENS (surprise)

LFRCORDY (surprise)

LFXOENS (surprise)

LFXORDY (surprise)

 

And when I route these two clocks to a pin I can see them oscillating. I think some errata are required here.

Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

@BrianL @JohnB

I'm referencing you in this reply to create a bit more emphasis on this:

I think some errata are required here.

Posts: 466
Registered: ‎02-21-2014

Re: Is LFXO ready a wakeup source or not?

I think you're right. I put in an internal ticket to look at this, either for a doc change or an errata: MCUAPPS-8211

Posts: 549
Registered: ‎09-18-2015

Re: Is LFXO ready a wakeup source or not?

Hi @vanmierlo,

 

Have you seen this...

 

LFRCOENS (surprise)

LFRCORDY (surprise)

 

...across multiple parts?

 

I'm working on an unrelated problem where I am observing something similar, but not on all devices.

 

John

Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

@JohnB,

 

Looking deeper it seems I made a mistake. It's halInitChipSpecific() in hal_efr.c that starts the LFRCO. And a simple 'Reset the device' from Simplicity Studio Debug view doesn't reset this clock. This made it look like the LFRCO was already running at startup.

 

But I'm still convinced the LFXO runs at startup.

Posts: 549
Registered: ‎09-18-2015

Re: Is LFXO ready a wakeup source or not?

[ Edited ]

Hi @vanmierlo,

 

Any chance you are observing this coming out of EM4?

 

I thought I was seeing as much, but ultimately I realized it was only when the part would come out of EM4, which means I needed to call EMU_UnlatchPinRetention() to reset CMU_STATUS.

 

And, yes, that makes absolutely no sense, especially if you are not retaining an oscillator in EM4, but it's something related to the logic to support this that requires the unlatch no matter what.

 

John

Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

I've never knowingly used EM4.

 

If this means seeing the LFRCO up and running, I currently believe it is just not reset to off when the MCU core is reset. It's off after a new download. CMU->STATUS says so and I also don't see it on the routed pin.

 

But the LFXO running is always true as far as I can tell.

Posts: 3,092
Registered: ‎02-07-2002

Re: Is LFXO ready a wakeup source or not?

It seems to get weirder by the day. If I totally unpower the MCU with code that only routes LFRCO and LFXO to a pin, I do not see any oscillator running. It seems there are different responses to different resets. But I have no clue what reset does what nor what reset gets invoked by what action.