5.7.7. I2C Master Example¶
This page is regarding the documentation on I2CM, for more information on I2CM Transaction, See Section 3.6 I2CM / Secure Sensor
5.7.7.1. Prerequisites¶
Bring Up Hardware. (Refer Development Platforms)
Connection to be done for I2C Master example.

Here is a photograph of above wiring diagram.

Note
We are using 2nd freedom K64F board only for connecting Accelerometer device to I2CM.
Short Jumper J9 & J10 of se050ARD board.
5.7.7.1.1. Disable K64F on board 2¶
Warning
If the K64F of the 2nd board doing some operations on I2C Pins, this demo would not work.
Follow below steps to make this demo work.
Flash
frdmk64f_nop_wfi.bin
binary located atdemos/se05x/se05x_I2cMaster
directory to K64F board.This binary will put K64F in unoperation state and we will have easy access to Accelerometer through I2C pins.
Below is the c code
int main(void)
{
/* Init board hardware. */
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
__disable_irq();
while (1)
{
__disable_irq();
__WFI();
}
}
5.7.7.2. About the Example¶
This example reads Accelerometer data via the I2C master interface.
The Accelerometer on other K64F is used as an I2C Slave.

It uses the following APIs and data types:
kSE05x_I2CM_Configure
fromSE05x_I2CM_TLV_type_t
kSE05x_I2CM_Write
fromSE05x_I2CM_TLV_type_t
kSE05x_I2CM_Read
fromSE05x_I2CM_TLV_type_t
kSE05x_I2CM_Baud_Rate_400Khz
fromSE05x_I2CM_Baud_Rate_t
5.7.7.3. Running the Demo¶
Import project
cmake_project_frdmk64f
fromsimw-top/projects
directory.Mention
BUILD_TARGET
asse05x_I2cMaster
orse05x_I2cMasterWithAttestation
inDebug/Makefile
.Build the project and flash binary inside
FRDMK64F_SE050ARD
board.Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Rotate second K64F in any direction.
If everything is setup correctly the output would be as follows:
App:INFO :I2CM example to read Accelerometer value
App:INFO :x = 113 , y = -73 , z = 2118
App:INFO :x = 109 , y = -67 , z = 2103
App:INFO :x = 108 , y = -68 , z = 2120
App:INFO :x = 117 , y = -69 , z = 2109
App:INFO :x = 117 , y = -71 , z = 2105
App:INFO :x = 111 , y = -71 , z = 2108
App:INFO :x = 115 , y = -72 , z = 2104
App:INFO :x = 117 , y = -69 , z = 2122
App:INFO :x = 115 , y = -73 , z = 2120
App:INFO :x = 115 , y = -74 , z = 2114
App:INFO :I2CM test completed !!!...