Hello,
I am getting used to the I2C protocol, so do not laugh at me if I ask something dumb. I have bought an I2C-based device, the BV4213 motor controller. I have connected it to arduino using 10KOhm pullup resistors at the VDD line. But when I send the command "Test EEPROM" it returns 255 and when I send the command "Print Firmware Version" (I request from it 2 bytes) it returns -1 and -1. The commands are (copied word-by-word from the datasheet):
Command 0x55 (Test EEPROM)
Format: < S-addr><0x55><start><R- 0x42>s 93 r g-1 p
Addr><Value..><NACK><Stop>
BV4221 Example
0x42>s 55 r g-3 p
The above command will return 1,2,3 if the
device is connected and working correctly.
This command simply returns an incrementing
value until NACK is sent by the master prior to
stop. This can be useful for testing the
interface. It can be used for testing the presence or
other wise of a device at a particular address.
It is also useful during the development stage
to ensure that the I2C is working for that
device.
2. Command 0xA0 (Print Firmware Version)
0x42>s a0 r g-2 p
This will return the two firmware bytes.
This simply returns two bytes that represents
the firmware version.
My code is:
Test EEPROM: void testEeprom()
Print Firmware version: void printFV()
Quote
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(9600);
printFV();
//printID();
Serial.println();
byte aByte = testEeprom();
Serial.println(aByte);
//enableY3Y4();
Serial.println("End");
}
void loop() {
}
byte testEeprom() {
Wire.beginTransmission(0x42);
Wire.write(0x55);
Wire.endTransmission();
Wire.requestFrom(0x42, 1);
while(Wire.available()) {
}
byte res = Wire.read();
return res;
}
void printID() {
Wire.beginTransmission(0x42);
Wire.write(0xA1);
Wire.endTransmission();
Wire.requestFrom(0x42, 2);
while(Wire.available()) {
}
Serial.print(Wire.read());
Serial.print(Wire.read());
}
void enableY3Y4() {
Wire.beginTransmission(0x42);
Wire.write(2);
Wire.write(1);
Wire.endTransmission();
}
void printFV() {
Wire.beginTransmission(0x42);
Wire.write((byte) 0xA0);
Wire.endTransmission();
Wire.requestFrom(0x42, 2);
while(Wire.available())
{
}
Serial.println(Wire.read());
Serial.println(Wire.read());
}
Besides I have also tried putting 330hm pullups but the result remained alike. What's going on?
Thanks in advance
PS I intend to upload a schematic if you request me to do so! Moreover, the BV4213 Datasheet is attached.
I use an Arduino UNO

