Accelerometer controlled LED for LPC845 Breakout using SDK drivers

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

Accelerometer controlled LED for LPC845 Breakout using SDK drivers

NXP Employee
NXP Employee
0 0 2,164
I have built an application to interface an accelerometer with the new LPC845 Breakout board using the I2C SDK driver.
The accelerometer acts as an I2C slave device to the LPC845 master device. Colors on the on-board RGB LED change according to the accelerometer position.
The accelerometer is a slave device in this application with slave address: 0x1D. The position of the board is determined by the x,y,z-axis values obtained from this slave device. The change in these x,y,z values detects the movement of the LPC845 Breakout board. I have assigned various patterns to the RGB LEDs for each movement along the y-axis. 


Refer to the table for the hardware Connections for this application:
The NXP MMA8652 3-axis accelerometer on the breakout board can be connected using I2C protocol. SCL, SDA lines and can be powered via VDD, VDDIO and GND pins.

Connect pins of I2C master and slave as below:
Master   Slave  
Pin Name Board Location Pin Name Board Location
SCL  CN1-23 SCL  J2-3
SDA CN1-22 SDA J2-4
GND  CN1-20 GND  J1-5

The LPC845 Breakout board has an SDK package support. I used the I2C SDK driver API in the software for interfacing the hardware components. 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.
/* I2C0_SDA connect to P0_11 */
SWM_SetFixedPinSelect(SWM0, kSWM_I2C0_SDA, true);


/* I2C0_SCL connect to P0_10 */
SWM_SetFixedPinSelect(SWM0, kSWM_I2C0_SCL, true);
The source code for this application and board info for the LPC845 Breakout board can be found here.