Kinetis K66 Hard Fault Accessing RTC in debug mode

cancel
Showing results for 
Search instead for 
Did you mean: 

Kinetis K66 Hard Fault Accessing RTC in debug mode

780 Views
emanuelemarracc
Contributor II

Dear All,

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.

Thanks,

Emanuele

Labels (1)
0 Kudos
3 Replies

501 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Emanuele,

Have you try to test the RTC example in SDK_2.3.0_FRDM-K66F(...\SDK_2.3.0_FRDM-K66F\boards\frdmk66f\driver_examples\rtc).  I didn't find any hardfault when Step Over these RTC functions using KDS3.2 and JLink firmware application.
Maybe you can attached simple rtc test project here, so that I can test it on FRDM-K66F board.

Please search "bus error" in Chapter 49 Real Time Clock (RTC) of K66P144M180SF5RMV2 to check whether meet these situation.

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

501 Views
kdembele
Contributor I

Hi Robin/Mark

I have a similar issue. In my hardware design VBAT(L6 pin) is not connected but the RTC module used to working fine with Kinetis SDK 1.2.0 even in debug mode. However with SDK 2.6.0(MCUXpresso) I have a hard fault handler at

BOARD_BootClockHSRUN(void)
-> CLOCK_CONFIG_SetRtcClock(RTC_OSC_CAP_LOAD_0PF, RTC_RTC32KCLK_PERIPHERALS_ENABLED)
-> if ((RTC->CR & RTC_CR_OSCE_MASK) == 0u) { /* Only if the Rtc oscillator is not already enabled */


- I have VBAT activated in my Pin configuration
- FSL_FEATURE_SOC_RFVBAT_COUNT is set to 1
- ERCLK32K is enabled

How can I get the RTC working without VBAT Pin wired as it does with Kinetis ?

Best Regards,

Karim

0 Kudos

501 Views
mjbcswitzerland
Specialist V

Hi Emanuele

RTC access will result in a hard fault if either VBAT is not connector or the RTC clock is not enabled in SIM_SCGC6.
If you have VBAT, check SIM_SCGC6 to see whether it is somehow missing its initialisation when you work in debug mode.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
RTC and time keeping: http://www.utasker.com/docs/uTasker/uTasker_Time.pdf


Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

Professional Kinetis support, one-on-one training and complete fast-track project solutions: http://www.utasker.com/support.html

0 Kudos