PWM with MCPWM

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

PWM with MCPWM

685 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Thiapalm on Tue Nov 17 10:09:49 MST 2015
Hello,

In LPCOpen, there is no driver for MCPWM, therefore I have imported a LPC43xx CMSIS driver (lpc43xx_mcpwm.c and lpc43xx_mcpwm.h) into my code with proper adaptations.

Is there any example code using that driver (or without it) to enable the PWM for MCOA1?? I am trying to use it for LED control.

So far I am trying to:

1. Init the LPC_MCPWM -> MCPWM_Init(LPC_MCPWM);

2. PinMux -> Chip_SCU_PinMuxSet(0x9, 5, (SCU_MODE_INACT | SCU_MODE_FUNC1));

3. Set CLK_BASE_APB1 clock derived from CLKIN_MAINPLL

4. Mapping the periferal clock CLK_APB1_MOTOCON to CLK_BASE_APB1

5. Enabling CLK_APB1_MOTOCON

6. Config the channel:

  channelType = MCPWM_CHANNEL_CENTER_MODE;
  channelPolarity = MCPWM_CHANNEL_PASSIVE_HI;
  channelDeadtimeEnable = DISABLE;
  channelUpdateEnable = ENABLE;

  channelTimercounterValue = 0;
  channelPulsewidthValue = 100;
  channelPeriodValue = 18000;

5. Starting it

However, after the Pinmux, the LED lights up and stays on, even if I change the PulseWidth value.

Can someone help?

Thx
Labels (1)
0 Kudos
0 Replies