-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Board : STM32WLE5JB
Software : Move-Xduino . Based on stm32duino 2.3.0
Settings : Arduino 2.0.2 ? , optimise : smallest+LTO
Hello,
I have an issue with the behavior of the timer with STM32WLE.
I need to have a timer that start every time a specific GPIO is high.
After this i enable a interrupt to an other GPIO and count the numbers of risings eges for 100 ms (timer).
But all of this is managed with the chip on stop mode (mode 2 i think).
And with my code sometimes the interrupt for the rising edge isn't working or the timer can't stop and the chip never goes in stop mode
Here is my code
void CALLBACK_TIM2(){
detachInterrupt(digitalPinToInterrupt(FREQUENCE_PIN));
digitalWrite(LED_VERT,!digitalRead(LED_VERT));
App_son.frequence_finale=App_son.frequence_int;
tim2=true;
}
void INIT_TIMER_2(void) {
TIM_2->setOverflow(10, HERTZ_FORMAT); // 100ms
TIM_2->attachInterrupt(CALLBACK_TIM2);
TIM_2->resume();
}
void FREQUENCE_2(){
App_son.frequence_int++;
digitalWrite(LED_BLEU,!digitalRead(LED_BLEU));
}
void SINGAL_SON(void) {
INIT_TIMER_2();
TIM_2->setCount(0);
TIM_2->attachInterrupt(CALLBACK_TIM2);
TIM_2->resume();
attachInterrupt(digitalPinToInterrupt(FREQUENCE_PIN), FREQUENCE_2, RISING);
while(tim2==false){
}
tim2=false;
//Serial2.begin(112500);
//Serial2.println(App_son.frequence_finale);
App_son.frequence_finale=0;
App_son.frequence_int=0;
//TIM_2->pause();
//onLPEnter(); //Callback when the chip goes in stop mode
}
Thanks
Metadata
Metadata
Assignees
Labels
No labels