MKE04 - RTC value not updating

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKE04 - RTC value not updating

846 Views
shoaibshaikh
Contributor III

Dear All,

I have prepared a custom board using MKE04z128xxx4 for one of my projects and want to use the RTC feature.

I wanted to check the SDK example for it but since there is no board associated with it, I selected FRDM -MKE06z board and changed the MCU to MKE04z128xxx4.

I am able to build and debug the RTC SDK example but there is no update of the time. In console view, the time that I set initially, remains the same.

I checked with the SDK example for K64F RTC and found that the 'seconds' variable is updated from the TSR. There is a count register in MKE04 but it is not being used to update the time.

Could you kindly let me know how I could solve this issue?

Thanks,

Labels (1)
Tags (3)
3 Replies

547 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Shoaib,

Sorry for the late reply.

The kinetis MCU counts with a Low Voltage Detection, if you configure this interruption I think It will be better than use the ADC.

The RTC clear its count after a reset, so you need to be sure that the MCU comes from the STOP mode, for that the LVD have some flags that you can check to see if the MCU comes from an Low Power Interruption.

For more information check:

   Chapter 13 for LVD (Low Power Detection)

   Chapter 29 for RTC

For more information don't hesitate to contacto us.

Alexis Andalon

0 Kudos

547 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Shoaib,

According to this thread SDK_2_x-FRDM-KE04Z - Import wizard - No examples to import, the MCUxpresso doesn't support the MKE04z128xxx4 because its limited capacity, but you can create an scratch proyect  and use the demo examples from  KDS, IAR or MDK.

Hope it helps,

Alexis Andalon

547 Views
shoaibshaikh
Contributor III

Hi Alexis,

Thanks for your reply!

I was able to make the code work by modifying the code a bit. I modified the ISR to occur at 1 second interval and updated a32-bit counter.

In "import SDK example", I selected the FRDM-KE06 and later, I modified the MCU to MKE04z128xxx4. This way, I was able to debug it on my MKE04z128xxx4  custom board.

I am also able to select MKE04z128xxx4  in the "New project" option and debug my own code which uses the SDK files.

As I am using MCUXpresso 10.2 and SDK v2.4, it might be a bit different from MCU 10.1 and SDK 2.3

I had another query. I wanted to know how use the RTC on this MCU in low power mode.

I want to put the MCU to STOP mode whenever the mains supply is removed. I will check the supply voltage on an ADC pin and as soon as it becomes 0, I will put the MCU in STOP mode. I will also connect an external battery circuitry to the Vdd pin so that LPO keeps working.

 

I will use the __asm(“WFI”) instruction to go into STOP mode.

 

In the STOP mode the LPO will be working but the ISR, where the 32-bit counter is updated, won’t be executed. In such a case, how I can calculate the correct time after the mains supply is supplied again and I enter the RUN mode.

0 Kudos