2019-11-21 01:31 PM
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!
2019-11-21 02:29 PM
Doesn't the LRWAN software already uses the RTC/STOP ?
2019-11-21 03:31 PM
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;
}