Freedom Kl46Z i2c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freedom Kl46Z i2c

Jump to solution
1,452 Views
OROZO
Contributor II

Hello every body,

 

I'm trying to implement an i2c communication between the FRDM-KL46Z and the MMA8451Q accelerometer but unfortunetly I don't understand the KSDK ver 1.3 API Reference Manual (I think traditional PExpert was a lot more helpful), so I want to know somebody who can explain me the following function:

 

i2c_status_t I2C_DRV_MasterSendDataBlocking ( uint32_t instance, const

i2c_device_t   device, const uint8_t   cmdBuff, uint32_t cmdSize, const uint8_t

  txBuff, uint32_t txSize, uint32_t timeout_ms )

 

I don't understand the cmdBuff purpouse, what kind of information should be filled in? I think the txBuff already contains the bytes to be transmitted to the slave.

 

The only way this function returns a succesful flag is with cmdBuff = NULL an cmd size = 0. 

 

Another issue is that the MMA8451Q manual explain the need of a Repeated Start, and as I bealive there is no way to do that with the standar i2c API, or at least I have no idea how to do that.

 

I think the KSDK API reference manual could be done a lot better by freescale.

Labels (1)
1 Solution
821 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Oscar,

These two parameters are about the slave register you wan to write.

“cmdBuff” is the address of the slave register , the size is the size of slave register (for example , if the register is 1byte , the here you can write 1).

How to configure these two parameters you need Check the Reference manual of MMA8451Q .

Hope it helps

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

Have a great day,
Alice

View solution in original post

2 Replies
822 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Oscar,

These two parameters are about the slave register you wan to write.

“cmdBuff” is the address of the slave register , the size is the size of slave register (for example , if the register is 1byte , the here you can write 1).

How to configure these two parameters you need Check the Reference manual of MMA8451Q .

Hope it helps

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

Have a great day,
Alice

821 Views
OROZO
Contributor II

Thank you Alice,

I'm going to try to implement the function again this weekend.

0 Kudos
Reply