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) {}
}
