11 Replies Latest reply on Nov 10, 2014 8:50 AM by userc_5197

    i2c transfert reads one more byte than requested

      Hello.

       

      I've found a bug in the i2c_transfer_message_no_dma function.

      wiced 3.0.0, STM32F2, platform_i2c.c line 685.

       

      The i2c transfert function reads one more byte than requested, making the cursor of my eeprom device I'm driving one byte ahead, making next sequencial read erroneous.

       

      Existing code:

       

                  if ( i == ( message->rx_length - 1 ) )
                  {
                      /* setup NACK for the last byte to be received */
                      I2C_AcknowledgeConfig( i2c->port, DISABLE );
                  }

       

      Replace with:

       

                 if(message->rx_length == 1) continue;


                  if ( i == ( message->rx_length - 2 ) )
                  {
                      /* setup NACK for the last byte to be received */
                      I2C_AcknowledgeConfig( i2c->port, DISABLE );
                  }