2 Replies Latest reply on Dec 20, 2018 7:45 PM by ZhengbaoZ_96

    couldnot able to access I2C based li-ion gauge IC (part no: LC709203F)  BCM4390x controller (part no ISM43907-L170)

    mojac_3939751

      Hello,

             

               We are using BCM4390X controller(used part: ISM43907-L170) in one of our project.

               we have connected li-ion gauge IC(part no: LC709203F) to BCM4390X controller through I2C interface.

               we are facing probe failure, read/write failure in both I2c standard mode(100khz) and high speed mode(400 khz).

               When we are trying in i2c low speed mode(10Khz) only, wiced_i2c_probe is getting succeed        

      we are trying to read/write I2C based li-ion gauge IC(part no: LC709203F), li-ion gauge IC always reads default as 0xFF only on I2C low speed mode.

        • 1. Re: couldnot able to access I2C based li-ion gauge IC (part no: LC709203F)  BCM4390x controller (part no ISM43907-L170)
          mojac_3939751

          hello,

           

                 Please ignore the previous post as it mistakenly sent while typing,

           

          Hello,

           

                

           

                   We are using BCM4390X controller(used part: CYW943907AEVAL-1F) in one of our project.

           

                   we have connected li-ion gauge IC(part no: LC709203F) to BCM4390X controller through 2nd I2C interface bus.

           

                   we are facing probe(wiced_i2c_probe) failure, read & write(wiced_i2c_read/write) failure in both I2c standard mode(100khz) and high speed mode(400 khz).

           

                   When we are trying in i2c low speed mode(10Khz) only, wiced_i2c_probe is getting succeed, it tells that device is present on the bus.

                   And also when reading anyof the gauge ic registers, via wiced_i2c_write(StartFlag,regAddr, 1byte) & wiced_i2c_read(Start+stopFlag, reading 3 bytes namely lsb 8bit,msb 8bit & crc 8bit),

                   function return value is success. But the actual data read on wiced_i2c_read() is always 0xFF(lsb) 0xFF(msb) 0xFF(crc) only. ie., wrong value.

           

                   But when other i2c devices(8 bits registers) on the same bus are working properly.

                   Below we copied our program for your reference.

                   Can you plz kindly reply us what could be problem for this issue which we are facing

           

                   Thanking you.

                   Jaman

          ================================================================================================

          static wiced_result_t lcf709203f_reg_read(uint8_t regaddr, uint16_t *regval)

          {

              wiced_result_t result = WICED_SUCCESS;

              uint8_t cal_crc, rbuf[3]={0}, wbuf[2]={0};

           

              wbuf[0] = regaddr;

              wbuf[1] = 0;

           

              result = wiced_i2c_write( &i2c_device_lcf709203f, WICED_I2C_START_FLAG, wbuf, 1 ); 

              if( result != WICED_SUCCESS ) WPRINT_APP_INFO( ( "LCF709203F Read failed - write\n"));

              result = wiced_i2c_read( &i2c_device_lcf709203f, WICED_I2C_START_FLAG | WICED_I2C_STOP_FLAG, rbuf, 3 ); 

              if( result != WICED_SUCCESS ) WPRINT_APP_INFO( ( "LCF709203F Read failed - read\n"));

           

              if( result != WICED_SUCCESS )

              {

                  WPRINT_APP_INFO( ( "LCF709203F Read failed! addr 0x%x, reg 0x%02x, val 0x%02x\n", i2c_device_lcf709203f.address, regaddr, (((unsigned int)rbuf[1] << 8) | rbuf[0]) ));

                  return WICED_ERROR;

              }

           

             //NOTE: Here rbuf[0],rbuf[1] & rbuf[2] are always 0xFF, despite result=WICED_SUCCESS

           

              uint8_t crc_buf[5] = { LC709203F_ADDR, regaddr, ((LC709203F_ADDR ) | 0x01), rbuf[0], rbuf[1] };

              cal_crc = _get_crc(crc_buf, 5);

              if (cal_crc != rbuf[2]) {

                  WPRINT_APP_INFO( ( "LCF709203F Read CRC Error! cal_crc 0x%X, rec_buf 0x%X,0x%X,0x%X, regval 0x%0X\n", cal_crc,rbuf[0], rbuf[1], rbuf[2], *regval));

                  return WICED_ERROR;

              }

           

              *regval = (((unsigned int)rbuf[1] << 8) | rbuf[0]);

           

              return WICED_SUCCESS;

          }

           

          static wiced_result_t lcf709203f_reg_write(uint8_t regaddr, uint16_t regval)

          {

              wiced_result_t result = WICED_SUCCESS;

              uint8_t crc_buf[4] = { LC709203F_ADDR, regaddr, (regval & 0x0F), (regval & 0xF0)>>8 };

              uint8_t send_buf[3] = { crc_buf[2], crc_buf[3], _get_crc(crc_buf, 4) };

              uint8_t wbuf[4]={0};

           

              wbuf[0] = regaddr;

              wbuf[1] = send_buf[0];

              wbuf[2] = send_buf[1];

              wbuf[3] = send_buf[2];

           

           

              result = wiced_i2c_write( &i2c_device_lcf709203f, WICED_I2C_START_FLAG | WICED_I2C_STOP_FLAG, wbuf, 4 );

           

              WPRINT_APP_INFO( ( "LCF709203F WRITE ! addr 0x%x, reg 0x%02x, val 0x%02x\n", i2c_device_lcf709203f.address, regaddr, regval ));

           

              if( result != WICED_SUCCESS )

              {

                  WPRINT_APP_INFO( ( "LCF709203F write failed! addr 0x%x, reg 0x%02x, val 0x%02x\n", i2c_device_lcf709203f.address, regaddr, regval ));

                  return WICED_ERROR;

              }

           

              return WICED_SUCCESS;

          }

            

               uint16_t rbuf = 0;

              /* 1. Read Register ID: */

              lcf709203f_reg_read(LC709203F_REG_ID/*0x11*/, &rbuf);

              WPRINT_APP_INFO( ( "LC709203F_REG_ID = 0x%04X\n", rbuf));  //NOTE:'rbuf' PRINTING as 0xFFFF

          ================================================================================================

          • 2. Re: couldnot able to access I2C based li-ion gauge IC (part no: LC709203F)  BCM4390x controller (part no ISM43907-L170)
            ZhengbaoZ_96

            Hello:

             

            How many devices are connected in one I2C interface ?   I think you need to add pull-up resistor on the bus with a value like 4.7k  .