This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32F103 reading INA219 register using I2C

Hello. I have been working with this INA219 chip for a while. I am able to read the output voltage and set the registers. But I am having troubles reading back the registers to check what I have written. I have been studying datasheet for a while and I still cant fully understand the process of reading the register. I am using HAL functions for i2c reads and writes. Link to datasheet: https://www.ti.com/lit/ds/symlink/ina219.pdf?HQS=TI-null-null-mousermode-df-pf-null-wwe&ts=1592890984516&ref_url=https%253A%252F%252Feu.mouser.com%252F

write and read functions:

Lets say I have written in 2 registers and want to read only one of them:

From what I understood from the datasheet, In order to read the register, the write command with 0 data has to be initiated to show what register you want to read. After that, A read command is initiated. A write and Read command difference is the first bit of the slave address ( either HIGH or LOW). Could someone give me any tips how do I properly initiate those two commands to read back a register

0