cancel
Showing results for 
Search instead for 
Did you mean: 

INA226

SGian.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Super User

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".

 

View solution in original post

2 REPLIES 2
Pavel A.
Super User

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
Senior

Thank you