infineon4engi@twitter infineon4engineers infineon@linkedin infineon@youtube
twitter Facebook Linkedin Youtube

+ Reply to Thread
Results 1 to 5 of 5

Thread: XMC4700 RTC interrupts are generated more than once per second

  1. #1
    Beginner Beginner agrus has a spectacular aura about
    Join Date
    Jan 2016
    Posts
    72
    Points
    106.875

    XMC4700 RTC interrupts are generated more than once per second

    Hi all,

    I am working with an RTC module on an XMC4700 board. The problem is that the seconds counter seems to increment more than once per second, although the prescaler value is set to 0x7FFF. When I step into individual assembly instructions in Debug mode, the seconds register seems to increment every other istruction, sometimes even once per instruction primitive (ldr, etc,). Now, the weird part is that the timekeeping seems to be correct - whenever I display the register values obtained with XMC_RTC_GetTimeStdFormat();, on a hyperterminal via UART, the 'seconds' value seems to get incremented every second - I left the terminal running in the background and even after half an hour the RTC shows the correct time. However, interrupts that are handled by SCU_0_IRQHandler (<-- I hope this is not the mistake) seem to trigger more than once per second as each interrupt routine also clears the hyperterminal and it is indeed refreshed at a very fast speed - such that I can barely see some values.
    Last edited by agrus; Feb 2nd, 2016 at 08:36 AM.

  2. #2
    Travis will become famous soon enough
    Join Date
    Feb 2013
    Location
    Singapore
    Posts
    749
    Points
    4580
    Quote Originally Posted by agrus View Post
    Hi all,

    I am working with an RTC module on an XMC4700 board. The problem is that the seconds counter seems to increment more than once per second, although the prescaler value is set to 0x7FFF. When I step into individual assembly instructions in Debug mode, the seconds register seems to increment every other istruction, sometimes even once per instruction primitive (ldr, etc,). Now, the weird part is that the timekeeping seems to be correct - whenever I display the register values obtained with XMC_RTC_GetTimeStdFormat();, on a hyperterminal via UART, the 'seconds' value seems to get incremented every second - I left the terminal running in the background and even after half an hour the RTC shows the correct time. However, interrupts that are handled by SCU_0_IRQHandler (<-- I hope this is not the mistake) seem to trigger more than once per second as each interrupt routine also clears the hyperterminal and it is indeed refreshed at a very fast speed - such that I can barely see some values.

    Unfortunately, I haven't figured out if I can delete posts on this forum or not - but I found the issue. The interrupt flag is not cleared automatically when an interrupt handler is asserted - thus, an interrupt handler needs to clear the flag in order to quit the interrupt. It's a silly mistake on my end that took more time to figure out than it ever should have. Thank you for checking this post.

    Hi,

    FYI that interrupt flag needs to be cleared upon entry into the Interrupt sub routine.

    I shall have a try of this RTC on XMC4800.

  3. #3
    Travis will become famous soon enough
    Join Date
    Feb 2013
    Location
    Singapore
    Posts
    749
    Points
    4580
    Hi agrus,

    I had tested the XMC4800 which is almost similar as the XMC4700 device. Everything seems to be working good, the seconds counter seems to be counting good via the debugger and interrupt for both periodic and alarm events are working good too.

    Attached is the example of XMC4800 using RTC. What I can suggest is that

    1. Recreate a DAVE4 project with XMC4700
    2. Copy the files main.c, RTC.c, SCU.c, XMC48_INIT.h, XMC48_IO.h and XMC48_IRQ.h into your XMC4700 project.
    3. Make the necessary modification from XMC4800 to XMC4700.
    4. Compile and Run the project
    5. Set break point at RTC interrupt.
    ?????

  4. #4
    Travis will become famous soon enough
    Join Date
    Feb 2013
    Location
    Singapore
    Posts
    749
    Points
    4580
    With regards to this behaviour "RTC interrupts are generated more than once per second" please check the SCU_SRMSK to ensure that you do not have other interrupts also as the Real time clock, Watch dog timer etc shares the same interrupt node.

    Click image for larger version

Name:	srmsk.JPG
Views:	3
Size:	31.0 KB
ID:	2007

  5. #5
    Beginner Beginner agrus has a spectacular aura about
    Join Date
    Jan 2016
    Posts
    72
    Points
    106.875
    Hi Travis,

    Thank you for the concise and thorough reply - indeed, the problem was that I forgot to clear the interrupt flag, hence once a trigger has been set once, it has never been reset and interrupt kept triggering as if it was in a while() loop. The RTC module seems to be working very.

    Cheers,
    Andrey

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.