K82 : I2C_RTOS_Transfer() timeout

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

K82 : I2C_RTOS_Transfer() timeout

526 Views
EugeneHiihtaja
Senior Contributor I

Hello !

I'm using I2C master API for FreeRTOS and would like to estimate max timeout in case if I2C transaction can't be completed.

In API I2C_RTOS_Transfer() I can see infinite waiting of semaphore:

/* Wait for transfer to finish */
xSemaphoreTake(handle->semaphore, portMAX_DELAY);

What timeout mechanisms is exists inside I2C hardware what can garantie if I2C interrupt in controller is happens in any case for unblock waiting if semaphore in reasonable time ?

Regards,

Eugene

0 Kudos
2 Replies

417 Views
danielchen
NXP TechSupport
NXP TechSupport

HI Eugene:

In hardware, there is timeout parameters allows a master or slave to conclude that a defective devices is holding the clock low indefinitely or a master is intentionally trying to drive devices off the bus. The slave device must release the bus when it detects any single clock held low longer that Ttimeout .

The timeout value can be set via I2C SCL Low Timeout Register Hig.h and I2C SCL Low Timeout Register Low

pastedImage_1.png

pastedImage_2.png

Please refer to the K82P121M150SF5RM for more details

Regards

Daniel

0 Kudos

417 Views
EugeneHiihtaja
Senior Contributor I

Hi Daniel !

Thank you !

I have checked SDK examples and do not find any place where those registers are set :

__IO uint8_t SLTH; /**< I2C SCL Low Timeout Register High, offset: 0xA */
__IO uint8_t SLTL; /**< I2C SCL Low Timeout Register Low, offset: 0xB */

It means by default timeout has infinite value ?

In what units those registers should be programmed ? Period of clock 400kHz or some other ones ?

Regards,

Eugene

0 Kudos