PWM CONFIGURATION IN LPC 804

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

PWM CONFIGURATION IN LPC 804

ソリューションへジャンプ
909件の閲覧回数
Arularasan
Contributor II

HI I am trying to generate pwm in P0_24  in LPC804 Microcontroler. 

If there are any changes in my configuration, update me 

int main()

{

 SYSCON->PRESETCTRL0 |= 1 << 25;

SYSCON->SYSAHBCLKCTRL0 |= 1<<7;

SWM0->PINASSIGN.PINASSIGN4 = 0X18;  // P0_24 PIN SELECTED

SYSCON->SYSAHBCLKCTRL0 |= 0<<7;

CTIMER->TCR |= 1 << 1;

CTIMER->PR = 0x00U;

CTIMER->MCR |= 1 << 0 | 1 << 1;

CTIMER->MR[0] =100;

CTIMER->MSR[0]=100;

CTIMER->PWMC |= 0<<1;

CTIMER->TCR |= 1<<0 | 1<<1;

while(1)
{
CTIMER->MR[1] =50;
CTIMER->MSR[1]=50; 
}

}

タグ(1)
0 件の賞賛
返信
1 解決策
845件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Arularasan 

Please first confirm the PWM demo under SDK can generate PWM signal on your board, then development based on it, 

that can speeds up your development.

 

BR

Alice

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
893件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Arularasan 

What about the issue  with your project?

About PWM, strongly recommend you the PWM demo under SDK.

Download SDK from:  https://mcuxpresso.nxp.com/en/select  

 

BR

Alice

 

0 件の賞賛
返信
885件の閲覧回数
Arularasan
Contributor II

@Alice_Yang  

The pwm pulse is not generated, please update me if there are any changes in the configuration below

int main()

{

* 1 */ SYSCON->SYSAHBCLKCTRL0 |=  1 << 25 ;// Enables clock for CTIMER0.
 
/* 2 */ SYSCON->PRESETCTRL0 |= 1 << 25; //  CTIMER reset control // Clear the CTIMER reset.
 
/* 3 */ // Pins: Select timer pins through switch matrix.
 
/* 4 */    //  SWM0->PINASSIGN_DATA[4] | ;
 
    SYSCON->SYSAHBCLKCTRL0 |= 1<<7; //Enables clock for switch matrix
 
SWM0->PINASSIGN.PINASSIGN4 = 0X18;// P0_24 PIN SELECTED
 
SYSCON->SYSAHBCLKCTRL0 |= 0<<7; //DISABLE clock for switch matrix
 
/* 5 */  CTIMER->TCR |= 1 << 1;/*Enabled. The Timer Counter and the Prescale Counter are synchronously reset on the
                                 next positive edge of the APB bus clock. The counters remain reset until TCR[1] is
                                 returned to zero*/
CTIMER->PR = 0xFFFFFFFFU;
/* 6 */ CTIMER->MCR |= 1 << 0 | 1 << 1; // Interrupt on MR0: an interrupt is generated when MR0 matches the value in the TC
                                        // Reset on MR0: the TC will be reset if MR0 matches it. 0 = disabled. 1 = enabled
 
/* 7 */ CTIMER->MR[0] =100;//Timer counter match value
 
/* 8 */ CTIMER->MSR[0]=100; //Timer counter match shadow value
 
           //  START COUNT
 
/* 9 */ CTIMER->PWMC |= 0<<1;//PWM. PWM mode is enabled for CTIMER_MAT0.
 
/* 10 */ CTIMER->TCR |= 1<<0 | 1<<1;// Enabled. The Timer Counter and Prescale Counter are enabled.
                                    //Enabled. The Timer Counter and the Prescale Counter are synchronously reset on the
//next positive edge of the APB bus clock. The counters remain reset until TCR[1] is
//returned to zero
 // while(1)
 // {
  /* 7 */ CTIMER->MR[1] =50;//Timer counter match value
 
  /* 8 */ CTIMER->MSR[1]=50; //Timer counter match shadow value
 // }
}
0 件の賞賛
返信
846件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Arularasan 

Please first confirm the PWM demo under SDK can generate PWM signal on your board, then development based on it, 

that can speeds up your development.

 

BR

Alice

0 件の賞賛
返信