2020-07-22 07:24 PM
Hi all
I want to read i2c data of bme280 sensor. I must read it sequential as follows:
Start
Slave address ack
Internal register address Ack
Repeated start
Slaveaddress ack
Data to read
Stop
I do that and every thing is ok in logic onalyzer. For example chip id is read correctly in logic analyzer but HAL_I2C_Master_Sequential_Transmit_IT function does not update data in recieve buffer.
How can i solve this problem??
2020-07-23 08:35 AM
HAL_I2C_Master_Sequential_Transmit_IT is a transmit function. It doesn't receive data.
You'll need to use HAL_I2C_Master_Seq_Receive_IT to receive data.
If you still have issues, post your code and logic analyzer data.
2020-07-25 02:13 AM
2020-07-25 02:35 AM
2020-07-25 02:41 AM
For register reading one must use HAL_I2C_Mem_Read...(), not those separate functions, which put stop bit in the middle of transfer.
2020-07-25 03:00 AM
I should use the following relation to read data
Start
Slave addr
Internal reg addr
Repeated start
Slave addr
Reading n byte
Stop
Beacau oof need to repeat start i have used sequential functions which are ok.
Hal_i2c_mem_read doesnt support above hirerchy
2020-07-25 03:22 AM
You're wrong - it does it all in a single call because that's the whole purpose of that function!
2020-07-25 03:25 AM
Could you please write me the format which i must use from. Hal_i2c_mem_read for use in repeat start mode
2020-07-25 03:29 AM
Just use HAL_I2C_Mem_Read_IT() to read the device registers. It's not even clear what you cannot understand here...
2020-07-25 04:31 AM
I can understand but it generates stop. However we need repeat start.
Bad answer