IMXRT1170: Configure GPT to use 32Khz OSC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMXRT1170: Configure GPT to use 32Khz OSC

777 次查看
kale
Contributor I

Hello,

 

Wondering how I can configure one of the GPTs on the IMXRt1170 to use the 32khz crystal oscillator. 

I've previously set it up to use the 24Mhz crystal with following:

/*In clock_config.h*/

/* Configure GPT5 using OSC_24M  */
    rootCfg.mux = kCLOCK_GPT5_ClockRoot_MuxOsc24MOut;
    rootCfg.div = 1;
    CLOCK_SetRootClock(kCLOCK_Root_Gpt5, &rootCfg);
 
Then I've used 
`StartGptTimerFreeRun` function in GeneralPurposeYimer.c example, which is written as :
 

 

 

 

void StartGptTimerFreeRun(int number, void (*isr)(void *), void *state)
{
    gpt_config_t config = {
        .clockSource = kGPT_ClockSource_HighFreq,
        .divider = 1U,
        .enableRunInStop = true,
        .enableRunInWait = true,
        .enableRunInDoze = false,
        .enableRunInDbg = false,
        .enableFreeRun = true,
        .enableMode = true,
    };
    GPT_Init(s_GptBase[number + 1], &config);
    AttachIsr(number, kGPT_RollOverFlagInterruptEnable, isr, state);
    GPT_StartTimer(s_GptBase[number + 1]);
}

 

 

 

And I can read the time with `GetGptTime` in GeneralPurposeTimer.c

I see I can configure the gpt clock source as

`gpt_config_t.clockSource = 
kGPT_ClockSource_LowFreq`
 
However, in Clock_Config.h, is there no mux option for the GPT? Like for example
 
rootCfg.mux = kCLOCK_GPT5_ClockRoot_MuxOsc32kOut;
rootCfg.div = 1;
CLOCK_SetRootClock(kCLOCK_Root_Gpt5, &rootCfg);
 
How can I configure a GPT to use the 32khz crystal oscillator?
 
0 项奖励
回复
2 回复数

749 次查看
nxf77486
NXP TechSupport
NXP TechSupport

Hello @kale ,

 

Thank you for your time and for contacting NXP support.

I can recommend in this case the use of the MCUConfig Tools, that will help you to configure this values on a more interactive way. You can access this form the MCUXpresso tool bar under the ConfigTool clocks. Here you will find the clock possible configuration on your device. Please let me know if you have any other question.

0 项奖励
回复

744 次查看
kale
Contributor I

Hello @nxf77486 and thank you for your reply.

Yeah, that's good advice. I did indeed look into the config tools and saw surprisingly there was no way to configure the gpt to use the 32khz clock source. So I suppose that answered that question.

 

Thanks

0 项奖励
回复