A version of i2c_int_k_fb.c without reg_addr

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

A version of i2c_int_k_fb.c without reg_addr

818件の閲覧回数
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 返答(返信)

496件の閲覧回数
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!
-----------------------------------------------------------------------------------------------------------------------

496件の閲覧回数
huishao2
Contributor IV

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

Hui

0 件の賞賛
返信