MCUXpresso SDK Documentation

flexio_i2c_read_accel_value_transfer

flexio_i2c_read_accel_value_transfer#

Overview#

The flexio_i2c_read_accel_value example shows how to use FLEXIO I2C Master driver to communicate with an i2c device:

  1. How to use the flexio i2c master driver to read a i2c device who_am_I register.

  2. 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#

EVK9-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings

No special settings are required.

Please note this application can’t support running with Linux BSP!

Please note this application can only run well with RAM link file! If run it in QSPI flash in place, there’s high latency when instruction fetch cache miss. The FlexIO I2C has critical timing requirement that I2C data must be read/write in time, otherwise the state machine works abnormally.

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW10 to power on the board.

  2. Connect a micro USB cable between the host PC and the J17 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either press the reset button on your board or launch the debugger in your IDE to begin running the example

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
EVKB-IMXRT1050
Hardware requirements
  • Mini/micro USB cable

  • EVKB-IMXRT1050 board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL SW5-2 –> J23-6 SDA SW5-1 –> J23-5

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
EVK-MCIMX7ULP
Hardware requirements
  • Micro USB cable

  • MCIMX7ULP-EVK board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings

The example requires doing connection between FLEXIO pins and LPI2C pins. Please use two dupontline to touch the test point (TP) on MCIMX7ULP-EVK base board as following:

  • TP24, TP25 connected

  • TP26, TP27 connected

Please note this application can’t support running with Linux BSP!

Please note this application can only run well with RAM link file! If run it in QSPI flash in place, there’s high latency when instruction fetch cache miss. The FlexIO I2C has critical timing requirement that I2C data must be read/write in time, otherwise the state machine works abnormally.

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW1 to power on the board.

  2. Connect a micro USB cable between the host PC and the J6 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either press the reset button on your board or launch the debugger in your IDE to begin running the example

Running the demo

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

FlexIO I2C example read accelerometer value
Found a FXOS8700 on board, the device address is 0x1E. 
The accel values:
status_reg = 0xff , x =   180 , y =   -47 , z =  2024 
status_reg = 0xff , x =    25 , y =     4 , z =  2029 
status_reg = 0xff , x =   130 , y =   -98 , z =  2115 
status_reg = 0xff , x =   103 , y =   -84 , z =  2137 
status_reg = 0xff , x =    57 , y =   -55 , z =  2093 
status_reg = 0xff , x =    80 , y =   -53 , z =  2066 
status_reg = 0xff , x =    93 , y =   -70 , z =  2064 
status_reg = 0xff , x =    96 , y =   -70 , z =  2072 
status_reg = 0xff , x =    89 , y =   -64 , z =  2067 
status_reg = 0xff , x =    67 , y =   -60 , z =  2111 

End of I2C example .
EVK-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings

No special settings are required.

Please note this application can’t support running with Linux BSP!

Please note this application can only run well with RAM link file! If run it in QSPI flash in place, there’s high latency when instruction fetch cache miss. The FlexIO I2C has critical timing requirement that I2C data must be read/write in time, otherwise the state machine works abnormally.

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW10 to power on the board.

  2. Connect a micro USB cable between the host PC and the J17 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either press the reset button on your board or launch the debugger in your IDE to begin running the example

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
EVK-MIMXRT1010
Hardware requirements
  • Mini/micro USB cable

  • EVK-MIMXRT1010 board

  • Personal Computer

Board settings
  • remove J64,J63

  • To make this example work, connections needed to be as follows:

    FLEXIO_I2C connected to LPI2C1 SCL J26-8 –> J57-20 SDA J26-6 –> J57-18

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U26) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

Note:

Make sure connect FLEXIO_I2C to LPI2C1 after power cycling/resetting the board. Pulling up GPIO_EMC_20 and GPIO_EMC_26 will have impact on boot process.

Note: To debug in qspiflash, following steps are needed:

  1. Select the flash target and compile.

  2. Set the SW8: 1 off 2 off 3 on 4 off, then power on the board and connect USB cable to J41.

  3. Start debugging in IDE.

    • Keil: Click “Download (F8)” to program the image to qspiflash first then clicking “Start/Stop Debug Session (Ctrl+F5)” to start debugging.

EVK-MIMXRT1015
Hardware requirements
  • Mini/micro USB cable

  • EVK-MIMXRT1015 board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL J17-3 –> J19-10 SDA J17-4 –> J19-9

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U26) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

Note:

