A version of i2c_int_k_fb.c without reg_addr

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

A version of i2c_int_k_fb.c without reg_addr

838 次查看
huishao2
Contributor IV

Hi-

In thread MQX 4.0 I2C Locks Up, i2c_int_k_fb.c is used to replace interrupt based I2C driver to resolve lock up problem. Question is, is there a version of this driver that does NOT need to configure register address like the highlighted below (from AN4652)? My I2C device doesn't have a register inside for access.  It only receives simply read and write without need to specify register index.

ioctl(file_iic0, IO_IOCTL_I2C_SET_BAUD, &param);

i2c_buf_tx.dst_addr = 0x50; // The I2C slave address

i2c_buf_tx.reg_addr = 0; // You may view this as a register

// address or a command to slave.

i2c_buf_rx.dst_addr = 0x50; // The same as above, for receiving

i2c_buf_rx.reg_addr = 0; // The same as above, for receiving

for(i=0;i<8;i++) // initialize data

i2c_buf_tx.data[i] = 0xb0+i;

while(1)

{

printf("---------------------\n");

// send 4 bytes to slave

len = fwrite(&i2c_buf_tx, 1, 4, file_iic0);

标记 (4)
0 项奖励
回复
2 回复数

516 次查看
soledad
NXP Employee
NXP Employee

Hi Hui Shao,

Did you check the i2c driver that is included in MQX? You can find more information about this driver in the Freescale MQX™ RTOS I/O Drivers User’s Guide chapter 12.  (C:\Freescale\Freescale_MQX_4_1\doc\mqx)

In addition you can find some examples at the path: C:\Freescale\Freescale_MQX_4_1\mqx\examples

Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

516 次查看
huishao2
Contributor IV

Thanks Sol! It has been worked around by using the register address as a configuration byte.

Hui

0 项奖励
回复