2026-01-11 2:23 PM
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
Solved! Go to Solution.
2026-01-11 3:19 PM
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".
2026-01-11 3:19 PM
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".
2026-01-11 11:56 PM
Thank you