STM32L072CZ/B-L072Z-LRWAN1 wakeup from external interrupt
Hi,
I've made a custom board based on
CMWX1ZZABZ-091 which contains theSTM32L072CZ device and am currently trying to modify existing End_Node (\STM32CubeExpansion_LRWAN_V1.1.4\Projects\Multi\Applications\LoRa\End_Node) application to transmitt data on two events: either a timer event or external gpio event. While looking at the source code I see that the following functions exists:
LoraStartTx( TX_ON_TIMER) ;�?
Which basically selects one(!)event that will wake-up the device from sleep in order to transmitt the data. Is it possible to have two wakeup sources ? If yes, is it as simple as to modify the LoraStartTx function as follows:
static void LoraStartTx(void)
{
/* send everytime timer elapses */
TimerInit( &TxTimer, OnTxTimerEvent );
TimerSetValue( &TxTimer, APP_TX_DUTYCYCLE);
OnTxTimerEvent();
/* send everytime button is pressed */
GPIO_InitTypeDef initStruct={0};
initStruct.Mode =GPIO_MODE_IT_RISING;
initStruct.Pull = GPIO_PULLUP;
initStruct.Speed = GPIO_SPEED_HIGH;
HW_GPIO_Init( USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, &initStruct );
HW_GPIO_SetIrq( USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, 0, Send );
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
In my design the USER_BUTTON_PIN is routed to a different location, I'm using PA0, so the HW_GPIO_SetIrq function manages to register interrupt callback function within the GpioIrq table (hw_gpio.c), but somehow my entry gets overwritten by the semtechinternal calls to HW_GPIO_SetIrq. What are my options here?
The reason for choosing the PA0 is it's ability to wake the device up from any sleep mode, as it's designated as WKUP, I've tried to configure it as wakeup with the following piece of code:
HAL_PWR_EnableWakeUpPin (PWR_WAKEUP_PIN1);�?
During initialization, but that didn't seem to work. Is there any additional configuration that needs to be done? Do I need that wakeup pin at all or can any exti interrupt be used for waking the device up from any sleep mode?
So to summarize my questions:
1. How to configure the device to wakeup on either a timer event or external gpio interrupt?
2. What to do with limited functionality of hw_gpio.h/c implementations.
3. How can PA0 wakeup functionality be used in the End_Node application.
Best Regards,
Anton
#stm32l072cz #b-l072z-lrwan1 #cmwx1zzabz-09