cancel
Showing results for 
Search instead for 
Did you mean: 

St72F324 RTC timebase error

akel
Associate II
Posted on April 03, 2006 at 14:49

St72F324 RTC timebase error

2 REPLIES 2
akel
Associate II
Posted on April 03, 2006 at 13:35

Hi Users,

I use RTC timebase timer interrupt for many events

and i have 2 problems. I set MCCSR=0x02;

so I should have interrupt every 2ms by 8MHz clock,

but i have every 4ms ( in option HS:8-16MHz range and resonator type

- real I have 8MHz resonator)

Next problem is that sometimes I have interrupt one after one

- looks like not interrupt flag cleaning, but on the beginning

of interrupt routine I clear MCCSR&=0xFE flag OIF.

I use Cosmic C compiler.

Thanks for any help

Andrew

Viktor POHORELY
ST Employee
Posted on April 03, 2006 at 14:49

Concerning frequency, look into chapter 10 - Fosc2 means half of the Focs, e.g. crystal frequency.

try to go to disassembly to see, what is listing of your C code. To clear OIF, it should be enough to write

MCCSR; // clear OIF flag

in your C code. Flag is cleared by read access to MCCSR and Cosmis will handle it properly.

Setler