I'm having some problems using internal RTC module on a custom board with MK66FN2M0VMD18 processor.
I'm using KDS 3.0 IDE with GCC compiler and Segger Jlink debugger.
I use internal RTC in my program and I poll the device periodically.
If I run the board programmed everything works and the program executes with no issues.
But If I try to run the program in debug mode using jlink debugger I get an hard fault and the program halts when I attempt to access RTC device.
If I comment instructions that uses the RTC internal device the program runs with no issues too.
I've checked the K66 Sub-Family Reference Manual and I read that a bus error may be issued if the VBAT pin is not connected or if is not provided with the right voltage.
I've measured the voltage on VBAT pin and I always found 3.3V.
Do You know why the hard fault is caused by RTC device when I run the brogram through emulator? Is there some workaround to correct this issue? Any HW or SW suggestion?
All Your support is appreciated.