Hello !
I can see I2C master freertos driver fsl_i2c_freertos.c has infinite time to wait end of transaction :
/* Wait for transfer to finish */
xSemaphoreTake(handle->semaphore, portMAX_DELAY); // forever ?
From other side HW timeout(s) for I2C peripheral is not set anywhere in driver.
Could it possible to guide how-to set properly all HW timeouts for master I2C interface and
modify (if need) i2c freertos driver for work properly with I2C peripheral when HW timeouts are configured.
Does exist any Application Note for configure I2C HW timeouts ?
Thank you !
Regards,
Eugene
Hi Eugene:
From hardware perspective, we need to configure below registers
I2Cx_SMB[TCKSEL] is used to select the clock source of the time out counter.
For example, if timeout is 30ms, TCKSEL=0, bus clock is 25M
I2C0_SLTL = I2C_SLTL_SSLT(0xC7); /* I2C0_SLTL: SSLT=0xC7 */
I2C0_SLTH: SSLT=0x2D /* Set SCL low timeout register low */
I2C0_SLTH = I2C_SLTH_SSLT(0x2D); /* Set SCL low timeout register high */
For FreeRTOS driver perspective, I would suggest you try to configure the timeout value from portMAX_DELAY to a specified value.
xSemaphoreTake(handle->semaphore, portMAX_DELAY); // forever
Regards
Daniel
Hi Daniel !
Do I undestand right and those timeouts e.g SCL low and High are applicable to I2C master and slave interfaces ?
Can it be so that other changes are need to fsl_i2c driver ?
It is not visible any where if timeout enabled interrupts are enabled or if they occurs and analysed somewhere ?
Even I set relevant timeout values, I should enable detection of it and able to process relevant interrupts and clean those.
May be you have somewhere new advanced fsl i2c driver ?
Regards,
Eugene
Yes, you are right. those timeouts e.g SCL low and High are applicable to I2C master and slave interfaces.
Sorry currently no advanced fsl i2c driver for this.
Regards
Daniel