Make sure connect FLEXIO_I2C to LPI2C1 after power cycling/resetting the board. Pulling up GPIO_EMC_20 and GPIO_EMC_26 will have impact on boot process.

Note: To debug in qspiflash, following steps are needed:

  1. Select the flash target and compile.

  2. Set the SW8: 1 off 2 off 3 on 4 off, then power on the board and connect USB cable to J41.

  3. Start debugging in IDE.

    • Keil: Click “Download (F8)” to program the image to qspiflash first then clicking “Start/Stop Debug Session (Ctrl+F5)” to start debugging.

EVK-MIMXRT1020
Hardware requirements
  • Mini/micro USB cable

  • EVK-MIMXRT1020 board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL J17-2 –> J19-10 SDA J17-1 –> J19-9

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U26) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

Note: To debug in qspiflash, following steps are needed:

  1. Select the flash target and compile.

  2. Set the SW8: 1 off 2 off 3 on 4 off, then power on the board and connect USB cable to J23.

  3. Start debugging in IDE.

    • Keil: Click “Download (F8)” to program the image to qspiflash first then clicking “Start/Stop Debug Session (Ctrl+F5)” to start debugging.

MIMXRT1024-EVK
Hardware requirements
  • Mini/micro USB cable

  • MIMXRT1024-EVK board

  • Personal Computer

Board settings

Please remove resistance R1882. To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL J17-4 –> J19-20 SDA J17-2 –> J19-18

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U26) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

Note: To debug in qspiflash, following steps are needed:

  1. Select the flash target and compile.

  2. Set the SW8: 1 off 2 off 3 on 4 off, then power on the board and connect USB cable to J23.

  3. Start debugging in IDE.

    • Keil: Click “Download (F8)” to program the image to qspiflash first then clicking “Start/Stop Debug Session (Ctrl+F5)” to start debugging.

MIMXRT1160-EVK
Hardware requirements
  • Mini/micro USB cable

  • MIMXRT1160-EVK board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C5

SCL J26-2 –> J10-20 SDA J26-4 –> J10-18

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board , the device address is 0x1D.

The accel values:

status_reg = 0xff , x =   -50 , y =    11 , z =  2045
status_reg = 0xff , x =   -50 , y =     9 , z =  2031
status_reg = 0xff , x =   -49 , y =    12 , z =  2032
status_reg = 0xff , x =   -50 , y =     6 , z =  2046
status_reg = 0xff , x =   -51 , y =     8 , z =  2040
status_reg = 0xff , x =   -45 , y =     4 , z =  2032
status_reg = 0xff , x =   -52 , y =    13 , z =  2042
status_reg = 0xff , x =   -53 , y =    12 , z =  2041
status_reg = 0xff , x =   -51 , y =     8 , z =  2048
status_reg = 0xff , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U32) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

MIMXRT1180-EVK
Hardware requirements
  • Mini/micro USB cable

  • MIMXRT1180-EVK board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C2

SCL J41-2 –> J44-20 SDA J41-4 –> J44-18

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value
Found a FXL8974 on board, the device address is 0x18.
The accel values:
status_reg = 0x81 , x =    -8 , y =    11 , z =  1024
status_reg = 0x81 , x =    -8 , y =    18 , z =  1044
status_reg = 0x81 , x =    -4 , y =    -4 , z =  1007
status_reg = 0x81 , x =    -8 , y =    -4 , z =  1006
status_reg = 0x81 , x =     3 , y =     7 , z =  1044
status_reg = 0x81 , x =     3 , y =   -19 , z =  1023
status_reg = 0x81 , x =   -12 , y =     7 , z =  1066
status_reg = 0x81 , x =   -16 , y =    11 , z =  1039
status_reg = 0x81 , x =     7 , y =     3 , z =  1019
status_reg = 0x81 , x =    -8 , y =     0 , z =  1023

End of I2C example .
Note:

if sensor chip(U115) is not welded on the board, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

FRDM-K32L3A6
Hardware requirements
  • Mini/micro USB cable

  • FRDM-K32L3A6 board

  • Personal Computer

Board settings

