Hi,
Regarding your question about the api function parameters declaration, pls refer to IIC driver description in chaper 28.7 I2C HAL driver in the Kinetis_SDK v1.3 API Reference Manual.pdf. I copy it here.
We have also example for the master mode of IIC. refer to the example in SDK:
D:\Freescale\KSDK_1.3.0\examples\frdmk64f\driver_examples\i2c\i2c_blocking\master\kds
Foe the parameter of api function:
- i2c_status_t I2C_DRV_MasterReceiveDataBlocking(uint32_t instance,
- const i2c_device_t * device,
- const uint8_t * cmdBuff,
- uint32_t cmdSize,
- uint8_t * rxBuff,
- uint32_t rxSize,
- uint32_t timeout_ms);
The instance is the index of IIC module, for example, the processor has 3 IIC module: IIC0/IIC1/IIC2, if you use IIC0 module, the instance is 0, if you use IIC1 module, the instance is 1.
The device is a structure which is declared for example as:
i2c_device_t device =
{
.address = 0x68U, //slave IIC device address
.baudRate_kbps = 400 // 400 Kbps
};
Based on your parameter:
To get the accelero the register is 0x3B
The adress of my IMU is 0x68
and the size of data is 6 octets
I think you can declare the parameters:
#define IIC_INSTANCE 0 //if you use IIC0 module
uint8_t cmd=0x3b; //register address
uint8_t count=6;
uint8_t buffer[10];
I2C_DRV_MasterReceiveDataBlocking(IIC_INSTANCE, &device,&cmd,1,&buffer[0],count,1000);
As you know, when you read data from IIC slave, this is the sequence:
send:slave address|write,send: register address,send:repeat start,send:slave address|read,receive data....

Hope it can help you.
BR
XiangJun Rong