Hi,
I want to use S32K144 at HSRUN ( 112Mhz ) mode and set the clock as below and make timer interrupt same as sample code.
But the result is looks same as RUN mode( 48Mhz ).
Do I need to add something for HSRUN mode?
Timer Interrupt Setting : 48000 / 112000000 * 1000 = 0.4286 msec
112000000 / (48000 * 2) = 1166.6667 HZ
Port Toggle Interval : 1.000msec ==> Exptected : 0.4286msec
LED Toggle Signal Frequency : 500Hz ==> Expected : 1166.6667 HZ
Clock Setting
/* Initialize clock module */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
Generated Code
/* Global configuration of flexTimer_mc_1 InitConfig 0 */
ftm_user_config_t flexTimer_mc_1_InitConfig_0 =
{
{
true, /* Software trigger state */
false, /* Hardware trigger 1 state */
false, /* Hardware trigger 2 state */
false, /* Hardware trigger 3 state */
false, /* Max loading point state */
false, /* Min loading point state */
FTM_SYSTEM_CLOCK, /* Update mode for INVCTRL register */
FTM_SYSTEM_CLOCK, /* Update mode for SWOCTRL register */
FTM_SYSTEM_CLOCK, /* Update mode for OUTMASK register */
FTM_SYSTEM_CLOCK, /* Update mode for CNTIN register */
false, /* Automatic clear of the trigger*/
FTM_UPDATE_NOW, /* Synchronization point */
},
FTM_MODE_UP_TIMER, /* Mode of operation for FTM */
FTM_CLOCK_DIVID_BY_1, /* FTM clock prescaler */
FTM_CLOCK_SOURCE_SYSTEMCLK, /* FTM clock source */
FTM_BDM_MODE_11, /* FTM debug mode */
true, /* Interrupt state */
false /* Initialization trigger */
};
/* Timer mode configuration for flexTimer_mc_1 TimerConfig 0 */
ftm_timer_param_t flexTimer_mc_1_TimerConfig_0 =
{
FTM_MODE_UP_TIMER, /* Counter mode */
0, /* Initial counter value */
48000 /* Final counter value */
};
Solved! Go to Solution.
I found the clue for HSRUN setting.
After finishing initial clock mode setting, I add HSRUN mode setting and it work as HSRUN mode.
/* Initialize clock module */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
==> ADD HSRUN Mode setting here.
Frequency : 1.116316Khz
Width : 428.7usec
I found the clue for HSRUN setting.
After finishing initial clock mode setting, I add HSRUN mode setting and it work as HSRUN mode.
/* Initialize clock module */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
==> ADD HSRUN Mode setting here.
Frequency : 1.116316Khz
Width : 428.7usec
Could you explain what are you mean about (add HSRUN mode setting here )because I have the same problem but I do not understand what is the solution