2
\$\begingroup\$

I am working on PMM240 (a power management board for RRC battery) with RRC2054-2 battery.

  1. First when I only connect PMM240, the manual has address 0x20, but when I scan the port, I have two addresses, 0x20 and 0x21.

  2. If I connect the battery, in addition to 0x20 and 0x21 for PMM240, I also find 0x16 and 0x17 for the RRC battery.

When I do transmit or receive command, shall I stick to one address? By default the first address?

\$\endgroup\$
1
\$\begingroup\$

This is why I really don't like 8 bit I2C addresses. The address phase of I2C transactions transfers 8 bits - 7 address bits and one read/write bit, indicating the type of operation to follow. If you consider only the 7 address bits to be the address bits, then every device has exactly one address in the range of 0-127. However, some devices and/or APIs consider all 8 bits to be address bits. If you do that, then every device has two adjacent addresses that differ in only the LSB, a read address and a write address. And maybe the API overrides the read/write bit when you ask it to perform an operation, maybe it doesn't. With 7 bit addresses, all of this is completely unambiguous.

My guess is that the scan was done over the 8 bit address space and is hence reporting all devices twice. Which address to use depends on how the API is implemented. Either you have to use the read address for reads and the write address for writes, or you can just pick one of the two for all operations.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

SMBus uses the same kind of addressing scheme as I2C (ref). A device has a 7-bit address with the least significant bit used to indicate data direction (read or write) status.

Therefore, your PMM240 is address 0x20 for write and 0x21 for read. (You could think of this as having address 0x10, but shifted one bit left to allow for the data direction bit.)

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.