AnsweredAssumed Answered

STM32L432 - I2C Address Off By 1-Bit

Question asked by Nolan L on Feb 24, 2017
Latest reply on Feb 26, 2017 by Nolan L


I recently brought up the I2C using the STM32CubeMx(4.19.0) and STM32CUBE_FW_L4_v1.6.0  and I was attempting to write to a slave device with an address of 0x2A.


I noticed that my slave device was NACK-ing back. Upon further inspection, it looks as if the address is shifted to the right by 1-bit, resulting in an address of 0x15 when transmitted on the line.


To test this theory out, I purposefully used an address that is shifted 1-bit to the left: 0x54. Doing so registered an address of 0x2A on the physical bus which then I was able to hit the register with some data.


I couldn't find any literature that required me to shift my I2C address left by 1-bit to have it address correctly. Has anyone else run into this issue?


My solution is a work around but I would like to understand the root cause of this issue; whether I introduced it or possibly an inherent issue with the HAL drivers?




Slave Address:

//#define I2C_ADDRESS     0x2A
#define I2C_ADDRESS         0x54
#define TXBUFFERSIZE      0x02



uint8_t i2cTxBuffer[TXBUFFERSIZE] = {0x00, 0x01};

int main(void)

/* Initialize HAL, Clocks, GPIO and I2C */

  if(HAL_I2C_Master_Transmit_IT(&hi2c1, (uint16_t)I2C_ADDRESS, (uint8_t*)i2cTxBuffer, TXBUFFERSIZE)!= HAL_OK)
    /* Error_Handler() function is called when error occurs. */

  while (1)



I2C Init:

static void MX_I2C1_Init(void)

  hi2c1.Instance = I2C1;
  hi2c1.Init.Timing = 0x10915F83;
  hi2c1.Init.OwnAddress1 = 0;
  hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
  hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
  hi2c1.Init.OwnAddress2 = 0;
  hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
  hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
  hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
  if (HAL_I2C_Init(&hi2c1) != HAL_OK)

    /**Configure Analogue filter
  if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)



Output Using Slave Address 0x54:


Output Using Slave Address 0x2A:


Datasheet I2C Output: