cancel
Showing results for 
Search instead for 
Did you mean: 

Code Example for Murata CMWX1ZZABZ-078 with Stop Mode and RTC Wakeup

KAppe.1513
Associate

I have the development board, B-L072-LRWAN1 with the CMWX1ZZABZ-078 module by Murtata on it. This module has an 32.768KHZ crystal on it which will be used for keep the RTC. I would like to implement a wakeup timer using this crystal to wakeup every 250MS to perform a check action, then put it back into stop mode, repeat. I would like advice on how this can be performed and what is required since I cannot find any code examples implementing this wakeup timer with the RTC crystal. I am using the Keil IDE to work with module, but have gotten the debugger to work with STM32CubeIDE. Any help would be appreciated. Thanks!

2 REPLIES 2

Doesn't the LRWAN software already uses the RTC/STOP ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

For example, I would like to turn on and print out something once every second (or something else). I want to start it in stop mode first , and then have the device turn on, and then go into stop mode again. I would expect to code to be something like the following, but I don't believe it is using the right timer. It's not printing anything.

int main( void )
{
  HAL_Init( );    /* STM32 HAL library initialization*/
  SystemClock_Config( );    /* Configure the system clock*/
  DBG_Init( );    /* Configure the debug mode*/
  HW_Init( );    /* Configure the hardware*/
  LPM_SetOffMode(LPM_APPLI_Id , LPM_Disable );    /*Disable Stand-by mode*/
 
	setCustomTimer();
	LPM_EnterStopMode();
	
	while(1)
	{
		if(printOutput){
			printOutput = false;
			num++;
			PRINTF("1 SECOND %d!\n" , num);
			LPM_EnterStopMode();
		}
	}
}
 
static void setCustomTimer(void){
	
    TimerInit( &TxTimer, customTimer );  //initial the timer   
    TimerSetValue( &TxTimer, 1000);  //set timer interval
    customTimer( NULL );  // call callback to kick off reloadable timer
	
}
 
 
static void customTimer(void* context)
{	
	 
	TimerStart( &TxTimer); //start the timer up again
	LPM_ExitStopMode();
	printOutput = true;
}