1
\$\begingroup\$

I recently bought a ZS-042 RTC module which communicates using the I2C protocol. The module includes a DS3231 (RTC) and an AT24C32 (4k EEPROM).

The ZS-042 module has no datasheet, but the Ebay listing (linked above) shows how the DS3231 and AT24C32 are assembled on to the module (ZS-042 is NOT an IC).

When I bought it, I had no idea what the I2C addresses where for the device, so I ran a quick scan and addresses 0x57, 0x5F and 0x68 acknowledged.

I am a little bit confused because the module only includes two I2C devices, but I am getting the ACK from three. I researched and the I2C addresses 0x57 and 0x68 correspond to the DS3131 and AT24C32 respectively, but I couldn't find a single device with the 0x5F address.

I tried running the scan with the module disconnected, and all three addresses disappeared. When reconnected, all three addresses reappeared. To make matters worse, when I send a byte to the ghost device, the device ACKs!

I can physically see only two ICs soldered to the ZS-042.

Any ideas which device is responding to I2C address 0x5F?

P.S. I am using an Arduino UNO with a custom library in order to run the I2C lines under 3.3V (not the standard 5V) from any pair of digital pins. I wrote the library myself using the I2C protocol guidelines and I have thoroughly tested it on EEPROM. This is a link to the library files:

https://github.com/JuaFMaldonado/I2C-Trough-Digital

I am using this simple sketch to scan for devices:

#include <I2CDigital.h>

#define WRITE 0b00000000
#define READ 0b00000001

I2CDigital I2C(12,11);

void setup(){
  Serial.begin(9600);
}

void loop() {
  for(int i=16;i<120;i++){
    if(I2C.startCom((byte)i,WRITE)){
      Serial.print("Device detected at address: ");
      Serial.println(i);
      if(I2C.sendByte(0b00000000)){
        Serial.println("Byte sent successfully");
      }
      I2C.stopCom();
      delayMicroseconds(5);
    }
  }
  delay(5000);
}

Thanks in advance!


EDIT suggested by @ChrisStratton:

To be able to use any pair of digital pins for I2C communication, the pins are only allowed to run in pinMode(pin,INPUT) (for logic high) or pinMode(pin,OUTPUT) and digitalWrite(pin,LOW) (for logic low). The lines can then be connected to any desired pull up voltage (as long as it is still recognised by the device as logic high).

In my particular case they are connected to the 3.3V regulator on the Arduino through 4.7k resistors.

EDIT suggested by @ElliotAlderson:

schematic

simulate this circuit – Schematic created using CircuitLab

EDIT sugested by @Janka

DS3131

DS3131

AT24C32

AT24C32

\$\endgroup\$
20
  • \$\begingroup\$ You should document the electrical solution which allows you to operate 3v3 I2C via these GPIO pins (but apparently not via the standard ones?). What value are your I2C pullup resistors? If you are using some sort of level translator, what value are the pullups on each bus side? \$\endgroup\$ Sep 23, 2018 at 17:17
  • \$\begingroup\$ Please show us a schematic of your circuit, and provide links to the datasheets of the two I2C devices. \$\endgroup\$ Sep 23, 2018 at 17:29
  • 1
    \$\begingroup\$ It's not clear why you think you have different voltage allowances on random digital pins than on the hardware I2C pins; I2C is an open-collector (or in this case, open-drain) bus. If properly implemented positive signals should be being provided only by the pull-up resistors, irrespective of MCU supply voltage, even if you use the hardware I2C. \$\endgroup\$ Sep 23, 2018 at 18:40
  • 1
    \$\begingroup\$ Trying this with the hardware I2C or someone else's implementation would help rule out a subtle bug in the logic or especially timing of yours, which might cause aliasing under some situations. \$\endgroup\$ Sep 23, 2018 at 18:46
  • 1
    \$\begingroup\$ @ChrisStratton I am not 100% about this, but I think the Arduino UNO has the hardware I2C pins (A4 and A5) hardwired to 5V pull up resistors. The module is rated for 3.3V, as it has a 3.3V battery backup that could cause serious issues if supplied with 5V. I am pretty sure connecting external 3.3V pull up resistors to the already pulled up 5V lines could cause all sorts of issues and even hardware damage (reverse polarity on the voltage regulator). Any digital (or even analog) pin can be used with the software, as long as it's not pulled up to 5V. \$\endgroup\$ Sep 23, 2018 at 19:00

1 Answer 1

3
\$\begingroup\$

Original AT24C32 (and friends) say ATMEL in the beginning of the first line of the marking, not ATMLH (or anything else).

The chip on your board is a knock-off of the original AT24C32. It may do anything. Please refer to the datasheet of that ATMLH24C32 chip, if you can find it. I suspect this thing has an incomplete address decoder to make it possible to pass for two different chips, the AT24C32 and some other original at address 0x5f.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You nailed it! To test it I pulled down A2 from the AT24C32. Originally I was getting address 0b01010111 with mirror address 0b01011111. When I pulled down A2 I got address 0b01010011 with mirror address 0b01011011. Both the original and the mirror have 0 and 1 accordingly for bit 4, no matter what the next three bits (A2,A1,A0) are! Thank you \$\endgroup\$ Sep 23, 2018 at 19:21
  • 2
    \$\begingroup\$ Wild guess: I think this is because these chips are used as parameter storage for car ECUs. Parts manufacturers as Bosch may have tried to impede chip tuning by ordering "special" chips from Atmel et al with different addresses, so you couldn't simply exchange the chip. And the knock-off market reacted to this. \$\endgroup\$
    – Janka
    Sep 23, 2018 at 19:27

Your Answer

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

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