Problem to initialize Systick in FRDM-MCXA153 using peripherals config tool

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

Problem to initialize Systick in FRDM-MCXA153 using peripherals config tool

230 Views
zorrotz
Contributor III

I have used peripherals config tool to configure the Systick to work with cpu_clk divided by 4.

After building the project there are 2 compilation errors, due to the lack of kCPU_CLK_to_SYSTICK and kCLOCK_DivSYSTICK definitions.

I have checked that these definitions are not included in fsl_clock.h file.

Note that I use MCUxpresso IDE 25.6 and SDK 25.09.

The fsl_clock.h file of the mcux-sdk 2.16 available in github includes these definitions, but i not confident in this file because i have found some bugs, for example:

- the are some comments that are incorrect

- CLOCK_FRO12MTrimConfig() function of fsl_clock.c file has this code:

                 SCG0->SIRCSTAT = SCG_SIRCSTAT_CCOTRIM(config.cltrim);
                 SCG0->SIRCSTAT = SCG_SIRCSTAT_CCOTRIM(config.ccotrim);

    and i think that it should be:

                 SCG0->SIRCSTAT = SCG_SIRCSTAT_CLTRIM(config.cltrim);
                 SCG0->SIRCSTAT = SCG_SIRCSTAT_CCOTRIM(config.ccotrim);

I have also search the documentation for SDK 25.12, but these definitions are not included.

I can manually modify fsl_clock.h file, but I prefer to have a correct SDK.

Is there a SDK version for FRDM-MCXA153 which includes these definitions?

 

Labels (2)
Tags (2)
0 Kudos
Reply
4 Replies

206 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi  @zorrotz 

I have checked the frdm_mcxa153 v25.09 SDK.

In fsl_clock.c

Harry_Zhang_0-1765968291918.png

status_t CLOCK_FRO12MTrimConfig(sirc_trim_config_t config)
{
    SCG0->SIRCTCFG = SCG_SIRCTCFG_TRIMDIV(config.trimDiv) | SCG_SIRCTCFG_TRIMSRC(config.trimSrc);

    if (kSCG_SircTrimNonUpdate == config.trimMode)
    {
        SCG0->SIRCSTAT = (SCG0->SIRCSTAT & ~SCG_SIRCSTAT_CLTRIM_MASK) | SCG_SIRCSTAT_CLTRIM(config.cltrim);
        SCG0->SIRCSTAT = (SCG0->SIRCSTAT & ~SCG_SIRCSTAT_CCOTRIM_MASK) | SCG_SIRCSTAT_CCOTRIM(config.ccotrim);
    }

    /* Set trim mode. */
    SCG0->SIRCCSR = (SCG0->SIRCCSR & ~(SCG_SIRCCSR_SIRCTREN_MASK | SCG_SIRCCSR_SIRCTRUP_MASK)) | (uint32_t)config.trimMode;

    if ((SCG0->SIRCCSR & SCG_SIRCCSR_SIRCVLD_MASK) == 0U)
    {
        return (status_t)kStatus_Fail;
    }

    if ((SCG0->SIRCCSR & SCG_SIRCCSR_SIRCERR_MASK) == SCG_SIRCCSR_SIRCERR_MASK)
    {
        return (status_t)kStatus_Fail;
    }

    if ((SCG0->SIRCCSR & SCG_SIRCCSR_TRIM_LOCK_MASK) == 0U)
    {
        return (status_t)kStatus_Fail;
    }

    return (status_t)kStatus_Success;
}

You can refer to it.

BR

Harry

0 Kudos
Reply

197 Views
zorrotz
Contributor III

Hi Harry

Yes, CLOCK_FRO12MTrimConfig() function in SDK v25.09 is OK, but the problem is that this SDK version doesn't have kCPU_CLK_to_SYSTICK and kCLOCK_DivSYSTICK definitions.

BR

 

 

0 Kudos
Reply

168 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @zorrotz 

Yes, i have checked the code.

It is a bug.

I will report it to our SDK team.

If you want to use kCPU_CLK_to_SYSTICK and kCLOCK_DivSYSTICK.

 

Harry_Zhang_0-1766042327334.png

Harry_Zhang_2-1766042465654.png

 

Harry_Zhang_1-1766042338256.png

You need to add some code in fsl_clock.h

Harry_Zhang_3-1766042710072.pngHarry_Zhang_4-1766042747585.png

 

Hope this will help you.

BR

Harry

0 Kudos
Reply

153 Views
zorrotz
Contributor III

Thank you Harry!

I will modify fsl_clock.h file.

 

BR

0 Kudos
Reply