hi jeremyzhou:
now i have another problem about extern singal frequence measure.
Because the singal(Sin Wave/Pwm) frequence is too big(about 70+MHz),i think about using
the timer in MOTORCONPWM peripheral。
and i use the way of External event counting (Counter mode),the pin MCI0 is used to input the Signal to be measured。
then set a match value in counter mode,then play the role of frequency division,(100 prescaler-Check the MOTORCONPWM's output pin MCOA0)。
In order to test whether this method is effective,i use CLK0(IDVE clock)clock connect to MCI0。
So,i find a error:
1.CLK0 be set to 2MHZ,the MIC counter is correct,the MCOA0 output 20KHZ
2.CLK0 be set to 4MHZ,the MIC counter is corrent,the MCOA0 output 40KHZ
3.CLK0 be set to 8MHZ,the MIC counter is error,the MCOA0 output also about 40KHZ
So ,my question is the counter frequence of MCPWM's counter mode is 8MHZ?
refer to the other peripheral ie.TIMER capture mode,check a external singal's rising edge need 2 PCLK,the max frequence is bigger than 8MHZ.
my code such follow:
LPC_CCU1->CLK_APB1_MOTOCONPWM_CFG = 0x7;
LPC_RGU->RESET_CTRL1 = 1 << 6; //MOTOCONPWM_RST
while(!(LPC_RGU->RESET_ACTIVE_STATUS1 & (1 << 6)));
LPC_SCU->SFSP8_2 = ((1 << 4) | (1<<6) | (1<<7) | 3);// MIC0
LPC_SCU->SFSP9_3 = 1; //MCOA0
LPC_SCU->SFSP9_4 = 1; //MCOB0
LPC_MCPWM->CON_CLR = 0xffffffff;
LPC_MCPWM->CNTCON_SET = (1 << 29) | 1; //channel0 counter / rising
LPC_MCPWM->LIM0 = 100; //100 prescaler
LPC_MCPWM->MAT0 = 50;
thank you very much