Read and write over I2C: Meaning of the parameter "ticks_to_wait"

MajinFoo
Posts: 9
Joined: Sun Jan 21, 2018 9:06 pm

Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby MajinFoo » Thu Feb 22, 2018 9:57 am

Hello,

i use esp-idf to write and read data over the I2C bus. To send or read data I have to call the function below:

esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle, TickType_t ticks_to_wait)


Can someone explain the meaning of the parameter "ticks_to_wait"? As far as I know this function sends or writes all data in the command queue. Maybe this is a timeout parameter?

In the documentation I could only find the following information:

Parameters
  • i2c_num: I2C port number
  • cmd_handle: I2C command handler
  • ticks_to_wait: maximum wait ticks.

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby ESP_Sprite » Thu Feb 22, 2018 10:08 am

Yes, it is a timeout value. If the queue is full for that amount of ticks, the call aborts instead of waiting longer.

MajinFoo
Posts: 9
Joined: Sun Jan 21, 2018 9:06 pm

Re: Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby MajinFoo » Thu Feb 22, 2018 2:33 pm

That's already solved my question. Thanks for your reply!

User avatar
rudi ;-)
Posts: 1730
Joined: Fri Nov 13, 2015 3:25 pm

Re: Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby rudi ;-) » Thu Feb 22, 2018 8:43 pm

ESP_Sprite wrote:Yes, it is a timeout value. If the queue is full for that amount of ticks, the call aborts instead of waiting longer.
hi jeroen, is it compare with clock stretching?
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby ESP_Sprite » Sat Feb 24, 2018 3:52 am

No, it has nothing to do with clock stretching (well, maybe very indirectly); it is just the timeout for pushing things into the FreeRTOS queue in the I2C driver.

User avatar
rudi ;-)
Posts: 1730
Joined: Fri Nov 13, 2015 3:25 pm

Re: Read and write over I2C: Meaning of the parameter "ticks_to_wait"

Postby rudi ;-) » Sat Feb 24, 2018 4:02 am

ah, lifetime cycle for the task?
what happens if the timeout trigger? (the call aborts)
can we repeat ? repeat count?

... ( i am not deep in this theme ) ...

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 94 guests