cancel
Showing results for 
Search instead for 
Did you mean: 

Illegal flag using timer 2 and timer 3

remi23
Associate II
Posted on June 11, 2010 at 12:36

Illegal flag using timer 2 and timer 3

8 REPLIES 8
lowpowermcu
Associate II
Posted on May 17, 2011 at 15:09

Hi Rémi,

I have tried to build your project but I have faced many errors.

Tell me when done.

Regards,

MCU Lüfter

remi23
Associate II
Posted on May 17, 2011 at 15:09

you are maybe not using the cosmic compiler

lowpowermcu
Associate II
Posted on May 17, 2011 at 15:09

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 power

remi23
Associate II
Posted on May 17, 2011 at 15:09

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

lowpowermcu
Associate II
Posted on May 17, 2011 at 15:09

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üfter

remi23
Associate II
Posted on May 17, 2011 at 15:09

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

lowpowermcu
Associate II
Posted on May 17, 2011 at 15:09

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,

lowpower

remi23
Associate II
Posted on May 17, 2011 at 15:09

100% sure it resets

I checked the illegal flag and  the reset pin