Please ensure there is FXOS8700 on board

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value
Found an FXOS8700 on board, the device address is 0x1E .
The accel values:
status_reg = 0xff , x =   -21 , y =    12 , z =  2007
status_reg = 0xff , x =   -20 , y =    20 , z =  2008
status_reg = 0xff , x =   -19 , y =     4 , z =  2008
status_reg = 0xff , x =   -20 , y =    29 , z =  2022
status_reg = 0xff , x =   -22 , y =    11 , z =  2008
status_reg = 0xff , x =   -18 , y =    33 , z =  2013
status_reg = 0xff , x =   -28 , y =    21 , z =  2005
status_reg = 0xff , x =   -16 , y =    30 , z =  2022
status_reg = 0xff , x =   -29 , y =    13 , z =  2010
status_reg = 0xff , x =   -14 , y =     6 , z =  2024

End of FlexIO I2C example .
FRDM-KE15Z
Hardware requirements
  • Micro USB cable

  • FRDM-KE15Z board

  • Personal Computer

Board settings

The flexio_i2c_read_accel_value example is requires connecting the FLEXIO pins with the I2C pins of accelerometer The connection should be set as following: FLEXIO_I2C connected to LPI2C0 SCL PTE11(J2-15) –> PTA3(J4-12) SDA PTE10(J2-17) –> PTA2(J4-10)

Prepare the Demo
  1. Connect a USB cable between the host PC and the OpenSDA USB port on the target board.

  2. Open a serial terminal with the following settings:

  • 115200 baud rate

  • 8 data bits

  • No parity

  • One stop bit

  • No flow control

  1. Download the program to the target board.

  2. 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, the following message is displayed in the terminal:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board, the device address is 0x1C.

The accel values:

status_reg = 0xff , x =   511 , y =   -66 , z =  2065

status_reg = 0xff , x =   509 , y =   -70 , z =  2054

status_reg = 0xff , x =   513 , y =   -64 , z =  2064

status_reg = 0xff , x =   514 , y =   -71 , z =  2064

status_reg = 0xff , x =   508 , y =   -67 , z =  2066

status_reg = 0xff , x =   512 , y =   -62 , z =  2060

status_reg = 0xff , x =   514 , y =   -73 , z =  2060

status_reg = 0xff , x =   511 , y =   -64 , z =  2056

status_reg = 0xff , x =   518 , y =   -68 , z =  2064

status_reg = 0xff , x =   507 , y =   -67 , z =  2066

End of I2C example .
FRDM-KE17Z
Hardware requirements
  • Micro USB cable

  • FRDM-KE17Z board

  • Personal Computer

Board settings

The flexio_i2c_read_accel_value example is requires connecting the FLEXIO pins with the I2C pins of accelerometer The connection should be set as following: FLEXIO_I2C connected to LPI2C0 SDA PTA11(J2-17) –> PTA16(J2-18)

Prepare the Demo
  1. Connect a USB cable between the host PC and the OpenSDA USB port on the target board.

  2. Open a serial terminal with the following settings:

  • 115200 baud rate

  • 8 data bits

  • No parity

  • One stop bit

  • No flow control

  1. Download the program to the target board.

  2. 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, the following message is displayed in the terminal:

FlexIO I2C example read accelerometer value

Found a FXOS8700 on board, the device address is 0x1C.

The accel values:

status_reg = 0xff , x =   511 , y =   -66 , z =  2065

status_reg = 0xff , x =   509 , y =   -70 , z =  2054

status_reg = 0xff , x =   513 , y =   -64 , z =  2064

status_reg = 0xff , x =   514 , y =   -71 , z =  2064

status_reg = 0xff , x =   508 , y =   -67 , z =  2066

status_reg = 0xff , x =   512 , y =   -62 , z =  2060

status_reg = 0xff , x =   514 , y =   -73 , z =  2060

status_reg = 0xff , x =   511 , y =   -64 , z =  2056

status_reg = 0xff , x =   518 , y =   -68 , z =  2064

status_reg = 0xff , x =   507 , y =   -67 , z =  2066

End of I2C example .
FRDM-MCXC242
Hardware requirements
  • USB-C cable

  • FRDM-MCXC242 board

  • Personal Computer

Board settings

The flexio_i2c_read_accel_value example is requires connecting the FLEXIO pins with the I2C pins of accelerometer But this example no need special setting because of default FlexIO pins using is match with I2C pins of accelerometor on board.

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value
Found an FXOS8700 on board, the device address is 0x1D .
The accel values:
status_reg = 0xff , x =   -21 , y =    12 , z =  2007
status_reg = 0xff , x =   -20 , y =    20 , z =  2008
status_reg = 0xff , x =   -19 , y =     4 , z =  2008
status_reg = 0xff , x =   -20 , y =    29 , z =  2022
status_reg = 0xff , x =   -22 , y =    11 , z =  2008
status_reg = 0xff , x =   -18 , y =    33 , z =  2013
status_reg = 0xff , x =   -28 , y =    21 , z =  2005
status_reg = 0xff , x =   -16 , y =    30 , z =  2022
status_reg = 0xff , x =   -29 , y =    13 , z =  2010
status_reg = 0xff , x =   -14 , y =     6 , z =  2024

