The Thunderboard Forum is no longer active. If you would like to post a question regarding Thunderboard Kits, please use the Bluetooth Forum.

This discussion and its replies are closed


I have reporogrammed my Thunderboard Sense to act as a Beacon. It waks up, reads the sensors, sends the results as beacon data, and goes into EM4. I am using the CRYOTIMER to wake it up every 60 seconds, or PB0.

I am running the CRYOTIMER from cryotimerOscULFRCO with cmuOsc_LFXO disabled (due to the long stabilisation time). This seems to work quite well. Current in EM4 doesn't seem as low as I would expect (it's around 30nA) but still quite good.

I have the BT stack set to transmit 5 advertisments, at 100ms interval, and 


Is set. The odd thing is that the stack does not go into EM2 between adverts. I have tried other code, and the standard Thunderboard Sense example, and that works (goes into EM2).. I am wondering if having cmuOsc_LFXO disabled is preventing the stack from entering EM2?

Here is my enter_DefaultMode_from_RESET(), which is wher I have made the changes to the clocks:

// CMU_enter_DefaultMode_from_RESET
extern void CMU_enter_DefaultMode_from_RESET(void) {

	// $[High Frequency Clock Setup]
	/* Initializing HFXO */


	/* Setting system HFXO frequency */

	/* Enable HFXO oscillator, and wait for it to be stable */
	CMU_OscillatorEnable(cmuOsc_HFXO, true, true);

	/* Skipping HFXO oscillator select, as it is auto-enabled and selected on EM0/EM1
	 * entry */

	/* Set autostart behaviour */
	CMU_HFXOAutostartEnable(0, true, true);

	/* HFRCO not needed when using HFXO */
	CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);

	// [High Frequency Clock Setup]$

	// $[LE clocks enable]
	/* Enable clock to LE modules */
	CMU_ClockEnable(cmuClock_CORELE, true);

	/* Initializing LFXO  - NOT NEEDED for this example as we clock the RTCC from ULFRCO */

	//lfxoInit.ctune                 = 32;


	/* Enable LFXO oscillator, and wait for it to be stable */
	//CMU_OscillatorEnable(cmuOsc_LFXO, true, true);

	/* Setting system LFXO frequency */

	// [LE clocks enable]$

	// $[LFACLK Setup]
	/* Select LFXO as clock source for LFACLK */
	//CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
	// [LFACLK Setup]$

	// $[LFBCLK Setup]
	/* Select LFXO as clock source for LFBCLK */
	//CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
	// [LFBCLK Setup]$

	// $[LFECLK Setup]
	/* Select LFXO as clock source for LFECLK */
	//CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_LFXO);
	CMU_ClockSelectSet(cmuClock_LFE, cmuSelect_ULFRCO);	//set to ULFRCO
	// [LFECLK Setup]$

	// $[Peripheral Clock enables]
	/* Enable clock for GPCRC */
	CMU_ClockEnable(cmuClock_GPCRC, true);

	/* Enable clock for LDMA */
	CMU_ClockEnable(cmuClock_LDMA, true);

	/* Enable clock for PRS */
	CMU_ClockEnable(cmuClock_PRS, true);

	/* Enable clock for RTCC */
	CMU_ClockEnable(cmuClock_RTCC, true);

	/* Enable clock for GPIO by default */
	CMU_ClockEnable(cmuClock_GPIO, true);

	// [Peripheral Clock enables]$

	// $[Clock output]
	/* Disable CLKOUT0 output */
	/* Disable CLKOUT1 output */

	// [Clock output]$

	// $[CMU_IO]
	/* Disable CLKOUT0 pin */

	/* Disable CLKOUT1 pin */

	// [CMU_IO]$


And here is the output of the energy monitor:

You can see the 5 advert peaks at the end of the wakeup and read sensors section, but no EM2.

Any ideas as to why this is? is it the LFXO? I'm suspecting the LFXO because I'm sure this was working normally (with an extra second of reset time) when LFXO was enabled. But I may be remembering this worng.



  • Discussion Forums
  • Thunderboard Kits
  • Answered
  • OK, answering my own question...

    I found this

    Which explains that if LFXO is not running, adverts have to be timed and sent maually, using a soft timer.

    Also, just FYI I was suspicious of the "30nA" number for EM4 current draw, as this does seem to vary when the STK recalibrates, normally I see 800nA to 1.6uA, and I found an article that states that the Thunderboard Sense had a leakage current of "around 2uA", so I believe this number better than the one I'm seeing.

    Another item of interest is that I am developing a "contact" sensor (where are you hall effect sensor?), using reed switches. You can't use the PB0 input for this (ie wake and report switch state), as if the PB0 is left closed, you get an extra 3.3uA current draw, which I worked out is the 3.3V through the 1 MOhm pull up resistor on the board. The current draw is huge if you leave the code as it is (default) as it enabled the internal pull up resistor, which you don't need. I'm using a SPDT reed switch on PA3 instead (which will hopefully work, I haven't installed it yet).

    Correct Answer