LPC4357 MOTOCONPWM MIC0-2 external counter max frequence

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC4357 MOTOCONPWM MIC0-2 external counter max frequence

861 次查看
skysky
Contributor III

i want to use the pin-MIC0 of LPC4357 MOTOCONPWM to counter a external signal's frequence.

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 

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

标签 (1)
0 项奖励
回复
1 回复

654 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Sky,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

I think i need the more information, therefore I  was wondering if you can demonstrate the more testing result.

I'm looking forward to your reply.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复