End of FlexIO I2C example .
FRDM-MCXE247
Hardware requirements
  • USB-C cable

  • FRDM-MCXE247 board

  • Personal Computer

Board settings

The flexio_i2c_read_accel_value example is requires connecting the FLEXIO pins with the I2C pins of accelerometer But this example no need special setting because of default FlexIO pins using is match with I2C pins of accelerometor on board.

Prepare the Demo
  1. Connect a mini USB cable between the PC host and the OpenSDA USB port on the board.

  2. Open a serial terminal on PC for OpenSDA 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 demo runs successfully, the log would be seen on the OpenSDA terminal like:

FlexIO I2C example read accelerometer value
Found an FXOS8700 on board, the device address is 0x1D .
The accel values:
status_reg = 0x81 , x =     7 , y =    11 , z =  1141
status_reg = 0x81 , x =    15 , y =     7 , z =  1133
status_reg = 0x81 , x =     3 , y =    15 , z =  1133
status_reg = 0x81 , x =     3 , y =     3 , z =  1155
status_reg = 0x81 , x =    -4 , y =    22 , z =  1163
status_reg = 0x81 , x =     0 , y =    15 , z =  1137
status_reg = 0x81 , x =    19 , y =    22 , z =  1125
status_reg = 0x81 , x =     0 , y =    26 , z =  1129
status_reg = 0x81 , x =    -8 , y =    15 , z =  1137
status_reg = 0x81 , x =     3 , y =    22 , z =  1144

End of FlexIO I2C example .
MCIMX93AUTO-EVK
Hardware requirements
  • USB Type-C cable

  • MCIMX93AUTO-EVK board

  • J-Link Debug Probe

  • 12V~20V power supply

  • Personal Computer

Board settings

The example requires doing connection between FLEXIO1(as master) pins and LPI2C1(as slave) pins.

  • LPI2C1_SCL(J17-16), IOMUXC_PAD_GPIO_IO02__FLEXIO1_FLEXIO02(J16-3) connected

  • LPI2C1_SDA(J17-18), IOMUXC_PAD_GPIO_IO03__FLEXIO1_FLEXIO03(J16-5) connected

Note

Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.

Prepare the Demo
  1. Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW2 to power on the board.

  2. Connect a USB Type-C cable between the host PC and the J26 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
MCIMX93-EVK
Hardware requirements
  • USB Type-C cable

  • MCIMX93-EVK board

  • J-Link Debug Probe

  • 12V~20V power supply

  • Personal Computer

Board settings

The example requires doing connection between FLEXIO1(as master) pins and LPI2C1(as slave) pins.

  • LPI2C1_SCL(J1005-3), IOMUXC_PAD_GPIO_IO02__FLEXIO1_FLEXIO02(J1001-3) connected

  • LPI2C1_SDA(J1005-5), IOMUXC_PAD_GPIO_IO03__FLEXIO1_FLEXIO03(J1001-5) connected

Note

Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.

Prepare the Demo
  1. Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.

  2. Connect a USB Type-C cable between the host PC and the J1401 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
MCIMX93W-EVK
Hardware requirements
  • USB Type-C cable

  • MCIMX93W-EVK board

  • J-Link Debug Probe

  • 12V~20V power supply

  • Personal Computer

Board settings

The example requires doing connection between FLEXIO1(as master) pins and LPI2C1(as slave) pins.

  • LPI2C1_SCL(J1005-3), IOMUXC_PAD_GPIO_IO02__FLEXIO1_FLEXIO02(J1001-3) connected

  • LPI2C1_SDA(J1005-5), IOMUXC_PAD_GPIO_IO03__FLEXIO1_FLEXIO03(J1001-5) connected

Note

Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.

Prepare the Demo
  1. Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.

  2. Connect a USB Type-C cable between the host PC and the J1401 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
MCIMX93-QSB
Hardware requirements
  • USB Type-C cable

  • MCIMX93-QSB board

  • J-Link Debug Probe

  • 12V~20V power supply

  • Personal Computer

Board settings

