MCUXpresso_LPC55S69/boards/lpcxpresso55s69/driver_examples/i2c/read_accel_value_transfer/cm33_core0
Yilin Sun 6e8d03ec0a Updated to SDK v2.15.000
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-04-12 21:21:49 +08:00
..
armgcc Updated to SDK v2.15.000 2024-04-12 21:21:49 +08:00
board.c Stock SDK v2.11.0 2022-04-08 22:42:47 +08:00
board.h Stock SDK v2.11.0 2022-04-08 22:42:47 +08:00
clock_config.c Stock SDK v2.11.0 2022-04-08 22:42:47 +08:00
clock_config.h Stock SDK v2.11.0 2022-04-08 22:42:47 +08:00
i2c_read_accel_value_transfer_v3_14.xml Updated to SDK v2.15.000 2024-04-12 21:21:49 +08:00
i2c_read_accel_value_transfer.c Stock SDK v2.11.0 2022-04-08 22:42:47 +08:00
pin_mux.c Updated SDK v2.13.0 2023-01-26 10:53:53 +08:00
pin_mux.h Updated SDK v2.13.0 2023-01-26 10:53:53 +08:00
readme.md Updated to SDK v2.15.000 2024-04-12 21:21:49 +08:00

Overview

The i2c_read_accel_value example shows how to use I2C driver to communicate with an i2c device:

  1. How to use the i2c driver to read a i2c device who_am_I register.
  2. How to use the i2c driver to write/read the device registers.

In this example, the values of three-axis accelerometer print to the serial terminal on PC through the virtual serial port on board.

SDK version

  • Version: 2.15.000

Toolchain supported

  • IAR embedded Workbench 9.40.1
  • Keil MDK 5.38.1
  • GCC ARM Embedded 12.2
  • MCUXpresso 11.8.0

Hardware requirements

  • Mini/Micro USB cable
  • LPCXpresso55s69 boards
  • Personal Computer

Board settings

No special settings are required.

Prepare the Demo

Note: MCUXpresso IDE project default debug console is semihost

  1. Connect a micro USB cable between the PC host and the LPC-Link USB port (P6) on the board.
  2. Open a serial terminal on PC for JLink serial device with these settings:
    • 115200 baud rate
    • 8 data bits
    • No parity
    • One stop bit
    • No flow control
  3. Download the program to the target board.
  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

When the example runs successfully, you can see the similar information from the terminal as below.

I2C example -- Read Accelerometer Value Found an MMA8652 on board , the device address is 0x1d . The accel values: status_reg = 0xff , x = -192 , y = 188 , z = 2152 status_reg = 0xff , x = -168 , y = 192 , z = 2160 status_reg = 0xff , x = -180 , y = 152 , z = 2144 status_reg = 0xff , x = -200 , y = 132 , z = 2064 status_reg = 0xff , x = -192 , y = 108 , z = 2196 status_reg = 0xff , x = -232 , y = 136 , z = 2092 status_reg = 0xff , x = -260 , y = 192 , z = 1992 status_reg = 0xff , x = -240 , y = 304 , z = 1968 status_reg = 0xff , x = -208 , y = 336 , z = 1976 status_reg = 0xff , x = -208 , y = 296 , z = 1900

End of I2C example .