AnsweredAssumed Answered

IIC communication problem with MC56F84763

Question asked by Peter Cernan on Mar 5, 2018
Latest reply on Mar 13, 2018 by Peter Cernan

Hello, I'm working on control board with MC56F84763 (I'm using CW10.7 + Quickstart 2.6 to develop the application).

 

I faced problem with IIC interface. I'm able to write data to PCF8574 I/O Exander using following code (I'm not using ISR, just calling function in main()):

 

 /* initialize IIC write transaction with PCF8574 - address 0x40 for write */
  while (ioctl(IIC_0, IIC_GET_BUS_BUSY, NULL))
  {
  }
 /* select transmit mode */
  ioctl(IIC_0, IIC_TX_RX_MODE, IIC_TRANSMIT);
  ioctl(IIC_0, IIC_MASTER_SLAVE_MODE, IIC_MASTER);
 /* write I2C address */
 ioctl(IIC_0, IIC_WRITE_DATA, 0x40);
 archDelay(10000);
  while (ioctl(IIC_0, IIC_GET_RX_ACK, NULL))
 {
 }
 /* write data */
 ioctl(IIC_0, IIC_WRITE_DATA, LED_config);
 archDelay(10000); 
  while (ioctl(IIC_0, IIC_GET_RX_ACK, NULL))
  ioctl(IIC_0, IIC_MASTER_SLAVE_MODE, IIC_SLAVE);
I tried to use similar function for IIC read but it does not work:
     while (ioctl(IIC_0, IIC_GET_BUS_BUSY, NULL))
     {
     }
    /* select transmit mode */
     ioctl(IIC_0, IIC_TX_RX_MODE, IIC_TRANSMIT);
     ioctl(IIC_0, IIC_MASTER_SLAVE_MODE, IIC_MASTER);
    /* write I2C address - PCF8574 address 0x41 for port reading */
     IIC_0_write_byte(0x41);
     /* read data from PCF8574T */
      ioctl(IIC_0, IIC_TX_RX_MODE, IIC_RECEIVE);
      archDelay(10000);
     Button_temp_1 = ioctl(IIC_0, IIC_READ_DATA, NULL);

 

     ioctl(IIC_0, IIC_MASTER_SLAVE_MODE, IIC_SLAVE);
Any idea what's wrong in IIC read function?
Thanks in advance
Peter

Outcomes