cancel
Showing results for 
Search instead for 
Did you mean: 

RTC not working correctly and also external interrupt has getting multiple triggering pulse when timer IRQ calls even if i am not providing any triggering pulse to external interrupt pin.

pawarsudeep
Associate II
Posted on February 25, 2016 at 22:17

The original post was too long to process during our migration. Please click on the attachment to read the original post.
6 REPLIES 6
Posted on February 25, 2016 at 22:37

Yeah, not a coding style that's going to make it easy to work with. I wish you much luck.

What frequency is the processor clocking at? I would recommend you don't set ARR to 1, set your prescaler to ZERO, and account for the period completely in the ARR value. You are factoring here, put the largest value in ARR and the smallest in PSC.

Do NOT use the RMW form (TIMx->SR &= xxx) to clear interrupt bits, you simply write a mask. Review the Reference Manual for this register carefully.

Understand where to use the volatile keyword for variables you change outside of normal program flow.

The word is FARE not FAIR (Carnival, Bazaar) 

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
pawarsudeep
Associate II
Posted on February 26, 2016 at 22:16

Thanks clive1. And yes I have done lot of spelling mistakes here. And I am new in coding, previously I was working only in hardware so don't know about much more standard coding Style. Once again thanks for your suggestion. I will try my code as per your suggestion and hope it will useful to solve my problem. Thanks once again.

pawarsudeep
Associate II
Posted on February 26, 2016 at 22:16

Hi  Clive1 !!!...

 One more thing I want to discuss here. What about my External interrupt configuration function. Is it correct that I am written in code? And second thing is why my RTC value is not saving in backup register? because if I turn off VDD supply and again start then RTC start from time value that initially configured. I am considering LSI clock of 40kHz for my all calculations. So please give me suggestion to solve these issue. Thanks in Advance.

pkumar1883
Associate II
Posted on February 29, 2016 at 09:47

 And second thing is why my RTC value is not saving in backup register?

 

Dear pawar.sudeep,

As I could understand from your code that in RTC initialization you are not checking if RTC is already configured or not. In that case every time your system gets RESET you RTC also RESET.

Best way to resolve the problem write some flag bytes in Backup Register after RTC configuration and check these every time you are going to configure the RTC. If you find equal to the value you set then dont reconfigure your RTC ad only read RTC counter.

One more thing please change your coding style(as Clive1 also mentioned). It is very confusing. Makes too difficult to understand. Try to use ST's library.Tell your ST part number and IDE so that specific help can be given to you.

/*Please

 mark helpfull

 if this post helps you or solves your problem.*/

/* If you need any personal support for your work please contact at 

embeddeddesign.help@gmail.com*/

pawarsudeep
Associate II
Posted on March 01, 2016 at 12:25

Dear kk,

  Thanks for your important helpful suggestion. Can you help me to solve my external interrupt problem. As I discussed above Timer IRQ in my code is configured for nearly 1 ms to display seven segments. And has highest priority. And External interrupt has second priority. Now issue is that once I trigger the external interrupt pin. control goes in external interrupt IRQ but same time timer IRQ also comes because it has higher priority and it is configured for 1ms. That giving me issue is external interrupt IRQ routine calls continuously even if I am not triggering this external interrupt pin. I am configured External interrupt pin in rising mode. I am using STM32F042C6 micro-controller and COOCOX is the IDE that I am using for it. Please if you have any suggestion please reply.

Thanks Once again. 

pkumar1883
Associate II
Posted on March 02, 2016 at 08:21

Dear pawar.sudeep,

Follow these--

1. Dont know your hardware schematics. Looks that your External Interrupt pin is hanging. If you want External Interrupt at rising edge then pull down you pin with a resistance.

2. Avoid writeing big time taking subroutines in your IRQs. It will stop other Interrupts to occur.

/*Please

 mark helpfull

 if this post helps you or solves your problem.*/

/* If you need any personal support for your work please contact at 

embeddeddesign.help@gmail.com*/