I2C/SMBus repeating 0xFF "noise"

Hi!
In my current arduino project I am trying to "fake" a lithium battery pack for an old Sony Aibo so it can work off a generic RC lipo. The original battery pack communicates with the Aibo using SMBus - original is based on the TI BQ2040 smart battery chip. I am basically trying to fake that chip using the arduino.

I am using an Arduino Nano 33 IoT (mostly because that is what I had on hand). This is the test code that I've written:

#include <Wire.h>

const byte MY_ADDRESS = 0x0B;
byte command;

void setup() {
  command = 0;

  Wire.begin (MY_ADDRESS);
  Wire.onReceive (receiveEvent);  // interrupt handler for incoming messages
  Wire.onRequest (requestEvent);  // interrupt handler for when data is wanted

  //Begin Serial for debuging
  //Serial.begin(9600); 
}

void loop() {
}

void receiveEvent (int howMany) {
  command = Wire.read ();  // remember command for when we get request    
}

void requestEvent () {
  if (command == 0x21) {
      byte byteArray[8] = { 0x07, 0x45, 0x52, 0x41, 0x32, 0x30, 0x31, 0x42 };

      //Write the 3 bytes back
      Wire.write(byteArray, 8);
    }
 }

This is the output from the logic analyzer when using the original battery:

write to 0x0B ack data: 0x21 
read to 0x0B ack data: 0x07 0x45 0x52 0x41 0x32 0x30 0x31 0x42
write to 0x0B ack data: 0x16 
read to 0x0B ack data: 0xE0 0x00
write to 0x0B ack data: 0x08 
read to 0x0B ack data: 0x94 0x0B
write to 0x0B ack data: 0x09 
read to 0x0B ack data: 0x6B 0x20
write to 0x0B ack data: 0x0A 
read to 0x0B ack data: 0x00 0x00
write to 0x0B ack data: 0x10 
read to 0x0B ack data: 0xD8 0x0E
...

This is the output from the logic analyzer when using the arduino with the code above:

write to 0x0B ack data: 0x21 
read to 0x0B ack data: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF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F 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
write to 0x0B ack data: 0x16 
read to 0x0B ack data: 0x07 0x45
write to 0x0B ack data: 0x08 
read to 0x0B ack data: 0xFF 0xFF
write to 0x0B ack data: 0x08 
read to 0x0B ack data: 0xFF 0xFF
write to 0x0B ack data: 0x09 
read to 0x0B ack data: 0xFF 0xFF
write to 0x0B ack data: 0x0A 
read to 0x0B ack data: 0xFF 0xFF
write to 0x0B ack data: 0x10 
read to 0x0B ack data: 0xFF 0xFF
...

From various prints that I had in there I can see that the Aibo does successfully send the 0x21 command and that the arduino reads it ok (and reads any subsequent commands like
0x09). But what I don't get is where those 0xFF come from. Removing the Wire.write call changes nothing. Looking at the output you can see that parts of the message 0x07 0x45 get written eventually, but just in between other noise.

I'm probably missing something stupid, however I cannot figure out what. Any ideas?

Can you post a schematic as you have it wired including all connections. A frizzy thing does not count. It sounds like a bad ground but without a schematic that is just a SWAG.

There is not much of a schematic here.
Pin 2 of the Aibo battery terminal (CLK) is connected to Arduino pin A5 (+logic analyzer)
Pin 3 of the Aibo battery terminal (data) is connected to Arduino pin A4 (+logic analyzer)
Pin 6 of the Aibo battery terminal (GND) is connected to battery GND, arduino GND (+logic analyzer ground)
Pin 1 of the Aibo battery terminal (VCC) is connected to the positive terminal of the battery

That's everything. I am not using any pull-ups on the clock and data lines because I kind of expect this to be done in the Aibo who is serving as the master. Not sure if that is a wrong assumption. I did try adding 4.7k pull ups to 3.3V and it didn't change anything.

Well after some additional googling I saw someone mention that the Nano 33 has some other things on the i2C port that may be interfering. So I switched to a Wemos D1 mini instead... and it works just fine. So it really looks like the issue is with the Nano 33.

1 Like