s32k148 clock not getting valid

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

s32k148 clock not getting valid

Jump to solution
694 Views
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

0 Kudos
1 Solution
680 Views
microman1
Contributor II

Hi Everyone,

It is working after modifying with the following code

SCG_SOSCDIV = 0x00000101;

SCG_SOSCCFG = 0x00000024;

Thanks

View solution in original post

0 Kudos
2 Replies
681 Views
microman1
Contributor II

Hi Everyone,

It is working after modifying with the following code

SCG_SOSCDIV = 0x00000101;

SCG_SOSCCFG = 0x00000024;

Thanks

0 Kudos
682 Views
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 Kudos