LPCOpen Pwm Driver

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

LPCOpen Pwm Driver

4,202 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ozenozkaya on Tue May 06 02:11:00 MST 2014
Hello,

Pwm module drivers for Lpc177x_8x is missing in the LPCOpen.
We have implemented and tested the pwm module drivers of Lpc177x_8x.
Drivers are attached with this post. If you want you can test and add it to LPCOpen.

Regards,
Applied Research Team
Turkcell Technology

Original Attachment has been moved to: pwm_17xx_40xx.c.zip

Original Attachment has been moved to: pwm_17xx_40xx.h.zip

Labels (1)
13 Replies

895 Views
Massimo87
Contributor I

Hi, 

I need the Pwm Driver for LPCOpen. 

I finded this post but it is impossible to download the 2 files ( pwm_17xx_40xx.c.zip and pwm_17xx_40xx.h.zip).

Any suggestion?

Thanks,

Massimo.

0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cptnproton on Wed May 18 13:30:06 MST 2016
Not sure if this thread is being watched or whether there's any intent to use the files provided at the start of this thread in a future LPCOpen, but I believe there may be an error in the pwm_17xx_40xx.c file which defines the LPC_PWM_T structure. In the structure it has this:
<code>
...
           __IO uint32_t PCR;
            __IO uint32_t LER;
            __IO uint32_t CTCR;
    } LPC_PWM_T;
</code>

However, there is a gap of 7 32-bit memory locations between LER and CTCR. LER is at 0x4001 8050, while CTCR is at 0x4001 8070. Hence, I believe the structure should end like this:

<code>
...
           __IO uint32_t PCR;
            __IO uint32_t LER;
           __IO uint32_t RESERVED2[7];
            __IO uint32_t CTCR;
    } LPC_PWM_T;
</code>

I am not using the Count Control Register so I can't verify this.
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by klemikaze on Sat Apr 30 06:44:56 MST 2016
INSTRUCTIONS UNCLEAR
Hi. One rather noobie question: How do you use this lib to get actual PWM?
E.g. I want P2[0] to generate 75% output, how do I achieve this?
Thanks.
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by roelofs on Tue Mar 08 21:40:51 MST 2016
Good day,

I require LPCOpen PWM functionality on the LPC 1768 for a production product.  According to the LPCOpen page, the last release (V2.10) for the 17xx series microcontrollers was almost exactly 2 years ago.

When will formal PWM support be added to the 17xx LPCOpen drivers?  The last post above mentioning this was almost 4 months ago.

This seems to be a major oversight in terms of functionality for the device in LPCOpen.

Kind regards,
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Sat Nov 07 06:51:07 MST 2015
Hi All,
Thanks for your contribution. We will add PWM drivers in the future LPCOpen releases.
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gchristopher on Sat Nov 07 01:45:17 MST 2015
Thank you very much for contributing these drivers!

They work just fine with LPCOpen for the LPC1769 as well, with very minor changes:

1. Add the library to LPCOpen by adding to chip_lpc_175x_6x.h:

#define LPC_PWM1                  ((LPC_PWM_T              *) LPC_PWM1_BASE)

and

#include "pwm_17xx_40xx.h"

2. The 1769 has only one PWM, so:

Modify Chip_Pwm_GetClockIndex(...) to replace clkTMR logic to:

clkTMR = SYSCTL_CLOCK_PWM1; // Already defined for CHIP_LPC175X_6X in clock_17xx_40xx.h


I wonder why hasn't this been added to LPCOpen? (Just a couple defines would make it general for the chips in this release family.)

Thanks again! It was nice to have a consistent interface available for this peripheral.


2,589 Views
alejandroescale
Contributor I

replace: 

#define PWM_RESET             ((uint32_t) (1 << 3) 

to #define PWM_RESET             ((uint32_t) (1 << 1)     

in pwm_17xx_40xx.h

0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by abels on Mon Dec 08 08:22:07 MST 2014
Sorry, I do not realised it was only for the 17xx family.

I write trying to help and advise to the next one who will use for LPC407x_8x family.

Regards

P.S.: I try to find one example code for use this driver but I do not arrive to find it. It will be helpfully any advise to find it (and thanks in advance)
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ozenozkaya on Mon Dec 08 07:32:46 MST 2014
Dear abels,

As I stated in the topic, drivers are for LPC177x_8x series, not for LPC407x_8x series.
Porting it for LPC407x_8x series are surely possible but attached drivers are written for LPC177x_8x.

Regards,
0 Kudos

2,589 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by abels on Mon Dec 08 06:43:04 MST 2014
Hi,
When I tried to integrate the drivers I look that Some definition are missing.
LPCOpen drivers -> lpcopen_2_10_lpcxpresso_arm_university_4088qsb.zip

File to change -> chip_lpc407x_8x.h (line 139) ; LPC_PWM0 and LPC_PWM1 are not defined.

Inserted the follow lines to compile this library;
#define LPC_PWM0                  ((LPC_PWM_T              *) LPC_PWM0_BASE)
#define LPC_PWM1                  ((LPC_PWM_T              *) LPC_PWM1_BASE)

I am not sure if it is only because I am using the specific driver of EA or in the general LPCOpen also will be missing. anyway I prefer advise it (and if someone verify it better :-)

Regards

Abel
0 Kudos

2,588 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pgr on Thu Jun 19 07:09:59 MST 2014
I already had the same thought and the same conclusion ;-)

Thanks again for your work
0 Kudos

2,588 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ozenozkaya on Thu Jun 19 06:28:45 MST 2014
Dear pgr,

For pwm modules, there is no external match register as you can see in the page 725/1109 of UM10470 document. External match control is valid for only standard timer modules. Hence instead of adding something to C file, we have removed Chip_PWM_ExtMatchControlSet() decleration from H file.

With the current pwm driver we wrote, you can use all of the pwm module hardware features.

With regards,
0 Kudos

2,588 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pgr on Wed Jun 18 09:16:47 MST 2014
Hi,

Thanks for sharing your work. It seems that function Chip_PWM_ExtMatchControlSet() is missing from the C file you attached.
Do you have an update version ?

Thanks in advance
0 Kudos