How to configure P0.10 as Match-Output?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure P0.10 as Match-Output?

655 Views
leejungwoo
Contributor I

Hello. I am using LPC1114FBD48. I want to use pin 29 (P0.10) as a PWM output. However, it is not output by PWM but always outputs "HIGH" status. I need help with what is the problem.

Let me briefly list the code I tried.

For reference, if I program another PWM output pin in the same order as the code below, it works fine.

enum { 
   PWM0_PORT = 0, 
   PWM0_PIN = 10, 
   PWM0_MASK = 0b1 << 10, 
   PWM0_IOCON = IOCON_PIO0_10, 
   PWM0_MODE = 0x3|(0x1 << 3) 
}

// configuration code

Chip_TIMER_Init(LPC_TIMER16_0);

iocon_set_mux(PWM0_IOCON, PWM0_MODE);

Chip_TIMER_PrescaleSet(LPC_TIMER16_0, 47);

LPC_TIMER16_0->PWMC = 1<<0 | 1<<2;                   // M0,M2 to PWM

LPC_TIMER16_0->MR[3] = 1999;

LPC_TIMER16_0->MCR = 0b010000000000;             // M3 is used to set PWM Cycle

Chip_TIMER_Enable(LPC_TIMER16_0);

// code to output pwm pulse.

LPC_TIMER16_0->MR[2] = 1000;

Labels (1)
0 Kudos
Reply
1 Reply

638 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Lee,

I just briefly check your code, I think your CTimer16 configuration is okay. But I do not know if the pin configuration is okay.

Pls check that you should Enable the IOCON bit before you call the iocon_set_mux(PWM0_IOCON, PWM0_MODE);

pastedImage_1.png

Secondly, after you run the code, then set a break point, and check the Timer counter register TMR16B0TC and check if it is counting.

pastedImage_2.png

If it is counting, I think the PWM signal should appear on the pin.

Hope it can help you

BR

XiangJun Rong

0 Kudos
Reply