AnsweredAssumed Answered

A version of i2c_int_k_fb.c without reg_addr

Question asked by Hui Shao on Sep 23, 2014
Latest reply on Oct 6, 2014 by Hui Shao

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);

Outcomes