K82 : I2C_RTOS_Transfer() timeout

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

K82 : I2C_RTOS_Transfer() timeout

552 次查看
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 项奖励
2 回复数

443 次查看
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 项奖励

443 次查看
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 项奖励