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.
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.