flexio_i2c_read_fxls896x_accel_value_transfer#
Overview#
The flexio_i2c_read_fxls896x_accel_value example shows how to use FLEXIO I2C Master driver to communicate with an i2c device:
How to use the flexio i2c master driver to read a i2c device who_am_I register.
How to use the flexio i2c master 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.
Supported Boards#
FRDM-MCXW71
Hardware requirements
Type-C USB cable
FRDM-MCXW71 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the FRDM board J10.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8964 on board, the device address is 0x19.
The accel values:
x = 15 , y = -88 , z = 1097
x = 15 , y = -88 , z = 1097
x = 15 , y = -88 , z = 1097
x = 11 , y = -50 , z = 1074
x = 11 , y = -50 , z = 1074
x = 19 , y = -73 , z = 1085
x = 19 , y = -73 , z = 1085
x = 0 , y = -84 , z = 1071
x = 0 , y = -84 , z = 1071
x = 0 , y = -84 , z = 1071
End of I2C example.
MCX-W71-EVK
Hardware requirements
Type-C USB cable
MCX-W71-EVK Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the EVK board J14.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8964 on board, the device address is 0x19.
The accel values:
x = 15 , y = -88 , z = 1097
x = 15 , y = -88 , z = 1097
x = 15 , y = -88 , z = 1097
x = 11 , y = -50 , z = 1074
x = 11 , y = -50 , z = 1074
x = 19 , y = -73 , z = 1085
x = 19 , y = -73 , z = 1085
x = 0 , y = -84 , z = 1071
x = 0 , y = -84 , z = 1071
x = 0 , y = -84 , z = 1071
End of I2C example.
KW45B41Z-EVK
Hardware requirements
Mini/micro USB cable
KW45B41Z-EVK Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the EVK board J14.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8967 on board, the device address is 0x18.
The accel values:
x = 30 , y = -12 , z = 1071
x = 30 , y = -12 , z = 1071
x = 30 , y = -12 , z = 1071
x = 19 , y = 18 , z = 1078
x = 19 , y = 18 , z = 1078
x = 41 , y = -8 , z = 1082
x = 41 , y = -8 , z = 1082
x = 26 , y = 11 , z = 1086
x = 26 , y = 11 , z = 1086
x = 26 , y = 11 , z = 1086
End of I2C example.
KW47-EVK
Hardware requirements
Type-C USB cable
KW47-EVK Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the EVK board J14.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8964 on board, the device address is 0x19.
The accel values:
x = -4 , y = -4 , z = 983
x = -4 , y = -4 , z = 983
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 26 , y = 11 , z = 1014
x = 26 , y = 11 , z = 1014
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
End of I2C example.
MCX-W72-EVK
Hardware requirements
Type-C USB cable
MCX-W72-EVK Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the EVK board J14.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8964 on board, the device address is 0x19.
The accel values:
x = -4 , y = -4 , z = 983
x = -4 , y = -4 , z = 983
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 26 , y = 11 , z = 1014
x = 26 , y = 11 , z = 1014
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
End of I2C example.
FRDM-MCXW72
Hardware requirements
Type-C USB cable
FRDM-MCXW72 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the FRDM board J10.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed.
FlexIO I2C example read accelerometer value
Found a FXLS8964 on board, the device address is 0x19.
The accel values:
x = -4 , y = -4 , z = 983
x = -4 , y = -4 , z = 983
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 11 , y = 38 , z = 995
x = 26 , y = 11 , z = 1014
x = 26 , y = 11 , z = 1014
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
x = 15 , y = 7 , z = 1007
End of I2C example.