Hello, I am not able to persuade my RTC to generate periodic interrupts more frequent than 2Hz (that works just fine). In theory, the device should support 2, 16, 128 and 1024 Hz. When I run my program on the simulator, and I select any frequency above 2 Hz, the setting jumps back to "reserved". Did you ever encounter this problem? I still haven't tested this on the target - only the simulator.
Problem solved. I didn't write my ISR correctly! The right form is like this:
__irq void RTC_IRQHandler(void) { RTC_PeriodicIntConfig(RTC_Per_DISABLE) ; RTC_ClearFlag(RTC_FLAG_Per) ; // Acknowledge Interrupt VIC1->VAR = 0 ; VIC1->VAR = 0 ; //forgot this... RTC_PeriodicIntConfig(RTC_Per_16Hz); }
Tamir,
Your post has just stopped me from pulling out my last few remaining hairs!
After working with the '51 for the past 20 odd years I'm now moving to to ARM STR9.
This might sound strange, but I've been trying to get the periodic interrupt going for a while now.
What I did was follow the details I've got - And they don't seem to tie up with what you're doing; i.e., disable the periodic tick at the start of the ISR and enable it at the end.
I changed to your way and, hey presto, instant success!
So ... Could you tell me where you saw the details for doing it this way.
David.
David, Hell, no big deal. This is just an implementation detail of ST's library. The processor requires you to clear interrupt flags manually, each interrupt source has its own bit that is set by hardware and must be cleared by software. Look for similar functions bearing a similar name for TIM, UART etc etc. glad I could help. There is funny twist to this story: My MCBSTR9 will not generate an interrupt, but the simulator does. Keil claim that the board is ok, and my attempt to measure the signal were not too successful because of high impedence so I do not know if it really works on the target... :)
David, Sorry, I did not answer you question. I found this detail in Hitex's insiders guide for the STR9 - download it from http://www.st.com.
you can also try this path of your toolchain:
...\ARM\Examples\ST\STR91xLib
which contains many samples for the utilization of the library.
Thanks for the help - Much appreciated.
"My MCBSTR9 will not generate an interrupt, but the simulator does."
For me, with my original code, I configured the RTC to generate a 2Hz interrupt.
All worked OK with the simulator.
With the dev board, I would get one 500ms tick that worked fine then at the next 500ms tick I would get continuous interrupts for 500ms, then it would go back to a good 500ms, then bad again etc.
From the way I read the STR9 reference manual, all I had to do to clear the RTC interrupt was read the SR register.
Anyways, as I mentioned, your code snippet works a treat on the dev board - So I'm a lot happier and can move onto the next challenge!
Cheers once again,