Page 1 of 1

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

Posted: Thu Feb 22, 2018 9:57 am
by MajinFoo
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.

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

Posted: Thu Feb 22, 2018 10:08 am
by ESP_Sprite
Yes, it is a timeout value. If the queue is full for that amount of ticks, the call aborts instead of waiting longer.

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

Posted: Thu Feb 22, 2018 2:33 pm
by MajinFoo
That's already solved my question. Thanks for your reply!

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

Posted: Thu Feb 22, 2018 8:43 pm
by rudi ;-)
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?

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

Posted: Sat Feb 24, 2018 3:52 am
by ESP_Sprite
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.

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

Posted: Sat Feb 24, 2018 4:02 am
by rudi ;-)
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 ;-)