Disha Patil

Controlling LPC845 Breakout Board LED brightness using SDK Drivers

Blog Post created by Disha Patil Employee on Jan 14, 2019

The new LPC845 breakout board has 3 onboard LEDs- Red, Green, and Blue. The brightness of these LEDs can be controlled using a PWM signal by changing the duty cycle values for each of them. As this board has an SDK support, I have used the SDK drivers to implement this application. 

The SCTimer0 generates the PWM pulse at pins which are assigned as the SCT output pins. I have assigned the PWM output to the Green LED (PIO1_0) in my source code. You can assign the PWM output to be on any other LED by using the inbuilt configuration tool which is explained later. 

 

The source code below shows how to set the duty cycle percentage to increase or decrease the brightness of the assigned LED (here I have set it to 60%) 

 

pwmParam.level = kSCTIMER_HighTrue;
pwmParam.dutyCyclePercent = 60;

Writing the source code for this application was easy as the LPC845 Breakout board has an SDK package support. I used the SCT (Sctimer) SDK driver API in the software. The MCUXpresso SDK Builder has open source drivers, middleware, and reference example applications for software development. Customize and download the SDK specific to the processor and then import the zip file to the project in MCUXpresso IDE.
                                                                                                                                                                                               
The LPC845 Breakout board also features function-configurable I/O ports through a switch matrix (SWM). This makes it easier to configure pin routing and other pin electrical features. The configuration tool which is integrated into the IDE is useful for making changes in the switch matrix. The source code is auto-generated when the pin configuration or peripherals are changed.
/* SCT_OUT2 connect to P1_0 */
SWM_SetMovablePinSelect(SWM0, kSWM_SCT_OUT2, kSWM_PortPin_P1_0);
 
The source code for this application and board info for the LPC845 Breakout board can be found here.

Outcomes