How to use I2C in non-blocking mode in Kinetics MK22 using MQX RTOS without KSDK ?

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

How to use I2C in non-blocking mode in Kinetics MK22 using MQX RTOS without KSDK ?

1,146 次查看
premranjan
Contributor I

I'm using MK22 using MQX RTOS  without KSDK. On implementing I2C with Slave absent, the code gets hanged in fwrite() finction. There's is no timeout for I2C trying to write into slave. So I want a work around using I2C in Non-blocking mode.

0 项奖励
回复
3 回复数

913 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Prem:

Do you mean you are using classic MQX ? Which version, 4.0,4.1 or 4.2?

Regards

Daniel

0 项奖励
回复

913 次查看
premranjan
Contributor I

MQX 4.2 I'm using

0 项奖励
回复

913 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Prem:

I would suggest you refer to the I2C  driver in old MQX version.

The I2C driver interrupt-driven IO driver, which was included in version 4.1.0 and earlier, supported the asynchronous (non-blocking) access only. In the version 4.1.1 the Kinetis driver variant was updated to support synchronous blocking access to the IO read and write funcitonality. When the application calls thee _io_read() function, the function returns when the driver reads the specified number of bytes. The calling task is blocked until the complete buffer is read.

Please compare the two drivers, in the new version, a semaphore was added in mqx/source/io/i2c/int/i2c_int_ki2c.c 

In function _ki2c_int_init.

   _lwsem_create((LWSEM_STRUCT_PTR)(&(io_info_ptr->LWSEM)), 0);

unfortunately there is no existing code as you expected.


Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please mark correct or click the helpful button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复