K82 : I2C freertos driver , infinite timeout ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K82 : I2C freertos driver , infinite timeout ?

799 Views
EugeneHiihtaja
Senior Contributor I

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

0 Kudos
3 Replies

686 Views
danielchen
NXP TechSupport
NXP TechSupport

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.

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

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

0 Kudos

686 Views
EugeneHiihtaja
Senior Contributor I

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

0 Kudos

686 Views
danielchen
NXP TechSupport
NXP TechSupport

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

0 Kudos