The I2C syntax is unclear to me in the datasheet:
https://www.ti.com/lit/ds/symlink/bq27742-g1.pdf?ts=1611584050250&ref_url=https%253A%252F%252Fwww.google.com%252F
There are "Command Codes" (Table 8) which are of the syntax "0x00 and 0x01", then there are "Subcommand Codes" of syntax "0x0000". In Section 7.6.2 I2C Interface, (Figure 16.c) it shows only an 8 bit CMD[7:0] for a 1-byte read.
How are we actually supposed to implement the Command Codes? Are the two bytes supposed to be separated by an Acknowledge, or just write all 16 bits at once? I.e.
Option 1:
Option2:
Or have I misunderstood this all together?
What about for the subcommands? Would you just extend the CMD sections of Option 1 or 2 to contain 4 bytes?
Also, I was reading elsewhere about some people having issues with endiness here. Could you clarify how you would read the Temperature (i.e. command code 0x06, and 0x07) in addition to how you would read the HW_VERSION (i.e. subcommand 0x0003?
Assuming Option 1, would these be
- [S][1010101][0][A][0x06][A][0x07][A][Sr][1010101][1][A][DATA[0:7][N][P]
- [S][1010101][0][A][0x00][A][0x01][A][0x00][A][0x03][A][Sr][1010101][1][A][DATA[0:7][N][P]
?