MCXN547: how to enable iRTC subSecond function ?

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

MCXN547: how to enable iRTC subSecond function ?

Jump to solution
675 Views
jimmyli
Contributor IV

Hi NXP,

      I find that MCXN547 has subsecond function register for iRTC, and I consider using this function to record millisecond.

      According to official SDK (SDK_2.x_FRDM-MCXN947), I import the iRTC driver example and add the code to test this function, but failed.

      Can you help to check and provide some tips ?

      Thanks;

 

1>subSecond register in MCXN reference manual

jimmyli_0-1759989461232.png

 

2>test code

based on example: frdmmcxn947_irtc_cm33_core0

hardware: FRDM-MCXN947

IRTC_EnableSubsecondCounter(RTC,true);

uint32_t subSecond_cnt = 0;

while(1){

subSecond_cnt = IRTC_GetSubsecondCount(RTC);

PRINTF("subSecond Counter is %d.\r\n",subSecond_cnt);

 

//intervals time

uint32_t i,j;

for(i=0;i<6534;i++)

for(j=0;j<6232;j++){

__NOP();

}

}

jimmyli_1-1759989578566.png

 

3>test result

    the parameter "subSecond_cnt" is still 0.

 

Labels (1)
0 Kudos
Reply
1 Solution
513 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @jimmyli 

I have tested again.

By default, the RTC Clock select 

/* 16.384kHz clock is selected */
config->clockSelect = kIRTC_Clk16K;

So the count should less than 16384

You just need to change 

RTC->CTRL |= RTC_CTRL_CLKOUT((uint16_t)kIRTC_ClkoutFine1Hz);

to 

IRTC_ConfigClockOut(RTC, kIRTC_ClkoutCoarse1Hz);

It can work.

Harry_Zhang_0-1760515151613.png

BR

Harry

View solution in original post

0 Kudos
Reply
8 Replies
493 Views
lucindaschatz
Contributor I

yes thanks

0 Kudos
Reply
644 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @jimmyli 

The Subsecond counter  use these register, not RTC_TEST2. 

Harry_Zhang_0-1760064450831.png

If you want to use is,

Please refer to  chapter 56.3.2 Subsecond counter

Harry_Zhang_1-1760064593090.png

You can try.

BR

Harry

0 Kudos
Reply
641 Views
jimmyli
Contributor IV

Hi Harry,

       Yes, you are right, the subsecond function has its own register.

       But, I called the static inline void IRTC_EnableSubsecondCounter(RTC_Type *base, bool enable) and static inline uint32_t IRTC_GetSubsecondCount(RTC_Type *base) APIs in fsl_irtc.h to enable and read the subsecond counter, but failed.

       Do you have any tips to help to enable this function ?

       Thanks very much.

0 Kudos
Reply
624 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @jimmyli 

I just tested it on my end.

It can work.

According to the RM.

There are two important points to note.

1. You must independently enable the field by writing 1 to SUBSECOND_CTRL[SUB_SECOND_CNT_EN] after enabling RTC.CTRL[CLKOUT] (see chip-specific RTC_SUBSYSTEM for more information) to select the 1 Hz clock output.

2.In RTC.CTRL[CLKO_DIS]  you should select The selected clock is output to other peripherals. 0b

This is my test code.

    IRTC_GetDefaultConfig(&irtcConfig);
    irtcConfig.disableClockOutput = false;
    if (IRTC_Init(RTC, &irtcConfig) == kStatus_Fail)
    {
        return 1;
    }
    
    PRINTF("RTC Example START:\r\n");

    RTC->CTRL &= (uint16_t)(~RTC_CTRL_CLKOUT_MASK);

    RTC->CTRL |= RTC_CTRL_CLKOUT((uint16_t)kIRTC_ClkoutFine1Hz);

    IRTC_EnableSubsecondCounter(RTC, true);

    uint32_t subSecond_cnt = 0;

    while(1){

    subSecond_cnt = IRTC_GetSubsecondCount(RTC);

    PRINTF("subSecond Counter is %d.\r\n",subSecond_cnt);


    //intervals time

    uint32_t i,j;

    for(i=0;i<6534;i++)

    for(j=0;j<6232;j++){

    __NOP();

    }
    }
    for (;;)
    {
    }

 

