2 different i2c timeout values: i2c_set_timeout vs i2c_master_cmd_begin

atx823
Posts: 13
Joined: Fri Jan 07, 2022 6:51 pm

2 different i2c timeout values: i2c_set_timeout vs i2c_master_cmd_begin

Postby atx823 » Mon Jan 10, 2022 2:22 am

A timeout can be specified using i2c_set_timeout, or you can specify ticks_to_wait as an argument to i2c_master_cmd_begin.

How exactly does each of these values work?

Some devices have variable delays between receiving a command and issuing a reply. In such cases you want to wait the minimum amount of time and then start polling for a reply.

Looking at the source for i2c_master_cmd_begin, it seems as tick_to_wait is used as the timeout for xQueueReceive. If this times out, the bus is reset. From my experiments it seems that this resets the slave device, making polling impossible.

Who is online

Users browsing this forum: Google [Bot] and 75 guests