The example requires doing connection between FLEXIO1(as master) pins and LPI2C1(as slave) pins.

  • LPI2C1_SCL(J1406-3), IOMUXC_PAD_GPIO_IO02__FLEXIO1_FLEXIO02(J1401-3) connected

  • LPI2C1_SDA(J1406-5), IOMUXC_PAD_GPIO_IO03__FLEXIO1_FLEXIO03(J1401-5) connected

Note

Please run the application in Low Power boot mode (without Linux BSP). The IP module resource of the application is also used by Linux BSP. Or, run with Single Boot mode by changing Linux BSP to avoid resource conflict.

Prepare the Demo
  1. Connect 12V~20V power supply and J-Link Debug Probe to the board, switch SW301 to power on the board.

  2. Connect a USB Type-C cable between the host PC and the J1708 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either re-power up your board or launch the debugger in your IDE to begin running the example.

Running the demo

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

FlexIO I2C example read accelerometer value
Found a LSM6DSO on board, the device address is 0x6A.
The accel values:
status_reg = 0x5 , x = -28924 , y =  5127 , z = 24640
status_reg = 0x5 , x = 31748 , y =  9991 , z = 27456
status_reg = 0x5 , x = 28164 , y = 14599 , z = 15680
status_reg = 0x5 , x = 24068 , y = 21767 , z = 31808
status_reg = 0x5 , x = 13828 , y = -32505 , z = 22848
status_reg = 0x5 , x = 10500 , y = -26105 , z = 16192
status_reg = 0x5 , x =  6916 , y = -26105 , z = 17472
status_reg = 0x5 , x =  8452 , y = -25081 , z = 21056
status_reg = 0x5 , x =  8964 , y = -26105 , z = 22080
status_reg = 0x5 , x =  7940 , y = -24569 , z = 20800

End of I2C example .
FRDM-MCXE31B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE31B board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL J1-4 –> J7-6 SDA J1-2 –> J7-8

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) on the target board.

  2. Open a serial terminal with the following 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 demo runs successfully, the log would be seen on the MCU-Link terminal like:

FlexIO I2C example read accelerometer value

Found a FXL8974 on board , the device address is 0x18.

The accel values:

status_reg = 0x81 , x =   -50 , y =    11 , z =  2045
status_reg = 0x81 , x =   -50 , y =     9 , z =  2031
status_reg = 0x81 , x =   -49 , y =    12 , z =  2032
status_reg = 0x81 , x =   -50 , y =     6 , z =  2046
status_reg = 0x81 , x =   -51 , y =     8 , z =  2040
status_reg = 0x81 , x =   -45 , y =     4 , z =  2032
status_reg = 0x81 , x =   -52 , y =    13 , z =  2042
status_reg = 0x81 , x =   -53 , y =    12 , z =  2041
status_reg = 0x81 , x =   -51 , y =     8 , z =  2048
status_reg = 0x81 , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U32) is not welded on the board, the log would be seen on the MCU-Link terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .

FRDM-MCXE32B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE32B board

  • Personal Computer

Board settings

To make this example work, connections needed to be as follows:

FLEXIO_I2C        connected to  LPI2C1

SCL J1-4 –> J7-6 SDA J1-2 –> J7-8

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) on the target board.

  2. Open a serial terminal with the following 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 demo runs successfully, the log would be seen on the MCU-Link terminal like:

FlexIO I2C example read accelerometer value

Found a FXL8974 on board , the device address is 0x18.

The accel values:

status_reg = 0x81 , x =   -50 , y =    11 , z =  2045
status_reg = 0x81 , x =   -50 , y =     9 , z =  2031
status_reg = 0x81 , x =   -49 , y =    12 , z =  2032
status_reg = 0x81 , x =   -50 , y =     6 , z =  2046
status_reg = 0x81 , x =   -51 , y =     8 , z =  2040
status_reg = 0x81 , x =   -45 , y =     4 , z =  2032
status_reg = 0x81 , x =   -52 , y =    13 , z =  2042
status_reg = 0x81 , x =   -53 , y =    12 , z =  2041
status_reg = 0x81 , x =   -51 , y =     8 , z =  2048
status_reg = 0x81 , x =   -52 , y =     9 , z =  2036

End of I2C example .
Note:

if sensor chip(U32) is not welded on the board, the log would be seen on the MCU-Link terminal like:

FlexIO I2C example read accelerometer value

Not a successful i2c communication

End of I2C example .