S32K322 LPI2C Reading

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K322 LPI2C Reading

793件の閲覧回数
vignesh3
Contributor II

I need to read 5 bytes of data from slave through I2C DMA, 

For this I need to send the starting register address of the slave to read the data that precent inside the particular 2 byte address, So I need send the 2byte address like "Lpi2c_Ip_MasterSendData(I2C_0, address, 2, false);" here I should not give the stop condition on the I2C bus right?

Then I need to receive the 5 bytes of data by calling "Lpi2c_Ip_MasterReceiveData(I2C_0, rx_data, 2, true)"; but here I can generate the start condition right?

0 件の賞賛
返信
1 返信

779件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, your understanding is correct. Lpi2c_Ip_MasterReceiveData is generating repeated start. In function you should have 5 for byte to be read.
Also if using non-blocking function you should check transfer status before calling Receive function and for waiting for slave response using  Lpi2c_Ip_MasterGetTransferStatus(). Or use blocking functions. For example 

Lpi2c_Ip_MasterSendDataBlocking(I2C_0, address, 2, false, timeout);
Lpi2c_Ip_MasterReceiveData(I2C_0, rx_data, 5, true);
while(((Lpi2c_Ip_MasterGetTransferStatus(I2C_0, NULL_PTR)) == LPI2C_IP_BUSY_STATUS)){};

BR, Petr

0 件の賞賛
返信