0
\$\begingroup\$

I am working on 3-phase power meter development.
I designed the hardware using ADE7880. But due to component shortage, the lead time for purchasing ADE7880 was 2~3 weeks. So I decided to use ADE7878, which was quicker to purchase.

I thought there would be no issue for driving ADE7880 or ADE7878, because it was just I2C communication. But I faced to an issue immediately after started working with the prototype. I could not find the I2C address information in datasheets.

After some searching, I found a similar project SmartPi and there was the I2C address on Line 44 of ade7878.go file.
It was 0x38.

I also found a forum thread "Reading ADE7880 Registers with Arduino using I2C".
Here, the address of ADE7880 was also 0x38.

I scanned the I2C bus and I could see two addresses:

Address Device
0x48 Is this ADE7878?
0x68 Correct result from DS1307 RTC on my board

I attached some pictures for reference.
So, my questions are:

  • What is the correct I2C address of these chips and where is it documented?
  • If it was 0x38 as I found on third-party sources, what is possible reason of my i2cdetect's result - 0x48?
Prototype Closer look of AFE i2cdetect result
pcbcrew-prototype ade7878 i2cdetect
\$\endgroup\$
4
  • 2
    \$\begingroup\$ Datasheet page 69 says "The most significant seven bits of the address byte constitute the address of the ADE7854/ADE7858/ADE7868/ADE7878 and they are equal to 0111000b." It is also shown in Figures 86 and 87. \$\endgroup\$
    – Ben Voigt
    Apr 10, 2023 at 21:03
  • \$\begingroup\$ Yes, I saw it already when I was designing. And I annotated like "I2C address is 0x70" on schematics, for my own reference. However, the source code and forum threads I mentioned were using different address - 0x38. \$\endgroup\$ Apr 10, 2023 at 21:06
  • 2
    \$\begingroup\$ That is 0x38. And "I saw it already when I was designing" totally contradicts your question "I could not find the I2C address information in datasheets" \$\endgroup\$
    – Ben Voigt
    Apr 10, 2023 at 21:07
  • \$\begingroup\$ Sorry for not writing clearer. I meant except those figures, there were no written definition of I2C addresses. Anyway, it was I who did not read the datasheet more carefully. Thank you a lot! \$\endgroup\$ Apr 10, 2023 at 21:14

2 Answers 2

4
\$\begingroup\$

The reason you see 0x38 and not 0x70 is because the I2C functions for Read and Write take an address, bit-shift one to the left, and add a 1 or a 0 for the Read/Write bit. So you pass the I2C-Write function address 0x38, it shifts one bit to the left (0x38 < 1 = 0x70) and sets the 0th bit to 0. You pass the I2C-Read function address 0x38, it shifts one bit to the left and sets the 0th bit to 1, thus technically an I2C Read command uses the slave address 0x71. So yes, the address is 0x70/0x71, but you will need to use 0x38 in your code for most I2C libraries.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The address OCTET is 0x70 for writes (and 0x71 for reads). It has 7 bits of address and one read-/write command bit. The 7 bits of address are 0x38 \$\endgroup\$
    – Ben Voigt
    Apr 10, 2023 at 21:09
  • \$\begingroup\$ Good clarification. Adding it into my answer. \$\endgroup\$
    – InBedded16
    Apr 10, 2023 at 21:10
1
\$\begingroup\$

That's datasheet is quite explicit: the i²c address is 0x70.

\$\endgroup\$
6
  • \$\begingroup\$ You mean 0b01110000 address header on page 69? That was my first thought and after I could not find 0x70 via i2cdetect, I searched around and found such 0x38 address. \$\endgroup\$ Apr 10, 2023 at 21:04
  • 1
    \$\begingroup\$ The address octet is 0111000(R/W). Under some convention that might be written as 0x70, but to i2cdetect it is 0x38. \$\endgroup\$
    – Ben Voigt
    Apr 10, 2023 at 21:07
  • 1
    \$\begingroup\$ It's the 7-bit address vs. 8-bit address. 0x70 is 0b1110000 but you are detecting it as a 7-bit address using the 7 MSBs. 0b0111000 is 0x38. \$\endgroup\$
    – vir
    Apr 10, 2023 at 21:09
  • \$\begingroup\$ Aha, so, it is 0b0111000 = 0x38, instead of 0b01110000 = 0x70. Right? \$\endgroup\$ Apr 10, 2023 at 21:09
  • \$\begingroup\$ Yep, see @InBedded16's answer for more. \$\endgroup\$
    – vir
    Apr 10, 2023 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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