2010-06-11 03:36 AM
Illegal flag using timer 2 and timer 3
2011-05-17 06:09 AM
Hi Rémi,
I have tried to build your project but I have faced many errors. Tell me when done. Regards, MCU Lüfter2011-05-17 06:09 AM
you are maybe not using the cosmic compiler
2011-05-17 06:09 AM
Hi Rémi,
How did you concluded that the micro is resetting ? I have connected a oscillosope to PA1 to check reset pin level and I didn't caugth a falling edge. I have understand that you are entering wait for event (wfe) mode and you are exiting both EXTI and TIM2 update event WFE_WakeUpSourceEventCmd(WFE_Source_EXTI_EV3, ENABLE); // Pin3 (receiver) can exit WFE mode WFE_WakeUpSourceEventCmd(WFE_Source_TIM2_EV1, ENABLE); // Timer 2 compare can exit WFE mode Since you have enabled the tim2 counter, the tim2 is making the MCU to exit wfe mofe each time the counter of tim2 overflows. Tell me if it is OK now ? Good luck ! Regards, MCU Lüfter be happy be low power2011-05-17 06:09 AM
It appears it is a problem from the micro that does not support my way of using the timer 2...
I will try another way of measuring a signal
2011-05-17 06:09 AM
Hi Rémi,
My own understanding is that the micro isn't resetting but waking from the wfe mode by TIM2 update. Is this reasonable for you ? Regards, MCU Lüfter2011-05-17 06:09 AM
Hi
The micro is really resetting itself:
I think the problem lies with the wfe() (wait for event) function
When I wait for a rising edge on a pin or an update on timer 2, the timer 3 is doing something different on its own (sounder).
The system works for 5s then the micro goes to a random memory location, flag an illegal access and restart.
My understanding is that it is due to the Cosmic compiler error or to a misconception in the microcontroller itself...
My way arounf the problem is to remove the use of the wfe() function
Regards
Rémi
2011-05-17 06:09 AM
Hi Rémi,
Did you checked the reset pin to be sure 100% that the micro is resetting ? From my side I will let the micro working for 5 sec and I will tell you. Regards, lowpower2011-05-17 06:09 AM
100% sure it resets
I checked the illegal flag and the reset pin