Hello All;
I use MPC5676R and set core clock 180MHz using FMPLL_init()
But some problems is generated;
1. I think eTPU clock is set rightly. because ETPU interrupt is running as I set.
but SPI clock is weird. I set the register CPU clock 180MHz, and eTPU / peripheral / platform clock 90MHz.
SPI clock is prescaled from CPU clock as shown in reference manual, I set DBR=0 / PBR = 1 / BR = 2
it means that 180/3*1/6 = 10MHz
but, real SPI clock is 5MHz... Is these right that SPI clock is prescaled from CPU clock?
2. "for" statement takes too long time.
If I use just the command asm("nop");, It takes 11ns (It maybe consume 2 clock)
but when I call the function which execute the asm('nop'); such as
inline void delay(void)
{ asm("nop");}
then, The execution time is 250ns... I thought that the function call time is 28clock.
but. if I use the "for" statement, such as
inline void delay(int n)
{ for (; n-- ; ) asm("nop"); }
the execution time is 880ns! If I just entered "1" in the parameter.
Does Anyone knows about this phenomenon ?