Harry_Zhang_0-1760082383619.png

BR

Harry

 

 

0 Kudos
Reply
620 Views
jimmyli
Contributor IV

Hi Harry,

      Thanks very much for your help!

      I have checked with your code, and subsecond can work now.

 

      But I have a question that when I convert subsecond counter to minisecond, the value seems wrong.

      Eg: 1>default clock source for subsecond counter is 32KHz;

           2>Minisecond Value = ( 1 / 32KHz ) * subsecond counter = 1/32000 x 53479 = 1.67 (s) > 1(s)

      Do I calculate it wrongly ?

 

jimmyli_0-1760086905182.png

 

0 Kudos
Reply
514 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @jimmyli 

I have tested again.

By default, the RTC Clock select 

/* 16.384kHz clock is selected */
config->clockSelect = kIRTC_Clk16K;

So the count should less than 16384

You just need to change 

RTC->CTRL |= RTC_CTRL_CLKOUT((uint16_t)kIRTC_ClkoutFine1Hz);

to 

IRTC_ConfigClockOut(RTC, kIRTC_ClkoutCoarse1Hz);

It can work.

Harry_Zhang_0-1760515151613.png

BR

Harry

0 Kudos
Reply
502 Views
jimmyli
Contributor IV

Hi Harry,

      Got it.

      Thanks very much.

Tags (1)
0 Kudos
Reply
530 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @jimmyli 

I think your calculation method is correct,

So i need to confirm with the internal team.

BR

