i2c Read cannot send nack Sum stop bit

Publish in 2022-09-11 21: 58: 04

Screenshot_20220911_215436. png
Screenshot_20220911_215459. png

Read and write the logic analyzer waveform as shown in the figure above

The code is as follows
void QMC5883_Write (u8 addr, u8 data)
{

tls_i2c_write_byte (QMC5883_SlaveAddress,  1) ; 
tls_i2c_wait_ack () ; 
tls_i2c_write_byte (addr,  0) ; 
tls_i2c_wait_ack () ; 
tls_i2c_write_byte (data,  0) ; 
tls_i2c_wait_ack () ; 
 tls_i2c_stop () ; 

}

u8 QMC5883_Read_Byte (u8 addr)
{

uint8_t data; 
tls_i2c_write_byte (QMC5883_SlaveAddress,  1) ; 
tls_i2c_wait_ack () ; 
tls_i2c_write_byte (addr,  0) ; 
tls_i2c_wait_ack () ; 
tls_i2c_write_byte (QMC5883_SlaveAddress+1,  0) ; 
tls_i2c_wait_ack () ; 
data = tls_i2c_read_byte (0,  1) ; 
return data; 

}
Writes can normally produce stop bits, But the read cannot be generated, Use is w800 The latest library functions.

See more

follower
0
Be viewed
1. 5k
ZYQ
ZYQ 2022-09-12
我已不再支持 W80X 任何Related problemthe回复, 请大家不要私信, 有problem找 isme 谢谢

image. png

1 Multiple replies

Write an answer

Please login to post your answer, Click to log in

publish
problem

Share
Friend

Cell phone
browse

Scan code mobile browsing