Skip to main content
SGian.1
Associate III
January 11, 2026
Solved

INA226

  • January 11, 2026
  • 2 replies
  • 241 views

Hi there!

I start to work with this sensor and i want use this function

HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress,
uint16_t MemAddSize, uint8_t *pData, uint16_t Size)

so the pointer address register of the sensor is 8 bit but the data  are 16bit is correct if i do that  example:

 

 data[0] = MSB;

 data[1]=LSB; 

HAL_I2C_Mem_Write_IT(&hi2c1, INA226_Addr , 0x00, I2C_MEMADD_SIZE_8BIT, data, 2);

 

and i do the same when i want read data from register.

Sorry if i ask a silly question 

thank you 

Sergio

Best answer by Pavel A.

For some reason many I2C devices use big endian data format. So yes, [0] = MSB, [1] = LSB.

Just run your code and test. Start from reading known registers before attempting something "destructive".

 

2 replies

Pavel A.
Pavel A.Best answer
Super User
January 11, 2026

For some reason many I2C devices use big endian data format. So yes, [0] = MSB, [1] = LSB.

Just run your code and test. Start from reading known registers before attempting something "destructive".

 

SGian.1
SGian.1Author
Associate III
January 12, 2026

Thank you