Harry

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2182747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2182747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20I%20find%20that%20MCXN547%20has%20subsecond%20function%20register%20for%20iRTC%2C%20and%20I%20consider%20using%20this%20function%20to%20record%20millisecond.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20According%20to%20official%20SDK%20(SDK_2.x_FRDM-MCXN947)%2C%20I%20import%20the%20iRTC%20driver%20example%20and%20add%20the%20code%20to%20test%20this%20function%2C%20but%20failed.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Can%20you%20help%20to%20check%20and%20provide%20some%20tips%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Thanks%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E1%26gt%3BsubSecond%20register%20in%20MCXN%20reference%20manual%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jimmyli_0-1759989461232.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jimmyli_0-1759989461232.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360005iE066F39F17058C7F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jimmyli_0-1759989461232.png%22%20alt%3D%22jimmyli_0-1759989461232.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E2%26gt%3Btest%20code%3C%2FP%3E%3CP%3Ebased%20on%20example%3A%3CFONT%20color%3D%22%23FF0000%22%3E%26nbsp%3Bfrdmmcxn947_irtc_cm33_core0%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3Ehardware%3A%20%3CFONT%20color%3D%22%23FF0000%22%3EFRDM-MCXN947%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3EIRTC_EnableSubsecondCounter(RTC%2Ctrue)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Euint32_t%3C%2FSPAN%3E%3CSPAN%3E%20subSecond_cnt%20%3D%200%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ewhile%3C%2FSPAN%3E%3CSPAN%3E(1)%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EsubSecond_cnt%20%3D%20IRTC_GetSubsecondCount(RTC)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EPRINTF(%3C%2FSPAN%3E%3CSPAN%3E%22subSecond%20Counter%20is%20%25d.%5Cr%5Cn%22%3C%2FSPAN%3E%3CSPAN%3E%2CsubSecond_cnt)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3E%2F%2Fintervals%20time%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Euint32_t%3C%2FSPAN%3E%3CSPAN%3E%20i%2Cj%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Efor%3C%2FSPAN%3E%3CSPAN%3E(i%3D0%3Bi%26lt%3B6534%3Bi%2B%2B)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Efor%3C%2FSPAN%3E%3CSPAN%3E(j%3D0%3Bj%26lt%3B6232%3Bj%2B%2B)%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E__NOP()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jimmyli_1-1759989578566.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jimmyli_1-1759989578566.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360006i5263BC5CA8F748CF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jimmyli_1-1759989578566.png%22%20alt%3D%22jimmyli_1-1759989578566.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E3%26gt%3Btest%20result%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20the%20parameter%20%22%3CSPAN%3EsubSecond_cnt%22%20is%20still%200.%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2182747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EMCXN%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186834%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186834%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Eyes%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186700%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186700%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Harry%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Got%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Thanks%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186427%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186427%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69183%22%20target%3D%22_blank%22%3E%40jimmyli%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20have%20tested%20again.%3C%2FP%3E%0A%3CP%3EBy%20default%2C%20the%20RTC%20Clock%20select%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%2F*%2016.384kHz%20clock%20is%20selected%20*%2F%3CBR%20%2F%3Econfig-%26gt%3BclockSelect%20%3D%20kIRTC_Clk16K%3B%3C%2FP%3E%0A%3CP%3ESo%20the%20count%20should%20less%20than%2016384%3C%2FP%3E%0A%3CP%3EYou%20just%20need%20to%20change%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERTC-%26gt%3BCTRL%20%7C%3D%20RTC_CTRL_CLKOUT((uint16_t)kIRTC_ClkoutFine1Hz)%3B%3C%2FP%3E%0A%3CP%3Eto%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIRTC_ConfigClockOut(RTC%2C%20kIRTC_ClkoutCoarse1Hz)%3B%3C%2FP%3E%0A%3CP%3EIt%20can%20work.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Harry_Zhang_0-1760515151613.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Harry_Zhang_0-1760515151613.png%22%20style%3D%22width%3A%20209px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360855i27C1A6C909E512DA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Harry_Zhang_0-1760515151613.png%22%20alt%3D%22Harry_Zhang_0-1760515151613.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2185642%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2185642%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69183%22%20target%3D%22_blank%22%3E%40jimmyli%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20think%20your%20calculation%20method%20is%20correct%2C%3C%2FP%3E%0A%3CP%3ESo%20i%20need%20to%20confirm%20with%20the%20internal%20team.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183755%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183755%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Harry%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Thanks%20very%20much%20for%20your%20help!%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20I%20have%20checked%20with%20your%20code%2C%20and%20subsecond%20can%20work%20now.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20But%20I%20have%20a%20question%20that%20when%20I%20convert%20subsecond%20counter%20to%20minisecond%2C%20the%20value%20seems%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Eg%3A%201%26gt%3Bdefault%20clock%20source%20for%20subsecond%20counter%20is%2032KHz%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B2%26gt%3BMinisecond%20Value%20%3D%20(%201%20%2F%2032KHz%20)%20*%20subsecond%20counter%20%3D%201%2F32000%20x%2053479%20%3D%201.67%20(s)%20%26gt%3B%201(s)%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Do%20I%20calculate%20it%20wrongly%20%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jimmyli_0-1760086905182.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jimmyli_0-1760086905182.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360232i3E57B86A351E478F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jimmyli_0-1760086905182.png%22%20alt%3D%22jimmyli_0-1760086905182.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183668%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183668%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69183%22%20target%3D%22_blank%22%3E%40jimmyli%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20just%20tested%20it%20on%20my%20end.%3C%2FP%3E%0A%3CP%3EIt%20can%20work.%3C%2FP%3E%0A%3CP%3EAccording%20to%20the%20RM.%3C%2FP%3E%0A%3CP%3EThere%20are%20two%20important%20points%20to%20note.%3C%2FP%3E%0A%3CP%3E1.%26nbsp%3BYou%20must%20independently%20enable%20the%20field%20by%20writing%201%20to%20SUBSECOND_CTRL%5BSUB_SECOND_CNT_EN%5D%20after%20%3CSTRONG%3Eenabling%20RTC.CTRL%5BCLKOUT%5D%3C%2FSTRONG%3E%20(see%20chip-specific%20RTC_SUBSYSTEM%20for%20more%20information)%20to%20%3CSTRONG%3Eselect%20the%201%20Hz%20clock%20output.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E2.In%20RTC.CTRL%5BCLKO_DIS%5D%26nbsp%3B%20you%20should%20select%26nbsp%3BThe%20selected%20clock%20is%20output%20to%20other%20peripherals.%200b%3C%2FP%3E%0A%3CP%3EThis%20is%20my%20test%20code.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%20%20%20%20IRTC_GetDefaultConfig(%26amp%3BirtcConfig)%3B%0A%20%20%20%20irtcConfig.disableClockOutput%20%3D%20false%3B%0A%20%20%20%20if%20(IRTC_Init(RTC%2C%20%26amp%3BirtcConfig)%20%3D%3D%20kStatus_Fail)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20return%201%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20PRINTF(%22RTC%20Example%20START%3A%5Cr%5Cn%22)%3B%0A%0A%20%20%20%20RTC-%26gt%3BCTRL%20%26amp%3B%3D%20(uint16_t)(~RTC_CTRL_CLKOUT_MASK)%3B%0A%0A%20%20%20%20RTC-%26gt%3BCTRL%20%7C%3D%20RTC_CTRL_CLKOUT((uint16_t)kIRTC_ClkoutFine1Hz)%3B%0A%0A%20%20%20%20IRTC_EnableSubsecondCounter(RTC%2C%20true)%3B%0A%0A%20%20%20%20uint32_t%20subSecond_cnt%20%3D%200%3B%0A%0A%20%20%20%20while(1)%7B%0A%0A%20%20%20%20subSecond_cnt%20%3D%20IRTC_GetSubsecondCount(RTC)%3B%0A%0A%20%20%20%20PRINTF(%22subSecond%20Counter%20is%20%25d.%5Cr%5Cn%22%2CsubSecond_cnt)%3B%0A%0A%0A%20%20%20%20%2F%2Fintervals%20time%0A%0A%20%20%20%20uint32_t%20i%2Cj%3B%0A%0A%20%20%20%20for(i%3D0%3Bi%26lt%3B6534%3Bi%2B%2B)%0A%0A%20%20%20%20for(j%3D0%3Bj%26lt%3B6232%3Bj%2B%2B)%7B%0A%0A%20%20%20%20__NOP()%3B%0A%0A%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20for%20(%3B%3B)%0A%20%20%20%20%7B%0A%20%20%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Harry_Zhang_0-1760082383619.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Harry_Zhang_0-1760082383619.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360213i8E2441CB485C0D8E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Harry_Zhang_0-1760082383619.png%22%20alt%3D%22Harry_Zhang_0-1760082383619.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183479%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183479%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Harry%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BYes%2C%20you%20are%20right%2C%20the%20subsecond%20function%20has%20its%20own%20register.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BBut%2C%20I%20called%20the%26nbsp%3B%3CSTRONG%3Estatic%20inline%20void%20IRTC_EnableSubsecondCounter(RTC_Type%20*base%2C%20bool%20enable)%20%3C%2FSTRONG%3Eand%26nbsp%3B%3CSTRONG%3Estatic%20inline%20uint32_t%20IRTC_GetSubsecondCount(RTC_Type%20*base)%20%3C%2FSTRONG%3EAPIs%20in%20%3CFONT%20color%3D%22%23FF0000%22%3Efsl_irtc.h%3C%2FFONT%3E%20to%20enable%20and%20read%20the%20subsecond%20counter%2C%20but%20failed.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BDo%20you%20have%20any%20tips%20to%20help%20to%20enable%20this%20function%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BThanks%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183463%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXN547%3A%20how%20to%20enable%20iRTC%20subSecond%20function%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183463%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69183%22%20target%3D%22_blank%22%3E%40jimmyli%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Subsecond%20counter%26nbsp%3B%20use%20these%20register%2C%20not%20RTC_TEST2.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Harry_Zhang_0-1760064450831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Harry_Zhang_0-1760064450831.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360160iA963611669BD6EFB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Harry_Zhang_0-1760064450831.png%22%20alt%3D%22Harry_Zhang_0-1760064450831.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20to%20use%20is%2C%3C%2FP%3E%0A%3CP%3EPlease%20refer%20to%26nbsp%3B%20chapter%26nbsp%3B56.3.2%20Subsecond%20counter%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Harry_Zhang_1-1760064593090.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Harry_Zhang_1-1760064593090.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360161i5720779C7A01A394%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Harry_Zhang_1-1760064593090.png%22%20alt%3D%22Harry_Zhang_1-1760064593090.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20try.%3C%2FP%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EHarry%3C%2FP%3E%3C%2FLINGO-BODY%3E