s32k144 clock setting plz , first time

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

s32k144 clock setting plz , first time

ソリューションへジャンプ
3,635件の閲覧回数
Oido
Contributor III

I will be introduced to the process of S32K144 for the first time.
I tried changing the numbers in the example code in the cookbook, but there was an error, so there is no way to check it. Are there a lot of things that went wrong? help me plz

 

 

 

#include "S32K144.h"

void SOSC_init_8MHz(void) {
SCG->SOSCDIV=0x00000101; //분주1는 분주비1 분주2는 분주비 1
SCG->SOSCCFG=0x00000024; //클럭 1MHz-8MHz, 외부말고 내부 크리스탈, LOW GAIN 오실레이터 선택
while(SCG->SOSCCSR & SCG_SOSCCSR_LK_MASK);
SCG->SOSCCSR=0x00000001; /* LK=0: SOSCCSR can be written */
/* SOSCCMRE=0: OSC CLK monitor IRQ if enabled */
/* SOSCCM=0: OSC CLK monitor disabled */
/* SOSCERCLKEN=0: Sys OSC 3V ERCLK output clk disabled */
/* SOSCLPEN=0: Sys OSC disabled in VLP modes */
/* SOSCSTEN=0: Sys OSC disabled in Stop modes */
/* SOSCEN=1: Enable oscillator */
while(!(SCG->SOSCCSR & SCG_SOSCCSR_SOSCVLD_MASK)); /* Wait for sys OSC clk valid */
}

void SPLL_init_112MHz(void) {
while(SCG->SPLLCSR & SCG_SPLLCSR_LK_MASK); //
SCG->SPLLCSR = 0x00000000; //SPLL오프
SCG->SPLLDIV = 0x00000201; // 분주2는 분주비4(1+3) 분주1은 분주비2(1+1)
SCG->SPLLCFG = 0x000C0000; // MULT (기본16) + 12 28배
while(SCG->SPLLCSR & SCG_SPLLCSR_LK_MASK); //
SCG->SPLLCSR = 0x00000001; //SPLL 온
while(!(SCG->SPLLCSR & SCG_SPLLCSR_SPLLVLD_MASK)); //
}

void HighSpeedRUNmode_112MHz(void) {
SCG->HCCR=SCG_HCCR_SCS(6) //소스는 SPLL로 받는다.
|SCG_HCCR_DIVCORE(0b00) // 분주비1 112MHz
|SCG_HCCR_DIVBUS(0b01) // 분주비 1+1 해서 56MHz
|SCG_HCCR_DIVSLOW(0b11); // 분주비 1+3 해서 28MHz
while (((SCG->CSR & SCG_CSR_SCS_MASK) >> SCG_CSR_SCS_SHIFT ) != 6) {}
}

클.jpg

0 件の賞賛
返信
1 解決策
3,574件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @Oido 

The code looks correct. I am attaching a .c file that you can also use as a reference for your code, and I suggest you look at the examples provided in the following link. They might be useful for you. 

S32K Examples

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
3,614件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @Oido 

Try by indenting the code and adding the following lines to the beginning of the .c file:

#include "device_registers.h"	/* include peripheral declarations S32K144 */
#include "clocks_and_modes.h"

 

B.R

VaneB

0 件の賞賛
返信
3,599件の閲覧回数
Oido
Contributor III

Hello, first of all, thank you for your reply.
Would there be no big problems with the rest of the part except for the header file?

0 件の賞賛
返信
3,575件の閲覧回数
VaneB
NXP TechSupport
NXP TechSupport

Hi @Oido 

The code looks correct. I am attaching a .c file that you can also use as a reference for your code, and I suggest you look at the examples provided in the following link. They might be useful for you. 

S32K Examples

 

0 件の賞賛
返信