s32k148 clock not getting valid

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

s32k148 clock not getting valid

跳至解决方案
717 次查看
microman1
Contributor II

Hi NXP community,

i am using S32K148EVB-Q176(S32k148 micro) and while trying to work with the following code

void initClock(){
  int val;
  
  /* Configure ext. osc. */
  SCG_SOSCCFG |= (0x3 << SCG_SOSCCFG_RANGE);
  SCG_SOSCCFG |= (0x1 << SCG_SOSCCFG_EREFS);
  SCG_SOSCCFG |= (0x1 << SCG_SOSCCFG_HGO);
  SCG_SOSCCSR |= (0x1 << SCG_SOSCCSR_SOSCEN);
  while(!(SCG_SOSCCSR & (0x1 << SCG_SOSCCSR_SOSCVLD)));
  

The control is not coming out of the while loop , can you please verify the initialization for clock is correct?

Thanks

标记 (2)
0 项奖励
1 解答
703 次查看
microman1
Contributor II

Hi Everyone,

It is working after modifying with the following code

SCG_SOSCDIV = 0x00000101;

SCG_SOSCCFG = 0x00000024;

Thanks

在原帖中查看解决方案

0 项奖励
2 回复数
704 次查看
microman1
Contributor II

Hi Everyone,

It is working after modifying with the following code

SCG_SOSCDIV = 0x00000101;

SCG_SOSCCFG = 0x00000024;

Thanks

0 项奖励
705 次查看
microman1
Contributor II

Sorry i forgot to add #defines

#define SCG_SOSCCFG (*(unsigned volatile int*)0x40064108)
#define SCG_SOSCCFG_RANGE 4
#define SCG_SOSCCFG_EREFS 2
#define SCG_SOSCCFG_HGO 3

0 项奖励